PHP mail() function does send email to certain servers

acabrera

Limp Gawd
Joined
May 23, 2002
Messages
197
I'm having a problem with my php mailing script. Some domains are able to recieve mail just fine while others never receive the message. What am I doing wrong

Code:
$body = "<strong>Welcome to Jmerica!</strong> <br><br>\n 
You are one step away from activating your new account and joining countless other members in our online community. <br>
Click on the link below to verify your account:<br><br>

<a href=\"http://www.jmerica.com/v2/verify.php?id=$fake_id&email=$email&verify=Re0xxn234xnnUIkne93OL\">[url]http://www.jmerica.com/v2/verify.php?id=[/url]$fake_id&email=$email&verify=Re0xxn234xnnUIkne93OL</a><br>\n
<br>		
If you have any trouble loging in to your new account please email us at <a href=\"mailto:[email protected]\">[email protected]</a><br>\n
<br>		
Once again welcome to the Jmerica.com community! We're glad to have your with us. <br>\n

<br><br>
{NOTE: Jessica should rewrite text but include the verification link and some sort of support contact}\n";
	
	$from = '<[email protected]>';
	
	$header = '';
	$header .= "Contnet-Type: text/html \r\n";
	$header .= "Date: ". date('r'). "\r\n";
	$header .= "Return-Path: [email][email protected][/email] \r\n";
	$header .= "From: $from \r\n";
	$header .= "Sender: $from \r\n";
	$header .= "Reply-To: $from \r\n";
	$header .= "Organization: jmerica.com \r\n";
	$header .= "X-Sender: $from \r\n";
	$header .= "X-Priority: 3 \r\n";
	$header .= "X-Mailer: php \r\n";
	
		
	if (mail($email, "Jmerica.com Account Activation", $body, $header)) {

?>
      <p class="note"> Thank You <b><? echo $HTTP_POST_VARS[name]; ?></b> for 
        signing up with Jmerica.com!<br>
        A confirmation email will be sent to <b><? echo $email; ?></b> within 
        the next 15 minutes.<br>
        Please follow the instruction in this email to activate your Jmerica.com 
        account.<br />
        <br />
        After you account has been verified Sign In jmerica.com to setup your 
        new account.</p>
      <?
} else {	
	
	?>
      <div align="center"><br>
        <br>
        <span class="regText">Your Account Verification Email was not sent. <br>
        Please try again later.<br>
        </span><br>
        <br>
      </div>
      <?
	} // end if else for send mail
 
havne't looked at it but I'd suggest grabbing phpmailer, a free class that makes life much easier (kind of a cop out for offering a solution, but I ran into some problems with the mail() function and after staring at it for a day or so I just phpmailer and the problem went away ;) )
 
Since some domains are getting your messages, that shows that your code is technically working just fine.

However, here's a few things to check on.

1) Check with the admins at the domains that are failing to see if your domain has been put on a blacklist for some reason.

2) Check to see if the mail servers in the offending domains aren't playing nice with one or more of your headers OR see if you're missing a header that they require.

just my $.02
 
Back
Top