jasonc Posted January 17, 2008 Share Posted January 17, 2008 some of our members are able to get email when i uses the email address in the from_email variable using outlook express but not when it is sent via the server/website. the email text variable contains full html, <html>blah<head>blah</head><body>blah</body></html> the email address being sent to has been checked in the databases and even removed and typed manually to be sure no strange characters are there and still it does not work. is the following code the correct way to send it? thanks in advance for your help. $email_headers = "Content-Type: text/html; charset=ISO-8859-1\r\nFrom: ".$from_email."\r\n"; mail("$email","Thank you for signing up to ".$sitename, $emailtext, $email_headers); Quote Link to comment https://forums.phpfreaks.com/topic/86431-emails-not-getting-to-members-when-using-mail/ Share on other sites More sharing options...
Cep Posted January 17, 2008 Share Posted January 17, 2008 That's not actually all your code, if you want help its better to post as much as you can. I would do two things, 1. Return the value of mail() to see if its the function in PHP failing or your mail server. PHP mail() does not actually send mail it merely passes it to an smtp server. If mail() returns a false value it means it could not pass the email. Also if your using a variable as a value you do not need to surround it in double quotes unless its part of a string. <?php $mymail = mail($email,"Thank you for signing up to {$sitename}", $emailtext, $email_headers); if ($mymail===false) { echo "Could not pass mail to server"; } else { echo "Pass succeeded"; } ?> 2. Check your server queues are not full, queuing or placing messages on hold for resend, if you find this is happening its an issue with your mail server and not PHP. Additionally if your using Windows and Exchange you need to make setting changes in your php.ini and allow SMTP services to run from your webserver environment via PHP. Quote Link to comment https://forums.phpfreaks.com/topic/86431-emails-not-getting-to-members-when-using-mail/#findComment-441696 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.