public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
Fixed that a return-path header would be ignored (closes #7572) [joost]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9099 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
dhh (author)
Thu Mar 27 10:54:02 -0700 2008
commit  5c0d38f6749e91c9847f6a4d56264d83253b3539
tree    77f73acea1466ea5c314b857480f208137576690
parent  f5b991d76dc5d21f1870da067fb3101440256fba
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *SVN*
0
 
0
+* Fixed that a return-path header would be ignored #7572 [joost]
0
+
0
 * Less verbose mail logging: just recipients for :info log level; the whole email for :debug only. #8000 [iaddict, Tarmo Tänav]
0
 
0
 * Updated TMail to version 1.2.1 [raasdnil]
...
40
41
42
 
 
 
 
43
44
45
46
 
47
48
49
...
590
591
592
 
593
594
595
596
 
597
598
599
600
 
601
602
603
...
40
41
42
43
44
45
46
47
48
49
 
50
51
52
53
...
594
595
596
597
598
599
600
 
601
602
603
604
605
606
607
608
609
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
   #
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
+ #
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
   #
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
   # view.
0
   #
0
@@ -590,14 +594,16 @@ module ActionMailer #:nodoc:
0
       def perform_delivery_smtp(mail)
0
         destinations = mail.destinations
0
         mail.ready_to_send
0
+ sender = mail['return-path'] || mail.from
0
 
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
         end
0
       end
0
 
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/, ''))
0
           sm.flush

Comments

    No one has commented yet.