email authentication - Gmail smtp configuration for Drupal 7




error (5)

I hope SMTP Authentication Support module will help you.

I want to send email in Drupal 7. So, does anyone know how to configure Gmail SMTP on Drupal 7?


Step 1: Download SMTP module and enable it.

Step 2: Go to Admin > Configuration > System > SMTP authentication support and set the following values:

  • Turn this module on or off: On.
  • SMTP server settings:
    • smtp server: smtp.gmail.com
    • smtp backup server: leave blank.
    • smtp port: 465
    • use encrypted protocol: select "use SSL"
  • SMTP authentication:
    • Enter a valid Gmail email address and password.
  • Email options:
    • Set the same email address that you used at SMTP Authentication.
  • Send test email: set an email to receive a sample email and to test whether the module is working.
  • Enable debugging: yes.

Step 2a(Optional): Allow Less Secure Apps Access which is here: http://www.google.com/settings/security/lesssecureapps

Step 3: Click on Save and go to your inbox to check. If there is an testing email then it is fine.

Note: Your email address provided in your smpt setting MUST be the same like in your site information.


For me, just following the steps in Juampy's answer didn't work. The error "Unable to send mail. Contact site administrator." continued to display. Do the following first and then configure SMTP module as per his answer.

Before installing SMTP module, download PHPMailer and extract it. Rename the folder as 'phpmailer' and copy the folder into module folder of SMTP module. Then, install the SMTP module.

An alternative configuration is as follows:

  • smtp port: 587

  • use encrypted protocol: select "use TLS"


  1. Download SMTP module and enable it.
  2. Go to Admin > Configuration > SMTP authentication support and set the following values:

    • Turn on the module at the Install options fieldset at the top.
    • SMTP server settings:
    • smtp server: smtp.gmail.com
    • smtp backup server: leave blank.
    • smtp port: 465
    • use encrypted protocol: select "use SSL"
    • SMTP authentication:
    • Enter a valid Gmail email address and password.
    • Email options:
    • Set the same email address that you used at SMTP Authentication. Using a different account is called Phishing
    • Send test email: set an email to receive a sample email.
    • Enable debugging: yes.


3. Click on submit and verify that the email was submitted and that you received it. If not, read carefully the debug information at the top of the screen. Once satisfied, remember to deactivate the debug checkbox.


Even though this question is closed, I'd like to post a counter solution, but now using Simple Java Mail (Open Source JavaMail smtp wrapper):

final Email email = new Email();

String host = "smtp.gmail.com";
Integer port = 587;
String from = "username";
String pass = "password";
String[] to = {"[email protected]"};

email.setFromAddress("", from);
email.setSubject("sending in a group");
for( int i=0; i < to.length; i++ ) {
    email.addRecipient("", to[i], RecipientType.TO);
}
email.setText("Welcome to JavaMail");

new Mailer(host, port, from, pass).sendMail(email);
// you could also still use your mail session instead
new Mailer(session).sendMail(email);






email smtp gmail drupal-7