Jump to content

Email question for a dedicated server


phpknight

Recommended Posts

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.

Link to comment
Share on other sites

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); 
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.