Bring `catchmail` closer to `sendmail`
Sendmail's conventional interface is `sendmail [options] [recipient ...]` Fixes #188
This commit is contained in:
parent
927b8a1aae
commit
e76d367755
|
@ -13,7 +13,7 @@ options = {:smtp_ip => '127.0.0.1', :smtp_port => 1025}
|
||||||
|
|
||||||
OptionParser.new do |parser|
|
OptionParser.new do |parser|
|
||||||
parser.banner = <<-BANNER.gsub /^ +/, ""
|
parser.banner = <<-BANNER.gsub /^ +/, ""
|
||||||
Usage: catchmail [options]
|
Usage: catchmail [options] [recipient ...]
|
||||||
sendmail-like interface to forward mail to MailCatcher.
|
sendmail-like interface to forward mail to MailCatcher.
|
||||||
BANNER
|
BANNER
|
||||||
|
|
||||||
|
@ -56,6 +56,16 @@ Mail.defaults do
|
||||||
:port => options[:smtp_port]
|
:port => options[:smtp_port]
|
||||||
end
|
end
|
||||||
|
|
||||||
message = Mail.new ARGF.read
|
message = Mail.new($stdin.read)
|
||||||
|
|
||||||
message.return_path = options[:from] if options[:from]
|
message.return_path = options[:from] if options[:from]
|
||||||
|
|
||||||
|
ARGV.each do |recipient|
|
||||||
|
if message.to.nil?
|
||||||
|
message.to = recipient
|
||||||
|
else
|
||||||
|
message.to << recipient
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
message.deliver
|
message.deliver
|
||||||
|
|
Loading…
Reference in New Issue