Skip to content

Commit

Permalink
Move smtp_tls check to proper place
Browse files Browse the repository at this point in the history
Net::SMTP#enable_starttls needs to be called *before* #start
  • Loading branch information
oboxodo committed Apr 27, 2010
1 parent 31347fb commit 274bcfe
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/action_mailer/ar_sendmail.rb
Expand Up @@ -461,13 +461,12 @@ def cleanup
def deliver(emails)
user = smtp_settings[:user] || smtp_settings[:user_name]
server = Net::SMTP.new smtp_settings[:address], smtp_settings[:port]
if smtp_settings[:tls] then
raise 'gem install smtp_tls for 1.8.6' unless server.respond_to? :starttls
smtp.enable_starttls
end
server.start smtp_settings[:domain], user, smtp_settings[:password],
smtp_settings[:authentication] do |smtp|
if smtp_settings[:tls] then
raise 'gem install smtp_tls for 1.8.6' unless
server.respond_to? :starttls
smtp.enable_starttls
end
@failed_auth_count = 0
until emails.empty? do
email = emails.shift
Expand Down

0 comments on commit 274bcfe

Please sign in to comment.