Article

  • 9 years

    9 years

    YetiShare / Core

    5910

Emails are not being sent when a user registers on the site or when the contact form is submitted

Problem

When a user registers on the site they see the confirmation screen however they never receive an email with their password in it.

Fix

This is due to a number of reasons, try each of the following in order:

1) Test a registration yourself and ensure the email isn't being sent to a spam folder. If it is being spammed or if AOL/Hotmail accounts are not receiving emails, ensure you have SPF records setup for your domain. Your host or system admin can enable this.

2) There are 2 methods the script uses to send email, PHP and SMTP. The default is PHP. Sometimes web hosts block PHP from sending to stop spam scripts from running so although PHP attempts to send the email, it doesn't actually go anywhere. If this is the case switch to SMTP sending via the admin area, site settings. (below)

smtp_screen.png

Set the options as shown above but replace with your own SMTP email settings. Your web host will be able to confirm these.

3) If the above doesn't work you can test SMTP sending for any errors. To test:

  • Via FTP edit /admin/_test_scripts/test_email.php and replace the email address ([email protected]) with your own.
  • Re-upload the file to your website.
  • Login to your /admin/ area.
  • Then in the browser load this url maually - http://yoursite.com/admin/_test_scripts/test_email...
  • An email will be attempted to the email address you entered. Any errors will be shown on screen. A common error is that the sending email address can not be used via that SMTP server so you may need to change the sending email address or ask your web host to allow it.

Note: Sometimes not all debug messages are captured and outputted in the test_email.php script above. You can increase the debug level by temporarily editing the code. In coreFunctions.class.php find $mail->SMTPDebug = 1; and replace with $mail->SMTPDebug = 2; Save, reupload and test again for more detailed information.


Other Options

  • If you have a brand new server you can install sendmail so the 'php' method above works, although some hosts may still treat it as spam. To install sendmail via yum:
yum install sendmail
  • Test email sending is working by doing this via SSH:
echo "Subject: test" | sendmail -v [email protected]

Office 365

Sending via Office 365 requires TLS to be enabled.

In \core\includes\email_class\class.phpmailer.php, find:

public $SMTPSecure    = '';

Replace with:

public $SMTPSecure    = 'tls';

Save and upload to your install.