diff options
author | Grant Hollingworth <grant@antiflux.org> | 2008-11-05 22:54:37 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-11-06 13:07:16 +0100 |
commit | 732c724df61bc8b780dc42817625b25a321908e4 (patch) | |
tree | c444d2594fc1bc6f3888d9eeb61b6b8417959d58 /actionmailer/lib | |
parent | 6406a87eedb74a41f19f5ad21ea1b8f97dd45755 (diff) | |
download | rails-732c724df61bc8b780dc42817625b25a321908e4.tar.gz rails-732c724df61bc8b780dc42817625b25a321908e4.tar.bz2 rails-732c724df61bc8b780dc42817625b25a321908e4.zip |
Turn on STARTTLS if it is available in Net::SMTP (added in Ruby 1.8.7) and the SMTP server supports it [#1336 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
Diffstat (limited to 'actionmailer/lib')
-rw-r--r-- | actionmailer/lib/action_mailer/base.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 043f56ba17..d63a608109 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -663,8 +663,10 @@ module ActionMailer #:nodoc: mail.ready_to_send sender = mail['return-path'] || mail.from - Net::SMTP.start(smtp_settings[:address], smtp_settings[:port], smtp_settings[:domain], - smtp_settings[:user_name], smtp_settings[:password], smtp_settings[:authentication]) do |smtp| + smtp = Net::SMTP.new(smtp_settings[:address], smtp_settings[:port]) + smtp.enable_starttls_auto if smtp.respond_to?(:enable_starttls_auto) + smtp.start(smtp_settings[:domain], smtp_settings[:user_name], smtp_settings[:password], + smtp_settings[:authentication]) do |smtp| smtp.sendmail(mail.encoded, sender, destinations) end end |