Cloudflare email workers reply fails due to " Unknown error: permanent error (554): 5.7.1 [HM07] Message rejected due to local policy."

I’m using Cloudflare’s new reply feature for email workers, but some of the emails fail to send due to

Unknown error: permanent error (554): 5.7.1 [HM07] Message rejected due to local policy.

This is happening when the sender has an Apple iCloud email address. It’s strange because I would assume that if the sender is initiating the message, then a reply shouldn’t trigger any spam detection issues.

Any suggestions?

Actually, and technically, they are not failing to send, but to receive.

This error, or, to be a bit more specific:

554 5.7.1 [HM07] Message rejected due to local policy.

554 5.7.1 is the error code that your messages (at the final destination) were being rejected with. 554 the classic SMTP error code, and 5.7.1 the extended error code, however, none of them are very specific to the issue in this case, and as such, you need to lean on to the error message for further advice.

[HM07] Message rejected due to local policy. is the error message / description, regarding the error…

The local policy would here be the policy at the recipient’s side, which could be either the specific user that has one or more restrictions set up, if their provider allows it, or it could be their provider, that is quite restrictive for any reasons they feel fit.

Re. above, the issue here is to be found with Apple, and not with Cloudflare.

Cloudflare tries to send the message, but the Apple mail server(s) reject it with 554 5.7.1 [HM07] Message rejected due to local policy..

I don’t believe you’re alone on that assumption, however, it isn’t an assumption that is actually matching reality.

Contact Apple’s Postmaster, and ask them why they are rejecting your messages, as they are the only ones who would be able to assist there.

Thank you for your reply @DarkDeviL . It’s certainly disappointing that there are problems replying to iCloud email accounts via cloudflare.

Re. above, the issue here is to be found with Apple, and not with Cloudflare.

I am certain that there is something wrong, however I now have reasons to question this assumption. Recently, I was able to implement the send emails with workers functionality into my project, and using that I am able to email iCloud accounts.

It would seem that I can send emails to iCloud users just fine, just not through the reply API. This leads to two possible explanations (let me know if you can think of another):

  1. Apple only rejects replies but accepts sends
  2. There’s something happening on the cloudflare side of things
  3. The issue is intermittent and sometimes emails to iCloud get in and sometimes they don’t

Personally, I think that #2 or #3 are more likely, especially because the error happens almost instantly, as if the email actually never left the data center. One possible explanation for why send works but reply fails is that for send you’re required to register the email through Cloudflare’s UI. Still, Cloudflare’s docs also say that reply’s are fine, if certain conditions are met.

It’s a curious situation indeed, and I’d love to get to the bottom of it.

Haha and now both reply and send are working.

For anyone who may encounter this issue. The problem appears to be intermittent. You can’t really guarantee delivery, but you can take steps to improve the chances. The advice in the message is helpful

I can’t say what helped for certain. But I don’t recommend using an iCloud email address if you absolutely must receive an email, e.g. some kind of admin notification. For replying to other’s, it’s hard to say what works, although I recommend refraining from having emoji in the name portion of the from header.

Other than that, good luck.