0

I've become aware of an intermittent issue with transactional emails - commonly receipts/invoices for memberships and/or event registrations - getting messed up when outbound mail is set to send via mail().

This has only become apparent on a couple of Civi installs that I look after, in recent months. I've commonly used mail() for outbound mail without any issues over many years.

What I'm seeing is that the issue does not manifest itself consistently. A site can send out perhaps twenty such transactional emails over the course of an hour, and some will be fine, others will be unreadable. Other than how the damaged emails look in my mail client, there seems to be no discernible pattern.

The damaged messages appear to take two forms:

In one the rendered email body includes a couple of lines of gobbledegook at the top, then show the plain text content, followed by the raw source of the HTML content and then a big block of characters which I think is the PDF data for an invoice, that should be an attachment to the email.

The second form manifests such that there is no body to the email, but there is an un-named attachment.

Both are largely unusable by recipients.

The workaround that seems to fix things is to switch to sending mail via SMTP. Even configuring Civi to send via SMTP using localhost port 25 gets a result, so the mail is going via the exact same server.

Bulk Mosaico mailings don't appear to be affected at all.

Nothing is getting logged that throws any light, and my sysadmin can't spot anything untoward. And as I say it was all working fine for many months/years.

What might be causing such an intermittent issue? How could I even begin to investigate it usefully? Any input most welcome.

1
  • 1
    In civicrm.settings.php there's a setting CIVICRM_MAIL_LOG and CIVICRM_MAIL_LOG_AND_SEND. Set both of those and then look at the output. It might give a clue since it shows the full structure of the raw email. (Note: On a high traffic site the file will get big quickly.) – Demerit Jan 29 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.