Hi,

I have a problem with Contact module. A form created with this module is not working. When a user fills the form and tries to send it, there are two notifications:

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

When I'm checking Recent log messages, this is what I get:

  1. Error sending e-mail (from user1@mail.com to user2@mail.com). [Priority: error]
  2. user1_name (user1@mail.com) sent an e-mail regarding category. [Priority: notice]

Contact module is not working on a few sites - I have many sites using one Drupal core. I've checked two sites:

  1. Database schema is not updated. E-mail set in Contact form is different that the main e-mail on site.
  2. Database schema is up to date. Contact form has two e-mails set and one is identical to the e-mail that is main on site.

Only Contact module is enabled when it comes to E-mail modules - there is no SMTP module, etc. I've also tested mail functionality on my server and it is working (PHP version is 5.3.27).

Does anyone has an idea what should I do with this? Do I need to install some SMTP module? Contact forms used to work properly on my sites, and this problem has been discovered a while ago, so does anyone has an idea what is the reason?

Comments

mitchj’s picture

I'm having this same issue. Were you able to resolve yours?

tomrog’s picture

Oh, yeah. The issue wasn't with Drupal. This all was caused by my hosting service which changed the rules of sending e-mails and I just didn't know about this.
If you've checked everything on your site, maybe you should check if your hosting service doesn't require you to send e-mails over SMTP or something like that ;)

SiliconMind’s picture

Actually I see that this is getting more common these days. The problem is that contact module sets From header to the e-mail address provided by the user. Such e-mail message is rejected by the server due to anti spam policy. The solution would be to set From header to the site's main e-mail address and set ReplyTo header to the e-mail provided by the user.

I could create a patch but knowing how reluctant to changes is the core team, is anyone willing to push it to the core?

Dave Sandilands’s picture

This issue has become quite a problem for me, leading to some unfortunate friction with a customer that depends quite heavily on receiving messages via the core Contact Form. It's taken me most of today to come to the decision there actually was something wrong and now finding the likely reason right here.

I would be very happy if SiliconMind's suggestion in #3 were implemented by the core team but , failing that, is there a good alternative module?

Dave Sandilands’s picture

Looks like the patch to fix this is available here

David_Rothstein’s picture

Version: 7.27 » 7.x-dev

Yup, #3 looks the same as #111702: Set fixed "from:" and add "Reply-to:" to comply with DMARC.

Original issue definitely sounds like a bug though:

...there are two notifications:

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

That should never happen, even if the mail fails to send.

Anyone know if it affects Drupal 8 too?

pgrandeg’s picture

I had the same problem, two alerts were displayed at the same time using smtp module and I solved updating it to the latest version using: 'drush up smtp'
I hope it helps

randell’s picture

Yes, this affects D8. Encountered the same issue today. Googling sent me to this page.

drootsad’s picture

I've noticed this issue too with my D8 site, smtp module and core at latest releases of 8.x-1.0-beta4 and 8.6.4 respectively.

I looked into my recent logged messages and it looks like 'failed to connect' and I'm not sure why. I'm using GSUITE and have the smtp relay setup properly and can confirm it's working. Also can telnet from the host itself to gmail's relay servers and send an email successfully with the same credentials and setup.