Return-Path mail header

software development

#1

Sending mail from PHP. Want Return-Path header to read me@mydomain.com instead of me@yoda.dreamhost.com

Setting Return-Path as an additional header doesn’t work.

Is it possible to change it?


#2

How about:

mail($email, $subject, $message, $headers, ‘-fyou@example.com’);

There’s a bunch of info on the mail() function here.


:stuck_out_tongue: Maximum savings promo code: MaxSavingsAtDH


#3

(Note that XXXXXXXX, YYYYYYYY and ZZZZZZZZ have been removed for posting/anti-spam purposes, but are in fact legitimate email addresses.)

Not working:

return mail($recipients, $subject, $body, $text_headers, ‘-fZZZZZZZZ’);

Headers below. Note where the -f is showing up:

Delivered-To: XXXXXXXX@gmail.com
Received: by 10.142.141.19 with SMTP id o19cs104373wfd;
Thu, 10 Apr 2008 15:23:12 -0700 (PDT)
Received: by 10.141.68.5 with SMTP id v5mr1095649rvk.179.1207866191728;
Thu, 10 Apr 2008 15:23:11 -0700 (PDT)
Return-Path: coolgeek@yoda.dreamhost.com
Received-SPF: pass (google.com: domain of coolgeek@yoda.dreamhost.com designates 66.33.216.244 as permitted sender) client-ip=66.33.216.244;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of coolgeek@yoda.dreamhost.com designates 66.33.216.244 as permitted sender) smtp.mail=coolgeek@yoda.dreamhost.com
Received: from smarty.dreamhost.com (smarty.dreamhost.com [208.113.175.8])
by pants.dreamhost.com (Postfix) with ESMTP id 5DDDE14C015
for XXXXXXXX@gmail.com; Thu, 10 Apr 2008 15:23:11 -0700 (PDT)
Received: from yoda.dreamhost.com (yoda.dreamhost.com [208.113.249.139])
by smarty.dreamhost.com (Postfix) with ESMTP id 2B3DCEE26E
for XXXXXXXX@gmail.com; Thu, 10 Apr 2008 15:23:11 -0700 (PDT)
Received: by yoda.dreamhost.com (Postfix, from userid 54740)
id 56009743DC; Thu, 10 Apr 2008 15:23:10 -0700 (PDT)
To: XXXXXXXX@gmail.com
Subject: (Take a) New Look at Honest Argument!
MIME-Version: 1.0
From: ZZZZZZZZ@honestargument.com
Reply-To: bounce@honestargument.com
Errors-To: YYYYYYYY@honestargument.com
-f: ZZZZZZZZ@honestargument.com
Content-Type: multipart/alternative;
boundary="=_0f953fc1bce16cbee294ce93b7388a99"
Message-Id: 20080410222310.56009743DC@yoda.dreamhost.com
Date: Thu, 10 Apr 2008 15:23:10 -0700 (PDT)


#4

That’s odd - it works for me and puts that as the return path. I’ve never seen “-f” show up in the headers before.

Any chance there’s something screwy with the headers you’re adding?

What happens if you test it with this instead:

mail($recipients, $subject, $body, null, ‘-fvalidemail@example.com’);


:stuck_out_tongue: Maximum savings promo code: MaxSavingsAtDH