Page 1 of 1

Mail() Function no error but no email

Posted: Wed Mar 19, 2008 6:43 am
by nkosinathi
I am using the mail function to send an email autonatically after a user has subscirbed to my newsletter. The script makes no error but no email is sent. Thank you in advance for your help
Below is the code

*$to = $email;// Defines above

$subject = "SXX Newsletter";
$message = "Hello! Welcome to our newsletter.";
$from = "xxxxx@xxxxxxxx.com";
$headers = "From: $from";

$success = mail($to, $subject, $message, $headers);
if ($success)
echo "The email to $to from $from was successfully sent";
else
echo "An error occurred when sending the email to $to from $from";

// The email is always returns a success flag

Re: Mail() Function no error but no email

Posted: Wed Mar 19, 2008 6:52 am
by scriptah
There's no problem with this code, you should check your configurations as the mail got accepted for delivery, but for some reason it's not going out of the queue ...

Re: Mail() Function no error but no email

Posted: Wed Mar 19, 2008 8:12 am
by Zoxive
What is your error_reporting level? And is display_errors on?

Re: Mail() Function no error but no email

Posted: Wed Mar 19, 2008 8:32 am
by sri.sjc
What SMTP server do you use to send your mails? The same code works well for me with my free hosting site.