Jump to content

Recommended Posts

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);

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.

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.