Search code examples
ruby-on-railsemailherokuicloudspam

Why is iCloud blocking some of my applications emails?


For many months, iCloud email addresses (@icloud, @mac, @me) are not receiving some of our html emails sent through SendGrid from a rails application running on Heroku. They are not going through at all (not even to spam), and look like they are delivered on our end.

These email updates are really important notifications for our users. We've talked with SendGrid support and Apple support, and we've also tried switching temporarily to Mandril. Nothing has worked so far!


Solution

  • It turns out that iCloud silently blocks emails containing mailto tags that are hex encoded like the following

    mail_to "[email protected]", "contact us", :encode=>:hex
    

    This article led me to believe it had to do with the email content. I narrowed down the blocked emails to a specific template. Then I changed all the headers to see if the headers were causing iCloud to block. The emails were still blocked with changed headers, so I started cutting out parts of the body in a binary search narrowing down the problem to the mail_to call. Removing the hex encoding allowed the emails through.

    This was driving us crazy because there is no documentation anywhere on this, and not even support at Apple could help. I hope this saves someone a bit of trouble.