I''m the original poster that asked how to set the "real"
email address
in the envelope of an email (as opposed to the "From:" in the mail
body
that really doesn''t mean anything).
This will do it:
mail = "To: someguy-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org\r\n" +
              "From: do-not-reply-5tc4TXWwyLM@public.gmane.org\r\n" +
              "Subject: Test Email\r\n" +
              "\r\nHi Mom!  This is an email message!"
      		Net::SMTP.start("smtp.myhost.com", 25,
"smtp.myhost.com",
"jdeneut-3t13RrdZcR7QT0dZR+AlfA@public.gmane.org",
"password", :plain) do |smtp|
        		smtp.send_mail(mail,
"jdeneut-4GWaZ2qAA/nQT0dZR+AlfA@public.gmane.org",
["someguy-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org",
"jdeneut-4GWaZ2qAA/nQT0dZR+AlfA@public.gmane.org"])
      		end
This mail will *appear* to come from
"do-not-reply-5tc4TXWwyLM@public.gmane.org", but I''ve set
the mail envelope so that MTAs know that the real sender is 
"jdeneut-4GWaZ2qAA/nQT0dZR+AlfA@public.gmane.org".  Is it possible to
add to ActionMailer a
distinction between envelope and body for emails?
And for the poster that asked: "It strikes me that what you''re
trying
to do is the *reason* SPF was
created.  If it were easy for any old person to set the relevant
headers SPF would be .... useless."
Um, the whole point of setting the envelope to my *real* email address 
is to comply with SPF.  Maybe it''s easier if I give an example.  I want
to run a flower site on my cable modem, and I want to send out mail to 
customers that appear to come from
"jdeneut-4bQiiEXbhjKXI831tlzg6A@public.gmane.org".  This
will be rejected by many SPF agents as suspicious, although there''s no 
bad intent here. So what I do is set the envelope "Return-Path" to be 
jdeneut-Wuw85uim5zDR7s880joybQ@public.gmane.org or whatever my *real* email
account is.  I of
course can''t get Comcast to make special SPF entries for my little 
home-hosted web site, but at the same time MTAs want to know the real 
source of emails. Problem solved.  Not everyone is running their own 
sendmail and controls the DNS for their projects.
Jack
------ ORIGINAL MAIL -----
I was wondering if there was any way to set the ''Return-Path''
of an
email when using ActionMailer.  Without the ability to set the
''Return-Path'' of an email, it is impossible to avoid being
labeled as
''spam'' by many SMTP gateways if trying to send mail on
another''s
behalf.  SPF doesn''t care about the ''from'' line in an
email, only the
''Return-Path''.
Why would I want to do that?  Because I am working as a consultant for
another company, and when responding to bug reports I want to make
things easier for the users by replying ''from'' the
client''s domain.
Unfortunately, they can''t give me access to their SMTP server
(they''re
afraid to muck with sendmail and so I get ''can not relay'' when
I use
their SMTP gateway).
For example, here are the headers from a mail I sent to myself using
ActionMailer.  As you can see, Gmail has marked it as ''fail''
(in
''Received-SPF'') :
X-Gmail-Received: aac7ac60620782da0f1e605962a47ceaf022a2d0
Delivered-To: jdeneut at gmail.com
Received: by 10.38.12.43 with SMTP id 43cs8575rnl;
          Tue, 8 Mar 2005 22:51:57 -0800 (PST)
Received: by 10.38.82.76 with SMTP id f76mr547559rnb;
          Tue, 08 Mar 2005 22:51:57 -0800 (PST)
Return-Path: <do-not-reply at wp.pl>
Received: from omta16.mta.everyone.net (sitemail2.everyone.net
[216.200.145.36])
          by mx.gmail.com with ESMTP id 
71si394734rna.2005.03.08.22.51.56;
          Tue, 08 Mar 2005 22:51:56 -0800 (PST)
Received-SPF: fail (gmail.com: domain of do-not-reply at wp.pl does not
designate 216.200.145.36 as permitted sender)
Received: from pmta01.mta.everyone.net (bigiplb-dsnat [172.16.0.19])
	by omta16.mta.everyone.net (Postfix) with ESMTP id 301233FDA8
	for <jdeneut at gmail.com>; Tue,  8 Mar 2005 22:51:55 -0800 (PST)
X-Eon-Sig: AQIdLpBCLp0L6UAQSwIAAAAB,99b3d5966c8c0368c842a831fa4ddfdd
Received: from smtp.everyone.net (62.245.95.172 [62.245.95.172])
	by pmta01.mta.everyone.net (EON-AUTHRELAY) with ESMTP id 24AB116D
	for <jdeneut at gmail.com>; Tue, 8 Mar 2005 22:51:55 -0800
Date: Wed, 9 Mar 2005 07:51:53 +0100
From: do-not-reply at wp.pl
To: jdeneut at gmail.com
Subject: =Thank you for your bug report
Content-Type: text/plain; charset=utf-8
Message-Id: <20050309065155.301233FDA8 at omta16.mta.everyone.net>
I tried this:
class MyMailer < ActionMailer::Base
      def my_mail(recipients, post)
        @headers["Return-Path"]      = "jdeneut at
dekadu.com"
       end
end
but it doesn''t work (trying to set the ''Return-Path''
by playing with
the headers doesn''t work in JavaMail either.  Java has an SMTP wrapper
for setting ''Return-Path''). I''ve looked in TMail as
well, but didn''t
see it there. Is this even supported in Ruby (setting the
''Return-Path'')?
   Regards,
Jack DeNeut
------------------------------------------------