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

  • Live server? Or locally? Maybe Mailhog? Maybe Mail Safety module installed? Swiftmailer? SMTP?
    – leymannx
    Commented Sep 7, 2021 at 9:38
  • 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
    – C.A. Vuyk
    Commented Sep 7, 2021 at 9:53
  • 1
    That would be a possible scenario yes. However I'm the one to maintain the server and didn't do such a thing...
    – C.A. Vuyk
    Commented Sep 7, 2021 at 12:18
  • 1
    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.
    – 4uk4
    Commented Sep 7, 2021 at 13:45
  • 1
    This is going to be impossible to debug on our end. Start with the above. Are appropriate MX/TXT/SPF records in place, etc
    – Kevin
    Commented Sep 7, 2021 at 16:19


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.