Drongo_III Posted January 23, 2012 Share Posted January 23, 2012 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); Quote Link to comment https://forums.phpfreaks.com/topic/255617-php-mail-not-delivering/ Share on other sites More sharing options...
jackr1909 Posted January 24, 2012 Share Posted January 24, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/255617-php-mail-not-delivering/#findComment-1310569 Share on other sites More sharing options...
Drongo_III Posted January 24, 2012 Author Share Posted January 24, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/255617-php-mail-not-delivering/#findComment-1310650 Share on other sites More sharing options...
jackr1909 Posted January 25, 2012 Share Posted January 25, 2012 $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. Quote Link to comment https://forums.phpfreaks.com/topic/255617-php-mail-not-delivering/#findComment-1310945 Share on other sites More sharing options...
Drongo_III Posted January 25, 2012 Author Share Posted January 25, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/255617-php-mail-not-delivering/#findComment-1311030 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.