How to resolve Drupal unable to send email - contact the site administrator?
In earlier versions of Drupal or for that matter even WordPress, the site could send email notifications easily using the PHP mail function. However, most hosts have disabled the default mail function due to security and vulnerability reasons. Therefore, emails will not go. This is not a Drupal issue as the same issue we see on WordPress as well. In this post, we shall discuss how to let Drupal site send out emails using a third party module.
If you try to try to do any operation on the Drupal site that requires email to be sent, such as "Forgot password", you may have seen the error displayed by Drupal is as shown below:
In order to let emails work, we need to install a third party module - SMTP Authentication Module. This module allows Drupal to bypass the PHP mail() function and send email directly to an SMTP server. This module solves the problem of Drupal not able to send out emails.
Before configuring the SMTP Authentication module, check your domain's email settings for the username, incoming mail server, outgoing mail server, port requirements, protocols, and whether authentication is required or not.
A) Where to get the SMTP configuration details for your domain email?
If you are not sure where to get the above SMTP details required, you can get the details from the email address setup on your domain Control Panel.
If you try to try to do any operation on the Drupal site that requires email to be sent, such as "Forgot password", you may have seen the error displayed by Drupal is as shown below:
"Unable to send email. Contact the site administrator if the problem persists..Initially, I thought this was a Drupal issue. Then I also encountered similar issue in WordPress CMS sites as well. Thankfully, there are modules and plugins available for both Drupal and WordPress CMS.
In order to let emails work, we need to install a third party module - SMTP Authentication Module. This module allows Drupal to bypass the PHP mail() function and send email directly to an SMTP server. This module solves the problem of Drupal not able to send out emails.
Before configuring the SMTP Authentication module, check your domain's email settings for the username, incoming mail server, outgoing mail server, port requirements, protocols, and whether authentication is required or not.
A) Where to get the SMTP configuration details for your domain email?
If you are not sure where to get the above SMTP details required, you can get the details from the email address setup on your domain Control Panel.
- For example on CPANEL: Login to CPanel > Email > Open Email Accounts
- Corresponding to the particular email address in use for the WordPress website, click on "Setup Email Client". A page is displayed showing the SMTP configuration details. Yes, this page is about configuring Email Clients such as Outlook, Thunderbird or Email on your phone, but don't be confused. The requirement is the same.
- Get those details and put it in the WordPress Mail SMTP plugin configuration page.
Note the details of your domain email and then proceed with the configuration of SMTP Authentication module on Drupal.
Configuration of Drupal SMTP Authentication Module
- Prerequisites: Download , install and enable the Drupal Module - SMTP Authentication Module
- Go to Configuration > SMTP Authentication Support
- Turn this module on or off: ON
- Turn on delivery of emails: ON
- Send mail by queue: check or uncheck
- Retry sending mail on error: check or uncheck
SMTP SERVER SETTINGS
For settings in this section, refer to your email settings as per your host as described in A) Where to get the SMTP configuration details for your domain email?" above.
- SMTP server: domainname.com
Enter the domain name as the SMTP server. If the domain name does not work, find out or check with your host for the server name or IP. In some cases, "localhost" will also works. If you are unsure what to enter here, kindly check with your host.
- SMTP backup server: NONE
- SMTP port: 465, since SSL is used.
The default SMTP port is 25, if that is being blocked try 80. Gmail uses 465.
- Use encrypted protocol: SSL
This allows connection to a SMTP server that requires SSL encryption such as Gmail. Depends on how your email is configured or to be used as per setting with your web host. If your host allows SSL/TLS, use 465.
If you have any doubts regarding the settings, kindly contact your host for information.
SMTP AUTHENTICATION
- Username: info@domain.com
- Password: the password for the email
- E-mail from address: info@domain.com
- E-mail from name: some name
- Allow to send e-mails formatted as HTML: Optional
- Hostname: none
- HELO: None
Enter the email where you want to send a test mail after saving the configuration.
- E-mail address to send a test e-mail to: enter some email address
- E-mail address to reroute all emails to: NONE
If you want errors to be logged, enable appropriate settings.
- Logging: None, Errors only or Log Everything are the options.
Recheck the details entered in the SMTP Authentication Module configuration page and if the settings are alright, click on "SAVE CONFIGURATION".
While the settings are saved, Drupal will send a test email provided. After saving the SMTP module configuration, a system message like this will be displayed:
SMTP.module is active.
The configuration options have been saved.
A test e-mail has been sent to testemail@domain.com. You may want to check the logs for any error messages.
SMTP.module is active.
If every thing goes well, there should be an email received at the email address provided in test email settings.
If there are errors in sending email, a red notification will also be displayed. You can also check the log.
Error log check:
If there has been an error in sending out emails, you may check the log from the link given in the notification right after saving the configuration. But there are very few details. For more details, you may login to your control panel and check server logs. There may be more details about the issue.
If there are errors in sending email, a red notification will also be displayed. You can also check the log.
Error log check:
If there has been an error in sending out emails, you may check the log from the link given in the notification right after saving the configuration. But there are very few details. For more details, you may login to your control panel and check server logs. There may be more details about the issue.
No comments