Difference between revisions of "E-Mails - Why are members not getting emails sent from the forum"

From Online Manual

Jump to: navigation, search
m (Bot: Automated text replacement (-> +>))
Line 7: Line 7:
 
*2: fsockopen() has been disabled for security reasons
 
*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.
+
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.
 
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.
Line 13: Line 13:
 
'''Is my server blacklisted?'''
 
'''Is my server blacklisted?'''
  
Because of the growth of spam these days it is quite possible that your emails are being detected as spam!
+
Because of the growth of spam these days it is quite possible that your emails are being detected as spam.
  
The following links will help you find information regarding any potential blacklist your server may be listed on.
+
The following link will help you find information regarding any potential blacklist your server may be listed on:
 
*[http://www.us.sorbs.net/ http://www.us.sorbs.net/]
 
*[http://www.us.sorbs.net/ http://www.us.sorbs.net/]
*[http://openrbl.org/ http://openrbl.org/]
 
  
 
'''Using GMAIL SMTP?'''
 
'''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.
+
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?'''
 
'''Server configured correctly for sending mail?'''
  
To check if your server is configured correctly for sending mail then use this test script below. Just replace the YOUR-EMAIL-HERE with your own email address
+
To check if your server is configured correctly for sending mail use the test script below. If it fails, try using SMTP. ''IMPORTANT:'' Remember to remove this test script immediately.
to check if the mail function works, if it fails, try using SMTP. ''IMPORTANT:'' Remember to remove this test script immediately.
 
  
 
Save as ''testmail.php'' and upload to your server.
 
Save as ''testmail.php'' and upload to your server.
Line 32: Line 30:
 
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.
 
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.
 
{{code|1=<?php
 
{{code|1=<?php
 
+
'''<font color=orange>// Add your name between quotes</font>'''
$mail = mail("YOUR-EMAIL-HERE", "wahahahahahaahahahahaa","I like spamming your inbox!!!", "From: Myself<your_email@here.com");
+
$from_name = "YourName";
 
+
'''<font color=orange>// Add the origin email address between quotes (the same email you set in SMF's Webmaster email address)</font>'''
if(!$mail){
+
$from_email = "from_email@domain.com";
echo '<font color="red">mail is not sent!</font>';
+
$headers = "From: $from_name <$from_email>";
 +
'''<font color=orange>// You are free to change the body and subject of the test email in the next lines, but the default should work fine</font>'''
 +
$body = "Hi, \nThis is a test mail from $from_name <$from_email>.";
 +
$subject = "Test mail from localhost";
 +
'''<font color=orange>// Add the destination email address between quotes (the recipient of the test email)</font>'''
 +
$to = "to_email@domain2.com";
 +
'''<font color=orange>// When running the script, you will see in your browser "Success!" or "Fail...", depending if the test was successful or not. DON'T CHANGE THIS</font>'''
 +
if (mail($to, $subject, $body, $headers)) {
 +
  echo "<font color=green>Success!</font>";
 
} else {
 
} else {
echo '<font color="#00FF00">mail is sent :-)</font>';
+
  echo "<font color=red>Fail…</font>";
 
}
 
}
 
 
?>
 
?>
 
}}
 
}}

Revision as of 17:27, 4 July 2015

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. If it fails, try using SMTP. IMPORTANT: Remember to remove this test script immediately.

Save as testmail.php and upload to your server.

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 if 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 spam email can be sent to the email address used in the script.