Score:1

Why is Drupal not sending mail?

cn flag

When submitting a contact form there is no mail sent, eventhough there is a confirmation message. Or when trying to send a password reset link, everything goes well, Drupal says "If [email protected] is a valid account, an email will be sent with instructions to reset your password." but no mail is sent.

  • Sendmail is installed, tested with PHP mail() and working fine.

  • Tested Sendmail through the command line and working fine: echo "Subject: sendmail test" | sendmail -v [email protected]

  • Testing via drush also works fine with: drush php-eval "print mail('[email protected]','Test subject from drush','Test message','From: drush@MYSERVER');"

  • Installed helper module that outputs in watchdog 'sent' message, but no mail is sent

  • When submitting forms in Drupal there are no entries in mail.log or syslog

Edit 1: this is a live server. There is no Mail Safety module installed. I would like to use the existing Sendmail as it is used succesfully on my other servers with Drupal sites.

Edit 2: Some other Drupal sites on the same server are succesfully sending mail, no idea why and why this one is not...

Edit 3: The Drupal sites that are not sending mail are test sites TEST.DOMAIN.XX The sites that DO send mail are the normal ones, WWW.DOMAIN.XX

Why is Drupal not sending mail and how could I debug this problem further? Thanks

leymannx avatar
ne flag
Live server? Or locally? Maybe Mailhog? Maybe Mail Safety module installed? Swiftmailer? SMTP?
C.A. Vuyk avatar
cn flag
thanks for the quick response, I made an edit in the question. A last resort would be using an external SMTP but seems unreasonable because there's a working one on the server
leymannx avatar
ne flag
Sounds like someone clever prevents mails from test site being sent, maybe on server-level?!
C.A. Vuyk avatar
cn flag
That would be a possible scenario yes. However I'm the one to maintain the server and didn't do such a thing...
4uk4 avatar
cn flag
We don't know if you have other mail plugins installed, by default it's only core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php. There you'll find the PHP mail() command. You might want to start debugging here. First remove the @ from @mail() to see error messages.
Kevin avatar
in flag
This is going to be impossible to debug on our end. Start with the above. Are appropriate MX/TXT/SPF records in place, etc
C.A. Vuyk avatar
cn flag
I've got no mail modules installed and tried with the @ removed, there are no error messages. All appropriate records are in place and other mail from php is coming through. I understand this is hard to debug and letting this rest now, the problem persists only on the test site so that's nice.
C.A. Vuyk avatar
cn flag
Thanks leymannx and Kevin, if and when a solution arrives, I will update.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.