ICloud – Emails to iCloud from the server show ‘This message has no content’

emailicloudmail.app

Our donation website sends emails when a user signs up, donates etc. I've gotten many complaints that donors are getting blank emails. Upon further investigation it turns out that all these donors have apple emails i.e. @mac.com, @me.com @icloud.com etc…

So I got a hold of a Mac, created an email with the mail app for an iCloud account. Made a test donation, and received an email. When viewing on the mail app, I see on the left side as a preview of the text

Thanks for donating to … [the subject]
This message has no content. [the body preview]

The right pane, showed the subject as well, but completely blank for the body.

Also worth noting, the same issue is on iOS (I borrowed my friend's iPhone 6 plus). However, on my android I used the outlook app and logged in to my icloud, and there the body text was indeed there!

I'm guessing it's possible the html of the email isn't parsed correctly by some Apple software…

All searches for the issue yielded solutions to a specific user experiencing this issue, but my issue is about the email message itself on an Apple email client.

Can someone point me in the right direction? Is there a specific html standard for apple emails?

Best Answer

It turns out the issue has to do with the content headers and how the email clients are interpreting them.

Originally, the HEADER was set to Content-Type: multipart/related; and the body was structured as

multipart/alternative
    text/plain
    text/html

It seems the iOS and apple clients weren't able to parse multipart/related correctly.

I solved it by changing the header to Content-Type: multipart/alternative; and then structured the body as

    text/plain
    text/html

Here is the mail library I was using https://github.com/opencart/opencart/blob/1.5.5.1/upload/system/library/mail.php

Similar discussion here https://stackoverflow.com/questions/19497672/multipart-messages-including-multiple-attachments-attachment-and-inline-wi

And here https://stackoverflow.com/questions/7766943/mime-multipart-related-structure-and-apple-mail-is-it-a-bug