Jump to content

mail() problem


tecmeister

Recommended Posts

Hi Guys,

 

I've set up a contact email form.  It sends the information fine, but it sends it to the junk folder.

If I just use this command:

$headers = "MIME-Version: 1.0 \n";

 

It will send it to my inbox folder.  If I use any other command after it in the $headers variable it will then send it to my junk folder.

 

Here is the full code I'm using:

$to = "[email protected]";
		$subject = $title;
		$message  = "<html><body>";
		$message .= "<div style='border: 1px #ccc solid; padding: 5px; width: 100%; text-align: center'>";
		$message .= "<b>Message From ". $name ."</b></div><br />";
		$message .= "<div style='border: 1px #ccc solid; padding: 10px'>";
		$message .= "Dear Emma,<br /><br />";
		$message .= "<span>".$mess."</span></div>";
		$message .= "</body></html>";
		$headers = 'MIME-Version: 1.0' . "\n";
		$headers .= "From: ".$name."<".$email.">\n";
    			$headers .= "Reply-To: ".$name."<".$email.">\n";
    			$headers .= "Return-Path: ".$name."<".$email.">\n";
		$headers .= "cc: ". $name . "<".$email.">\n";
    			$headers .= "X-Mailer: Drupal\n";
    			$headers .= "Content-type: text/html; charset=iso-8859-1" . "\n";

		mail($to, $subject, $message, $headers);

 

Thanks,

 

tecmeister.

Link to comment
https://forums.phpfreaks.com/topic/192533-mail-problem/
Share on other sites

"From: ".$name."<".$email.">\n"

 

The From: address must be a valid email address at the sending mail server (or there must be an SPF record at the domain being used in the From: address that says that your mail server is authorized to send email for that domain.)

 

Would you trust a letter you received from your credit card company with a From: address from within your country but a post mark saying it was mailed from a different country?

Link to comment
https://forums.phpfreaks.com/topic/192533-mail-problem/#findComment-1014796
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.