phpknight Posted July 31, 2007 Share Posted July 31, 2007 I am having a slight issue. When email that I send through a script fails, it bounces to the main server email account that I do not use. Even changing the reply-to header does not make a difference. Is there a way through PHP or cPanel that you can configure it so you specify where failed email sent through scripts goes? Setting the default address is not the solution because it only sends unrouted mail there. The main account gets routed, I just do not want to use it. So, instead of failed mail going to bob123@host.myserver.com, I want it to go to something like bob@myserver.com. Any help is appreciated. Quote Link to comment Share on other sites More sharing options...
the_oliver Posted July 31, 2007 Share Posted July 31, 2007 Can you post the headers code your putting into email? Quote Link to comment Share on other sites More sharing options...
phpknight Posted August 1, 2007 Author Share Posted August 1, 2007 Hi, I don't think the headers are the problem. I send the failed message to three addresses: one at my domain, one at yahoo!, and then one that is supposed to fail but bounce to me. In outlook and Yahoo!, when I get the message the reply goes to reply-to, but the failed message still ends up going to the main server address. Here are the headers below with the addresses modified. <?PHP $headers="From:Me<test@mydomain.com>\n"; $headers.="Content-Type:text/html;CHARSET=iso-8859-1\n"; $headers.="Reply-To:Me<test@mydomain.com>\n"; $subject="Fail test 3"; $address="failaddress@mydomain.com"; //this one will bounce, but the bounce does not go to test@mydomain.com--that is the problem $msg="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html><head><title></title></head><body bgcolor=\"#D7D7D7\">this is only a test</body></html>"; //tests for the mail being sent $test=mail($address,$subject,$msg, $headers); if ($test==true) print "mail sent"; else print "mail not sent"; $address="test@yahoo.com"; //good send 1 $test=mail($address,$subject,$msg, $headers); $address="test@mydomain.com"; //good send 2 $test=mail($address,$subject,$msg, $headers); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.