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
Mail() Function no error but no email
Moderator: General Moderators
-
nkosinathi
- Forum Newbie
- Posts: 1
- Joined: Wed Mar 19, 2008 6:34 am
Re: Mail() Function no error but no email
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
What is your error_reporting level? And is display_errors on?
Re: Mail() Function no error but no email
What SMTP server do you use to send your mails? The same code works well for me with my free hosting site.