Skip to content

Instantly share code, notes, and snippets.

@spiegela
Created January 13, 2011 14:32
Show Gist options
  • Save spiegela/777939 to your computer and use it in GitHub Desktop.
Save spiegela/777939 to your computer and use it in GitHub Desktop.
Mail Enhancement Examples
smtp = Net::SMTP.start('127.0.0.1', 25)
Mail.defaults do
delivery_method :smtp_connection, :connection => smtp
end
mail1 = Mail.deliver do
from '[email protected]'
to '[email protected], [email protected]'
subject 'invalid RFC2822'
end
mail2 = Mail.deliver do
from '[email protected]'
to '[email protected]'
subject 'invalid RFC2822'
end
[mail1, mail2].each{ |m| m.deliver! }
Mail.defaults do
delivery_method :smtp, :return_response => true
end
mail1 = Mail.deliver do
from '[email protected]'
to '[email protected], [email protected]'
subject 'invalid RFC2822'
end
mail1.deliver!1
=> #<Net::SMTP::Response:0x10350eac0 @string="250 2.0.0 Ok\n", @status="250">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment