2

Our company has one web site with an online store based on osCommerce. The system sends emails for various reasons, such as password changes, order confirmations, etc., using PHP's mail() function.

We occasionally have customers report that the email they received is either blank (email is plain text format) or gibberish (email is in HTML format). In the latter case it's really just HTML that's being displayed as raw text but of course the customers can't read it. In this case the first opening tag's <, and sometimes a few more characters, has gone missing.

In an attempt to determine whether this was happening only for certain customers or email systems I configured the web site to send a CC of each message to a service account at my end. Those CC'd messages always arrive intact and display correctly in Outlook. For what it's worth, it seems to happen a little more frequently to Hotmail users but is certainly not limited to them.

As the web site is on a shared (Debian) host there's precious little I can do about debugging things from that end, although if I made the right request I feel the hosting company staff would help me, even though they have limited resources to spend on such matters.

Any suggestions on what else I might do to try and determine just why those emails are not being received correctly by some customers, yet a CC copy arrives just fine?

Update

As I no longer work at that company I'll have no opportunity to test any new ideas. If you have any ideas about this problem then by all means post them for the benefit of others who may experience a similar issue but I'll be unable to accept any answer on this question.

1
  • I encountered (and still encounter) the same problem - no matter if using mail() directly or PHPmailer. About 1 in 1000 mail adresses receives a seemingly empty email (but only one, not another...). Actually, the source code of the mail is still contained, but the MIME structure was changed, making the content invisible in mail clients. My best guess is that some process on the mail's way reads the structure wrong and creates a new structure. Although, there is no systematical correlation with the receiving mail server, mail client, the mail's content or such...
    – BurninLeo
    May 4, 2014 at 13:57

2 Answers 2

1

Outlook is very forgiving of formatting errors, and has been very good at introducing them. Try delivering them to a store where you can look at them in raw format. A local mailbox or Maildir store on the server would be ideal.

ContentHeaders may be checked by both desktop clients and webmail clients. Don't assume because it is webmail it supports HTML. Several webmail applications default to text mode due to security issues with HTML.

Ideally you should generate a multi-part MIME with both text and HTML format. This is the most flexible option. Properly done it should display well everywhere.

2
  • This problem isn't consistent. A customer who normally has no problems may suddenly get one of these screwed up ones, using the exact same client/method to read their email. As for the MIME encoding, that doesn't even factor into a plain text message. Feb 10, 2011 at 6:33
  • It the problem is always characters missing from the start of the message text, I would suspect a problem with overrunning a circular buffer. This would likely be an application issue. I would ask the client to forward the message as an attachment and examine the file in text format. p.s. Plain text is one format for a MIME part. I receive many emails consisting of only plain-text and HTML MIME parts. Attachments are not the only reason to use MIME.
    – BillThor
    Feb 11, 2011 at 1:32
1

It could be that their e-mail client doesn't automatically pick up that it is HTML. You could explicitly add the ContentHeaders HTML (I can't remember exact spelling) into the headers of the generated e-mail.

1
  • I had thought the same initially but this is affecting both desktop clients and webmail. Feb 10, 2011 at 3:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .