I can receive and send test email from the smtp test form. Also I can receive system notice from mailed from my site when there are updates.
However, I find an error when I test sending email by contact form. It is firstly an error and following a success message. like this:

Unable to send e-mail. Contact the site administrator if the problem persists.
Your message has been sent.

the link: http://tdem.org/en/contact
Can anybody help me out.
Thanks first.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jozzhart’s picture

Assigned: sunhuaifeng » Unassigned
Category: support » bug

I have a custom module that calls drupal_mail. I also get this error message now that I'm using SMTP authentication to connect to Amazon SES, even though the emails are successfully being delivered.

kaizerking’s picture

While confguring,I have set the test mail to be sent I am getting this success message:
SMTP.module is active.
The configuration options have been saved.
SMTP.module is active.
"A test e-mail has been sent to xyz12345@gmail.com. You may want to check the logs for any error messages"
And this error message:

Unable to send e-mail. Contact the site administrator if the problem persists.
and no mail is received in my gmail

why_me’s picture

Version: 7.x-1.0-beta1 » 7.x-1.0-beta2

The problem seems to take place everytime the guests email address domain isn't the same as the site domain.
There are 4 log entries for each mail sent by the contact form:

  1. type: smtp
    sending email to myaddress@mysite.com
  2. type: smtp
    Error while sending email from sender@not-this-site.com to myaddress@mysite.com: The following From address failed: sender@not-this-site.com SMTP server error: You are not allowed to use the domain not-this-site.com as a sender domain.
  3. type: email
    Error while sending email (from sender@not-this-site.com to myaddress@mysite.com)
  4. type: email
    sender (sender@not-this-site.com) sent a message to Website feedback
pog21’s picture

I'm getting a similar error to #2 since upgrading to beta2. But changing to beta1 or dev does not solve the problem. I have the following in the log:

Referrer:	http://www.example.com/admin/config/system/smtp 
Message:	Error sending e-mail from sender@example.com to receiver@example.com : SMTP Error: Could not authenticate.

Every other setting for the "Site-wide default MailSystemInterface class" works except for smtpmailsystem (on page: admin/config/system/mailsystem).

The odd thing is, it started working again a few days ago for a while, without any apparent reason for it, then stopped again last night (coincidentally) immediately after updating ctools. All caches have been cleared/updates done.

wundo’s picture

Category: bug » support

Please check your SMTP credentials

HyperD’s picture

I got the same issue on 2 isntalaltions.

I checked the credentials and they are correct.
But It doesn't work at all.

i got the same issue of "kaizerking" in the post #2.

I'm really getting mad. I'm not able to make it work

rgon’s picture

I am getting the same error message as #2 but it works if I change the sitewide default email to the SMTP authenicated user account. It seems that the SMTP AUTHENTICATION Username and the E-mail from address are both overridden by the sitewide default email address in the Site information settings.

Atomox’s picture

Any update on this? We're using this module, passing from an SSL server to a relay to send our mail. We even send from an email address with the same domain, and we're still getting this error, despite successfully sending/receiving an email. Credentials are not an issue.

wundo’s picture

Status: Active » Fixed

Try enabling the debug mode and seeing what it says. This is usually due to credentials/connectivity erros.

Atomox’s picture

I enabled debug mode, which was displaying the error before I got the original SMTP module sending. However, once sent, (it sends successfully), it continued to display this error, but debug mode does not display any information, likely because, as far as SMTP is concerned, everything was fine. If it was a credentials error, this shouldn't send in the first place. Can I bypass drupal_mail, and use this module directly? I know this error is coming from drupal_mail since this error is traced back to that function only.

Atomox’s picture

Still having this issue. Just for fun, I disabled this module, and setup mailutils on our server, using the same smtp email relay we're using in the module, with the same credentials. It works without this error. We're using identical settings, and both send the email, but this module throws the error. I've confirmed this on two different environments now.

The error clearly is set in mail.inc:

// Optionally send e-mail.
  if ($send) {
    // The original caller requested sending. Sending was canceled by one or
    // more hook_mail_alter() implementations. We set 'result' to NULL, because
    // FALSE indicates an error in sending.
    if (empty($message['send'])) {
      $message['result'] = NULL;
    }
    // Sending was originally requested and was not canceled.
    else {
      $message['result'] = $system->mail($message);
      // Log errors.
      if (!$message['result']) {
        watchdog('mail', 'Error sending e-mail (from %from to %to).', array('%from' => $message['from'], '%to' => $message['to']), WATCHDOG_ERROR);
        drupal_set_message(t('Unable to send e-mail. Contact the site administrator if the problem persists.'), 'error');
      }
    }
  }

Any idea why this would be thrown when using the SMTP module, even when the mail is being sent successfully?

Atomox’s picture

For anyone else encountering this issue, we implemented drupal_mail_system to address drupal_mail's default text headers. When setting up the SMTP Module, the module would send the email, but set an error. When we changed over to drupal_mail, and added a hook_mail to catch, and modify our headers, this worked without errors.

Hope this helps someone else out.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

kaizerking’s picture

@Atomox,could you please post a patch pl?

brucet1952’s picture

I had the same problem. My fix was to make sure that the Contact Email was the same as the site email. I went to "modules, contact, configure" and entered the same email as "configuration, site information". Before, under the contact module setup, I had three addresses, but my hosting company wouldn't allow relaying. So with the same address in both places there is no relaying evidently.

That seems an easy fix.

sekhrik’s picture

Hello did you get the answer of your question if yes then please help me too as I am getting same problem as you got ? Please help.

sekhrik’s picture

•SMTP.module is active.
•The configuration options have been saved.
•SMTP.module is active.
•A test e-mail has been sent to kp@gmail.com. You may want to check the logs for any error messages.

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

Please help me on this issue.

rootical’s picture

Status: Closed (fixed) » Active

Issue is not fixed.

fabiorosabm’s picture

subscribe.

my e-mail test has been sent with no error,
but on webform at my website no works.. the email doesn't arrive

chilledweb’s picture

we had exactly the same problem while connecting an Amazon EC2 server to SES.
we resolved this by using Transport Layer Security (TLS)
good luck.
The ChilledWeb Team

Sinan Erdem’s picture

Issue summary: View changes

1. Use SMTP port 587 and TLS.
2. Visit www.gmail.com and go to "Account settings" -> "Security" -> "Access for less secure apps" Settings and enable it.
3. Visit http://www.google.com/accounts/DisplayUnlockCaptcha and sign in with your Gmail username and password.
4. Try sending mail again from Drupal.

Rick Hood’s picture

Just noting that the fix posted by Sinan Erdem (#21) worked for me. Thanks.

wundo’s picture

Status: Active » Fixed
ismailkanbur’s picture

I am having the problem of logging into drupal, which I installed in lochalhost, and I keep getting this error even though the username is correct

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

graysonecooper’s picture

For future reports, please note your server provider and plan. I am on GoDaddy Shared Hosting, and have been getting these messages because port 587 is blocked on shared hosting plans with GoDaddy. If you're consistently running into this problem, give your hosting provider a call.

Related: http://stackoverflow.com/questions/6209064/smtp-error-could-not-connect-...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

sumeshfdo’s picture

Sitewide email overrides the SMTP. therefore you have to apply the same email for the both places, (site email and the SMTP email)

paul8209’s picture

for those who haven't solved the problem with the smtp module check your host and set mx records to Remote email exchanger. It should be there somewhere just search for it.

kclarkson’s picture

Confirming that the directions from 21 worked. But I only had to do the following to get it working:

1. Visit www.gmail.com and go to "Account settings" -> "Security" -> "Access for less secure apps" Settings and enable it.

I used the 465 port and SSL like the settings tell me too.

umeshpatil’s picture

In my case matching "SMTP =" name to the host name in php.ini solved the issue.

Spoon Fed World’s picture

Testing the site wide contact form which sends email to the site admin address without a problem. Logged out as admin. Logged in as a test account. Test account can use the form, but email goes to spam every time. Logged out as test account. Logged back in as site admin and email goes to inbox like it should.

What am I missing? Newbie here :./

And thanks to everyone for their work on Drupal 8. I'm fairly new to Drupal. Set it aside to wait for Drupal 8. Receiving email from the site wide contact form when not logged in as admin is the only issue so far. You guys rock!

alkhalife’s picture

I was having the same issue. I contacted my sever:
There was an issue with the routing path setup, I have changed it to local. This seemed to fix the issue.

ldwyer’s picture

#30 also fixed the issue for me.

Anonymous’s picture

My Issue is that when i submit any mail in all around my site these four errors come any who ever deals with these kind or errors help me please
Warning: Illegal offset type in isset or empty in VariableRealmDefaultController->getStore() (line 267 of /var/www/adimsc/docroot/sites/all/modules/contrib/variable/variable_realm/variable_realm.class.inc).

Warning: Illegal offset type in VariableRealmDefaultController->setStore() (line 294 of /var/www/adimsc/docroot/sites/all/modules/contrib/variable/variable_realm/variable_realm.class.inc).

Warning: Illegal offset type in isset or empty in variable_store() (line 15 of /var/www/adimsc/docroot/sites/all/modules/contrib/variable/variable_store/variable_store.module).

Recoverable fatal error: Object of class stdClass could not be converted to string in _variable_store_load() (line 103 of /var/www/adimsc/docroot/sites/all/modules/contrib/variable/variable_store/variable_store.module).

raeasah’s picture

salam ...
see this link .. it works with me :)
https://www.drupal.org/forum/support/post-installation/2008-12-03/my-sol...
best regards

yzan’s picture

Hello
I suffered a lot to see him work.
In local development.
After activating the SMTP module I followed this tutorial
https://stevepolito.design/blog/drupal-configure-smtp-module-work-gmail-...
I then activated then, configured Mail System.
See screenshots ...
Hoping that will help ...

yzan’s picture

FileSize
29.83 KB
tepelena’s picture

If you are using Amson Simple Mail Service SES

use encrypted protocl: TLS
Enable TLS encruption automatically: off.

This worked for me. It will sends emails via encrupted protocol.