From f6a957122aa64371f0b7dbdd0e646c516207adc9 Mon Sep 17 00:00:00 2001 From: Jeff McDonald Date: Thu, 17 Apr 2014 21:26:03 -0700 Subject: [PATCH] Add support for SMTP directly over SSL --- actionmailer/lib/action_mailer/base.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 3e4e7d1ff3cf1..a1584c4d638b6 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -248,6 +248,7 @@ module ActionMailer #:nodoc: # This is a symbol and one of :plain, :login, :cram_md5. # * :enable_starttls_auto - When set to true, detects if STARTTLS is enabled in your SMTP server and starts to use it. # It works only on Ruby >= 1.8.7 and Ruby >= 1.9. Default is true. + # * :enable_tls - When set to true, enables SMTP directly over SSL/TLS. Default is false. # # * sendmail_settings - Allows you to override options for the :sendmail delivery method. # * :location - The location of the sendmail executable. Defaults to /usr/sbin/sendmail. @@ -299,6 +300,7 @@ class Base :password => nil, :authentication => nil, :enable_starttls_auto => true, + :enable_tls => false, } cattr_accessor :smtp_settings @@ -712,6 +714,7 @@ def perform_delivery_smtp(mail) smtp = Net::SMTP.new(smtp_settings[:address], smtp_settings[:port]) smtp.enable_starttls_auto if smtp_settings[:enable_starttls_auto] && smtp.respond_to?(:enable_starttls_auto) + smtp.enable_tls if smtp_settings[:enable_tls] && smtp.respond_to?(:enable_tls) smtp.start(smtp_settings[:domain], smtp_settings[:user_name], smtp_settings[:password], smtp_settings[:authentication]) do |smtp| smtp.sendmail(mail.encoded, sender, destinations)