I''ve looked further into this, and it is TMail which for some
inexplicable reason (overzealous compliance with RFC, possibly)
strips the Return-Path header from all outgoing mail. I''ll be writing
to the author for clarification as to the exact reasons for this kind
of Orwellian behaviour. Meanwhile, a work-around is to override the
following method in your Mailer subclass:
class Mailer < ActionMailer::Base
#
# This performs delivery with an explicit FROM, using VERP. For
this to work,
# the Rails mail delivery method has to be :sendmail. For :smtp to
work, you need
# to specify address rewriting in the MTA (Postfix, Sendmail,
QMail, etc)
# directly, since TMail doesn''t allow anyone to transfer a Return-
Path
# header, which is what we do here by using the -f option (VERP is
just
# an added bonus).
#
def perform_delivery_sendmail(mail)
IO.popen("/usr/sbin/sendmail -itV+= -f
bounces-FBj3rGVNSac4Q++5jOxPmw@public.gmane.org","w
+") do |sm|
sm.print(mail.encoded.gsub(/\r/, ''''))
sm.flush
end
end
...
your mailer methods here
...
end
VERP is nice, and there is no reason you shouldn''t use it, as it
allows bounces of forwarded mail, etc. It also allows you to encode
the recipient''s address in the reply address, if you like, which may
be easier than having to decode the entire bounced email. If you
don''t want VERP, use the following string as the first parameter to
IO.popen instead:
"/usr/sbin/sendmail -i -t -f
bounce-FBj3rGVNSac4Q++5jOxPmw@public.gmane.org"
It is curious that Rails uses an absolute path to Postfix'' sendmail
replacement, but it does.
Anyway, hope this is of some help.
/ Peter Bengtson
26 sep 2006 kl. 07.37 skrev Cory Wright:
>
> PeterB wrote:
>> How can I prevent Rails from stripping
@header[''Return-Path''] in an
>> outgoing e-mail?
>
> I''ve been wondering the same. In our application we have a need
to
> place a generated hash into the return path for tracking purposes. I
> have looked through the ActionMailer code, and it appears that
> TMail is
> responsible for removing the return-path header field.
>
> Can someone suggest a way to preserve the return-path that we have
> set?
>
> Thanks,
>
> Cory
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---