change email address? and reply back

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Rickc
Forum Newbie
Posts: 2
Joined: Tue Oct 31, 2006 8:45 am

change email address? and reply back

Post by Rickc »

Is there a way i can accept an email and forward it on to an address so it looks like it came from another? and then when that person replys to it it sends it back to the orginal address.

eg.

andy@hotmail.com > support@domain.com > support@domain2.com

then

support@domain2.com > support@domain.com > andy@hotmail.com

whist hiding the support@domain2.com address??

cheers

Rick
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You won't be able to hide the originating address absolutely, but for most people it can be hidden. The Reply-To header will tell a compliant email client where to send a reply to.
Rickc
Forum Newbie
Posts: 2
Joined: Tue Oct 31, 2006 8:45 am

Post by Rickc »

any code out there that lets me do that?
thanks for the reply

Cheers
Rick
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Rickc wrote:any code out there that lets me do that?
thanks for the reply

Cheers
Rick
Actually this can be entirely hidden but you'll need control over the system filter of the mail server to do it.

Set up a pipe to deliver *all* mail sent to support@domain.tld elsewhere.

Set up the mail client for the person reading email from support@domain2.tld so it uses the same MX server to relay the mail as where it came from (i.e. the MX for support@domain.tld).

Set up a filter which checks if the sender address is "support@domain2.tld" via this relay, remove all headers for support@domain2.tld and replace them with support@domain.tld. The recipient is completely unaware.

It sounds complex (and yes it's a bit hairy) but really it's quite simple to do if and only if you have access to the mail server configuration.
_ca_
Forum Newbie
Posts: 12
Joined: Wed Oct 25, 2006 4:38 pm

Post by _ca_ »

Rickc wrote:any code out there that lets me do that?
This should do this: (not tested, sorry)

Code: Select all

$headers  = "From: Him <him@example.com>";
$headers .= "Reply-To: Me <me@example.com>\n";
$headers .= "Return-Path: Me <me@example.com>\n";

mail('someone@example.com', 'subject', 'body', $headers);
Chris
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

_ca_ wrote:
Rickc wrote:any code out there that lets me do that?
This should do this: (not tested, sorry)

Code: Select all

$headers  = "From: Him <him@example.com>";
$headers .= "Reply-To: Me <me@example.com>\n";
$headers .= "Return-Path: Me <me@example.com>\n";

mail('someone@example.com', 'subject', 'body', $headers);
Chris
Yeah but that won't hide the address and it won't keep the reply-to header in subsequent. It will make the reply come back to your address for that email though :)
Post Reply