0
@@ -40,10 +40,14 @@ module ActionMailer #:nodoc:
0
# * <tt>content_type</tt> - Specify the content type of the message. Defaults to <tt>text/plain</tt>.
0
# * <tt>headers</tt> - Specify additional headers to be set for the message, e.g. <tt>headers 'X-Mail-Count' => 107370</tt>.
0
+ # When a <tt>headers 'return-path'</tt> is specified, that value will be used as the 'envelope from'
0
+ # address. Setting this is useful when you want delivery notifications sent to a different address than
0
+ # the one in <tt>from</tt>.
0
# The <tt>body</tt> method has special behavior. It takes a hash which generates an instance variable
0
# named after each key in the hash containing the value that that key points to.
0
- # So, for example, <tt>body
"account" => recipient</tt> would result
0
+ # So, for example, <tt>body
:account => recipient</tt> would result
0
# in an instance variable <tt>@account</tt> with the value of <tt>recipient</tt> being accessible in the
0
@@ -590,14 +594,16 @@ module ActionMailer #:nodoc:
0
def perform_delivery_smtp(mail)
0
destinations = mail.destinations
0
+ sender = mail['return-path'] || mail.from
0
Net::SMTP.start(smtp_settings[:address], smtp_settings[:port], smtp_settings[:domain],
0
smtp_settings[:user_name], smtp_settings[:password], smtp_settings[:authentication]) do |smtp|
0
- smtp.sendmail(mail.encoded,
mail.from, destinations)
0
+ smtp.sendmail(mail.encoded,
sender, destinations)
0
def perform_delivery_sendmail(mail)
0
+ sendmail_settings[:arguments] += " -f \"#{mail['return-path']}\"" if mail['return-path']
0
IO.popen("#{sendmail_settings[:location]} #{sendmail_settings[:arguments]}","w+") do |sm|
0
sm.print(mail.encoded.gsub(/\r/, ''))
Comments
No one has commented yet.