Jump to content

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

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.