EH
By:
EH

Questions to sendmail with wordpress

January 26, 2016 1.7k views
Email WordPress Apache Ubuntu

Hello,
I have the 10$ Wordpress droplet. I had to reinstall sendmail and I cannot make it work again.

Problem: registration/pwd change/whatever that sends mail in WP hangs. Emails are delivered but the website hangs which makes users click the send button 10 million times.

Done so far:

  • followed the tutorial on DO to set up sendmail
  • got fully qualified domain name "droplet.example.com"
  • set up the FQDN in /etc/hosts and /etc/hostname and as droplet name
  • made A records for that FQDN
  • made lines for internal and external IPs in /etc/hosts
  • set up masquerading in sendmail.mc
  • removed all lines featuring 127.0.0.1 in sendmail.mc and making sure they are removed from sendmail.cf too

After each change I restarted the sendmail service of course.

No effects so far.

My questions:

  • how come emails sent through wordpress are not logged in /var/log/mail.log ? Where does WP keep mail logs?
  • how come emails sent through wordpress are not in $ mailq even though they obviously hang at least 5 minutes?
  • did I forget something with that sendmail configuration?
2 comments
  • @EH - Anything show up in /var/log/apache2/error.log? Sounds like 'php-mail' or some mailer add-on in your Wordpress could not handle your now tainted sendmail configuration. That apache error log may shed some light on where the PHP code may be failing.

  • @gndo seems nothing related to mail in tail -50. Just some notes probably related to service restart

    [Tue Jan 26 16:33:01.346077 2016] [core:notice] [pid 31838] AH00051: child pid 16313 exit signal Segmentation fault (11), possible coredump in /etc/apache2
    [Tue Jan 26 16:33:03.349467 2016] [core:warn] [pid 31838] AH00045: child process 17071 still did not exit, sending a SIGTERM
    [Tue Jan 26 16:33:05.352030 2016] [core:warn] [pid 31838] AH00045: child process 17071 still did not exit, sending a SIGTERM
    [Tue Jan 26 16:33:07.356450 2016] [core:warn] [pid 31838] AH00045: child process 17071 still did not exit, sending a SIGTERM
    [Tue Jan 26 16:33:09.361518 2016] [core:error] [pid 31838] AH00046: child process 17071 still did not exit, sending a SIGKILL
    [Tue Jan 26 16:33:10.362938 2016] [mpm_prefork:notice] [pid 31838] AH00169: caught SIGTERM, shutting down
    [Tue Jan 26 16:33:11.229833 2016] [mpm_prefork:notice] [pid 19222] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.14 configured -- resuming normal operations
    [Tue Jan 26 16:33:11.229973 2016] [core:notice] [pid 19222] AH00094: Command line: '/usr/sbin/apache2'
    
    
1 Answer

Utilizing sendmail can be quite tricky on a droplet. To troubleshoot this further, you would want to review the output from a command utilizing the PHP mail function, such as:

php -r 'mail("TO_ADDRESS", "Testing PHP script", "Testing sending email via PHP", "From: YOUR_EMAIL\r\nReply-To: YOUR_EMAIL\r\nX-Mailer: PHP".phpversion());' && tail /var/log/mail.log

You would want to make sure to replace the TOADDRESS and YOUREMAIL parts with legitimate emails.

The output from such a command would show any PHP issues, as well as the logs the droplet for the mail service (in this case sendmail). If it is working locally, you would then want to inspect your scripts settings. If trying to send email via a remote service, like gmail, you would need to try and see if the remote mail service can provide you some feedback on the reason the issues are occurring.

Hope it helps!

Jason C.
DigitalOcean Platform Support Lead

Have another answer? Share your knowledge.