Jump to content

Recommended Posts

Hi Guys

 

I've got an odd issue on my hands and i hope someone can help.

 

I have a simple contact form on a client's site.

 

the php mail code is below.

 

Anyway this works perfectly for me and always delivers to my email. However, the client doesnt get anything and nothing (according to them) is getting caught by their spam checker.

 

The ONLY difference i can spot in all of this is that their email address contains a hyphen, whereas all the email addresses i have tested on do not. Is it possible this could cause an issue? OR is just that they can't work their spam checker and its their fault?

 

If the hyphen could cause an issue then can anyone suggest an alternative syntax to guard against this?

 

Many thanks chaps!

 

Drongo

 


							$to = "info@mysite.com, theirsite@their-site.com,";
							$subject = "form submission";

							$message = "
							<html>
							<head>
							<title>form submission</title>
							</head>
							<body>
							<h2>form submission</h2>

							The form was submitted from the $originates form <br/><br/>

							Name:  $validated[name]
							<br/><br/>
							Email: $validated[email]
							<br/><br/>
							Telephone (if entered): $validated[number]
							<br/><br/>
							Enquiry: $validated[enquiry]

							</body>
							</html>
							";




							// Always set content-type when sending HTML email
						$headers = "MIME-Version: 1.0" . "\r\n";
						$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";

						// More headers
						$headers .= 'From: <DoNotReply@mysite.com' . "\r\n";


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

Link to comment
https://forums.phpfreaks.com/topic/255617-php-mail-not-delivering/
Share on other sites

the hyphen doesn't usually cause an issue with mail, many organizations actually delete spam as it arrives, so make sure your have your give your headers in full (return addresses, etc). Chances are that your mail is being caught in SPAM and either the mail is automatically deleted by the receiving organizations mail client (Microsoft does this with webmail, and client email services, if the user is not an administrator). The best cure is to list headers (Just google, full php mail headers.)

 

Since you're recieving the mail on a seperate client, it wouldn't be a postfix issue, or a php syntax error.

Thanks Jack!

 

It  helps to have a second opinion. I will try being more conscientious with my headers and see if that fixes the isssue.

 

Out of interest any specifics on precisely what headers might be useful to include? Being tht this is such a simplistic email i am a bit unsure.

 

Drongo

 

 

 

the hyphen doesn't usually cause an issue with mail, many organizations actually delete spam as it arrives, so make sure your have your give your headers in full (return addresses, etc). Chances are that your mail is being caught in SPAM and either the mail is automatically deleted by the receiving organizations mail client (Microsoft does this with webmail, and client email services, if the user is not an administrator). The best cure is to list headers (Just google, full php mail headers.)

 

Since you're recieving the mail on a seperate client, it wouldn't be a postfix issue, or a php syntax error.

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: Jack <jack@example.com>, Jack <jack@example1.com>' . "\r\n";
$headers .= 'From: Jack <jack@example.com>' . "\r\n";
$headers .= 'Cc: jack@example.com' . "\r\n";
$headers .= 'Bcc: jack@example.com' . "\r\n";
$headers .= "Reply-To: jack@example.com\r\n";
$headers .= "Return-Path: jack@example.com\r\n";

 

That should probably do it, if it make sure all of the adresses are consistent with eachother (from is your postfix account, return-patch and reply-to are the same as from). Change the Content type if you ant plain text. Also, you can remove CC and BCC.

 

 

Thanks Jack that's brill!

 

I'll give this a shot and see if there's any joy.

 

Thanks for your help!

 

:)

 

 

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: Jack <jack@example.com>, Jack <jack@example1.com>' . "\r\n";
$headers .= 'From: Jack <jack@example.com>' . "\r\n";
$headers .= 'Cc: jack@example.com' . "\r\n";
$headers .= 'Bcc: jack@example.com' . "\r\n";
$headers .= "Reply-To: jack@example.com\r\n";
$headers .= "Return-Path: jack@example.com\r\n";

 

That should probably do it, if it make sure all of the adresses are consistent with eachother (from is your postfix account, return-patch and reply-to are the same as from). Change the Content type if you ant plain text. Also, you can remove CC and BCC.

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.