Forum Moderators: coopster

Message Too Old, No Replies

Php e-mail header problem with Sender and auto-replies

Php e-mail header problem with Sender and auto-replies

         

webman5000

2:18 pm on Sep 17, 2008 (gmt 0)

10+ Year Member



I am trying to send a message to "recipient@example-b.com" on behalf of "customer@example-c.com" from a form at example-a.com.

"Sender" has to be included in the headers to work around certain service providers blocking web-generated mail that looks suspicious, so it is set (for all messages) to "server@example-a.com". If "Sender" is left out, auto-responders will go to customer@example-c.com", but there is a chance of the message being blocked by some ISPs.

I have a problem with auto-responders and failure notifications being sent to "server@example-a.com" instead of "customer@example-c.com" who originally sent the message. Is there any way to get auto-replies and other automatic notifications to go to the *person* that sent the message instead of the *website/server*?

Code looks something like this:


<?php
$sendmail = "PATH/TO/SENDMAIL -t -f server@example-a.com";
$m = popen($sendmail, "w");
fputs($m, 'To: recipient@example-b.com'."\r\n");
fputs($m, 'Return-Path: server@example-a.com'."\r\n");
fputs($m, 'Sender: server@example-a.com'."\r\n");
fputs($m, 'From: "customer" <customer@example-c.com>'."\r\n");
fputs($m, 'Reply-To: customer@example-c.com'."\r\n");
fputs($m, 'Subject: Test Message ('.time().')'."\r\n");
fputs($m, "\r\n");
fputs($m, 'This is another test message.'."\r\n");
fputs($m, "\r\n");
pclose($m);
?>

[edited by: jatar_k at 2:41 pm (utc) on Sep. 18, 2008]

jatar_k

2:44 pm on Sep 18, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



have you tried switching Return-Path to example-c

trouble is when you are trying to send mail on behalf of another domain you are raising spam flags, as well you should, so you need to find highest success rate as strict servers will always bounce it

webman5000

2:54 pm on Sep 18, 2008 (gmt 0)

10+ Year Member



Yes, tried that - it still bounces errors and auto-replies back to server@example-a.com. :(

I realize that it does look a bit spammy, but it's been working perfectly for years until service providers have updated their spam policies. Now I've had to make some updates (including "sender") that's caused this issue to arise.