Mail() Function no error but no email

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nkosinathi
Forum Newbie
Posts: 1
Joined: Wed Mar 19, 2008 6:34 am

Mail() Function no error but no email

Post 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
scriptah
Forum Commoner
Posts: 27
Joined: Sat Mar 15, 2008 8:58 pm
Location: Long Island, NY

Re: Mail() Function no error but no email

Post 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 ...
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: Mail() Function no error but no email

Post by Zoxive »

What is your error_reporting level? And is display_errors on?
sri.sjc
Forum Newbie
Posts: 5
Joined: Wed Jan 30, 2008 7:34 am

Re: Mail() Function no error but no email

Post 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.
Post Reply