Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commit da61a6c9671239dbb4a926c3e161ca8663fa0e3f
- Author: Joey A <joey@aghion.com>
- Date: Fri Aug 7 14:30:01 2009 +0200
- avoid generating invalid SMTP commands in ruby pre 1.9
- Signed-off-by: Michael Koziarski <michael@koziarski.com>
- diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
- index 84997de..36122e2 100644
- --- a/actionmailer/lib/action_mailer/base.rb
- +++ b/actionmailer/lib/action_mailer/base.rb
- @@ -675,7 +675,7 @@ module ActionMailer #:nodoc:
- def perform_delivery_smtp(mail)
- destinations = mail.destinations
- mail.ready_to_send
- - sender = (mail['return-path'] && mail['return-path'].spec) || mail['from']
- + sender = (mail['return-path'] && mail['return-path'].spec) || Array(mail.from).first
- 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)
- diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb
- index db6d3df..d0c0e80 100644
- --- a/actionmailer/test/mail_service_test.rb
- +++ b/actionmailer/test/mail_service_test.rb
- @@ -29,6 +29,18 @@ class TestMailer < ActionMailer::Base
- self.body = "Goodbye, Mr. #{recipient}"
- end
- + def from_with_name
- + from "System <system@loudthinking.com>"
- + recipients "root@loudthinking.com"
- + body "Nothing to see here."
- + end
- +
- + def from_without_name
- + from "system@loudthinking.com"
- + recipients "root@loudthinking.com"
- + body "Nothing to see here."
- + end
- +
- def cc_bcc(recipient)
- recipients recipient
- subject "testing bcc/cc"
- @@ -454,6 +466,28 @@ class ActionMailerTest < Test::Unit::TestCase
- assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded
- end
- + def test_from_without_name_for_smtp
- + ActionMailer::Base.delivery_method = :smtp
- + TestMailer.deliver_from_without_name
- +
- + mail = MockSMTP.deliveries.first
- + assert_not_nil mail
- + mail, from, to = mail
- +
- + assert_equal 'system@loudthinking.com', from.to_s
- + end
- +
- + def test_from_with_name_for_smtp
- + ActionMailer::Base.delivery_method = :smtp
- + TestMailer.deliver_from_with_name
- +
- + mail = MockSMTP.deliveries.first
- + assert_not_nil mail
- + mail, from, to = mail
- +
- + assert_equal 'system@loudthinking.com', from.to_s
- + end
- +
- def test_reply_to
- expected = new_mail
Add Comment
Please, Sign In to add comment