8

When my web form is filled and submitted, I get redirected to a page that says:

Thank you for submitting.

but theres a red warning box there that says:

Unable to send e-mail. Contact the site administrator if the problem persists.

I think its the SMTP server, but I don't know how to fix that.

12

Try using:

SMTP Authentication Support

with PHPMailer

If You use Gmail to set up STMP follow this steps:

  1. SMTP server: smtp.gmail.com
  2. SMTP port: 465
  3. Use encrypted protocol:Use SSL
  4. SMTP Authentication -- Your User Name and password
  5. Leave the other options by Default
2

The error:

Unable to send e-mail.

is coming from drupal_mail() and it's considered to be very general and it may relate to many different things such as misconfiguration of your Drupal site, PHP configuration or SMTP service of your operating system.

The first thing to do, is to check mail system or Apache logs (e.g. /var/log/apache2/error.log) for more details about the error, as you could simply be missing sendmail it-self (unless you'd like to use any external SMTP service).

If your Drupal is hosted on your dedicated server and it's a brand new configuration, most likely you're missing SMTP server (since it's pointing to localhost by default), unless you're planning to use the external one.

If it's your local development machine, either ignore the error (since it should work fine on the dedicated server), try installing MailCatcher, or you'll have to install SMTP server as stated above.

Here are few other suggestions:

  • if using SMTP module, check if you've configured (see README file) it correctly, including the right server settings,
  • check value of mail_system variable, if it's overridden - reset it into default value (drush vdel mail_system),
  • check your PHP mail configuration (php -i | grep -ie mail -e smtp) and confirm that sendmail_path, SMTP host and smtp_port are correct,
  • check connectivity to your SMTP server by using telnet, e.g.

    telnet $(php -r 'echo ini_get("SMTP") . " " . ini_get("smtp_port");')
    

    to double check whether host is not down, resolved by the DNS, or not blocked by the firewall,

  • if using postfix, check if httpd_can_sendmail is set to 1 (setsebool httpd_can_sendmail 1).

Finally test your e-mail by the following PHP command:

php -r 'mail("drupal@mailinator.com", "Mail test", "It works!");'

and check this page if the e-mail has been received.

1

Check your Drupal watchdog and PHP error logs. They could be logging errors that will help you figure out what is the problem. Also, check with your system administrator to see if the SMTP server credentials that you are using are valid (i.e., address, port, encryption, password, etc.).

1

If just seeing what would be sent is enough, the maillog module is very handy.

1

I was caught in this problem due to Amazon SES sandbox issue. Amazon SES does not allow you to send email to non verified domains in sandbox mode. You would have to request for production access and the problem will be solved.

0

Following settings worked for me on windows.

If You use Gmail to set up STMP follow this steps:

SMTP server: smtp.gmail.com

SMTP port: 465

Use encrypted protocol:Use SSL

SMTP Authentication -- Your gmail User Name and password

Leave the other options by Default

0

The accepted answer has solved this problem, but note that at the time of this post, Gmail blocks all Less secure application because your drupal site is not running with HTTPS.

  1. Then you must Allow less secure applications in your Gmail's My Account by

    • My account > Connection and Security > Allow less secure applications
    • Or follow the link in the warning email received from Gmail at the moment you tried to connect with the smtp module
  2. Or get a SSL certificate for your drupal site.

0

On same shared hostings You can't send e-mail without creating email for webmaster. For ex. if you have domain test.com, You have to create email webmaster@test.com or admin@test.com in your Cpanel and set this email as primary email of website. This e-mail will be in "From" field in your mail. Or create own mail for domain and set this mail as primary for site. It depends for security settings on shared hosting.

0

Step 1: you can settings SMTP Step 2: comand line open port 465 "-A INPUT -p tcp --dport 465 -j ACCEPT"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.