Salesforce: 发送email出现DMARC issue
近期发现,在sandbox中通过Apex code发送某些邮件,会在console中未产生任何报错的情况下,无法接收到该邮件。
经客户反映,如果该邮件是通过他的邮箱地址发出,则他会收到一封报错邮件:
Subject: Undeliverable: Sandbox: The invoices have been created.
This message was created automatically by the mail system.
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:
>>> test@company.com (Undelivered): 550-5.7.26 Unauthenticated email from customer.com is not accepted due to domain's
550-5.7.26 DMARC policy. Please contact the administrator of customer.com domain
550-5.7.26 if this was a legitimate mail. Please visit
550-5.7.26 https://support.google.com/mail/answer/2451690 to learn about the
550 5.7.26 DMARC initiative. m1si539702qke.193 - gsmtp
经检查发现,出现这个问题总共有两个情形:
1. 客户登录自己的org账号,触发发送邮件的代码机制,邮件从客户的企业邮箱地址发送到我的企业邮箱地址。
2. 在代码中设置了setOrgWideEmailAddressId(), 使邮件从客户的企业邮箱地址发送到我的企业邮箱地址。
所以它们的共同点都是邮件是从客户的企业邮箱地址发出,最终发送到我的企业邮箱地址。
解决方案:
在org中将客户的企业邮箱地址后缀添加到DKIM Keys中,即可解决这一问题。