Ticket #7572: working_return_path.diff
| File working_return_path.diff, 2.0 kB (added by joost, 8 months ago) |
|---|
-
actionmailer/lib/action_mailer/base.rb
old new 40 40 # * <tt>content_type</tt> - Specify the content type of the message. Defaults to <tt>text/plain</tt>. 41 41 # * <tt>headers</tt> - Specify additional headers to be set for the message, e.g. <tt>headers 'X-Mail-Count' => 107370</tt>. 42 42 # 43 # When a <tt>headers 'return-path'</tt> is specified, that value will be used as the 'envelope from' 44 # address. Setting this is useful when you want delivery notifications sent to a different address than 45 # the one in <tt>from</tt>. 46 # 43 47 # The <tt>body</tt> method has special behavior. It takes a hash which generates an instance variable 44 48 # named after each key in the hash containing the value that that key points to. 45 49 # 46 # So, for example, <tt>body "account"=> recipient</tt> would result50 # So, for example, <tt>body :account => recipient</tt> would result 47 51 # in an instance variable <tt>@account</tt> with the value of <tt>recipient</tt> being accessible in the 48 52 # view. 49 53 # … … 590 594 def perform_delivery_smtp(mail) 591 595 destinations = mail.destinations 592 596 mail.ready_to_send 597 sender = mail['return-path'] || mail.from 593 598 594 599 Net::SMTP.start(smtp_settings[:address], smtp_settings[:port], smtp_settings[:domain], 595 600 smtp_settings[:user_name], smtp_settings[:password], smtp_settings[:authentication]) do |smtp| 596 smtp.sendmail(mail.encoded, mail.from, destinations)601 smtp.sendmail(mail.encoded, sender, destinations) 597 602 end 598 603 end 599 604 600 605 def perform_delivery_sendmail(mail) 606 sendmail_settings[:arguments] += " -f \"#{mail['return-path']}\"" if mail['return-path'] 601 607 IO.popen("#{sendmail_settings[:location]} #{sendmail_settings[:arguments]}","w+") do |sm| 602 608 sm.print(mail.encoded.gsub(/\r/, '')) 603 609 sm.flush