E-Mails - Why are members not getting emails sent from the forum

From Online Manual

Jump to: navigation, search

First check your error logs for any indication of what the problem may be. Before you begin to troubleshoot the reasons for your forum not sending out emails, contact your hosting provider to see if they can help or confirm the information you are entering is correct. In many cases contacting your hosting provider will speed up the process of solving your issues.

Check for errors within your forum error log

Common errors you will see within your error log are:

  • Could not connect to SMTP host
  • 2: fsockopen() has been disabled for security reasons

This error is pretty self explanatory in that your error log is telling you that the SMTP information you have provided is not correct, i.e. cannot connect to send your mail. Check the information again and contact your host to make sure the information you are entering is correct.

The second error message listed above indicates your webhost has disabled the PHP default setting for sending mail from your SMF installation. You will need to contact your host and ask them to enable this for you.

Is my server blacklisted?

Because of the growth of spam these days it is quite possible that your emails are being detected as spam.

The following link will help you find information regarding any potential blacklist your server may be listed on:

Using GMAIL SMTP?

If you use Gmail for SMF's SMTP - meaning to send emails from SMF, Gmail will not work in most cases. Gmail will only accept SSL encrypted emails, which most servers do not support.

Server configured correctly for sending mail?

To check if your server is configured correctly for sending mail use the test script below. In the script below be sure to change the $from_email and $to to be valid email addresses to correctly test the sendmail function of your server. If it fails, try using SMTP. IMPORTANT: Remember to remove this test script immediately.

Save as testmail.php and upload it to the root folder of your SMF install where Settings.php and SSI.php can be found, then call it in your browser i.e. yoururl/testmail.php.

If you do not receive an email from your server then contact your host and explain you currently cannot send mail from your forum. During this time you will have to use the SMTP settings for sending mail rather than the (php) default value.

<?php
// Add your name between quotes
$from_name = "YourName";
// Add the origin email address between quotes (the same email you set in SMF's Webmaster email address)
$from_email = "from_email@domain.com";
$headers = "From: $from_name <$from_email>";
// You are free to change the body and subject of the test email in the next lines, but the default should work fine
$body = "Hi, \nThis is a test mail from $from_name <$from_email>.";
$subject = "Test mail from localhost";
// Add the destination email address between quotes (the recipient of the test email)
$to = "to_email@domain2.com";
// When running the script, you will see in your browser "Success!" or "Fail...", depending on whether the test was successful or not. DON'T CHANGE THIS
if (mail($to, $subject, $body, $headers)) {
   echo "Success!";
} else {
   echo "Fail…";
}
?>

Again, be sure to delete the test script when finished, or the script could be used to spam the email address used in the script.