问题描述
我们使用 Spring org.springframework.mail.javamail.JavaMailSenderImpl 类将普通电子邮件消息从 Java Web 应用程序发送到 smtp.sendgrid.net 上的 sendgrid SMTP 服务器。我们不会向这些电子邮件添加任何 sendgrid 标头。
Committee
虽然我们没有添加 sendgrid 标头,但如果我查看退回邮件的内容,我会看到这些标头:
c = Committee.objects.prefetch_related('article_set')
幸运的是,JavaMailSenderImpl 类有一个调试属性,您可以将其设置为
Subject: Invalid SMTPAPI Header
SendGrid Support <support@sendgrid.com>
Fri 11/6/2020 11:27 AM
A message was received from this address by our systems that had errors in the SMTPAPI header,and cannot be processed due to the following:
- error parsing xsmtpapi header
If you require assistance in working with the SendGrid API,please contact us at support@sendgrid.com
如果我启用它,我可以看到我的应用程序与 SendGrid SMTP 服务器的通信的转储,并且我可以看到我没有添加任何 X-SMTPAPI 标头。日志如下所示:
X-SMTPAPI-V3: {"from":{"name":"Error Messages MailBox","email":"developmentteam@example.com"},"display_to":"Exception MailBox \u003cexceptionmailBox@example.com\u003e","display_from":"Error Messages MailBox \u003cdevelopmentteam@example.com\u003e","subject":"[Staging:public] Expression has thrown an unchecked exception; see the cause exception.","personalizations":[{"to":[{"email":"exceptionmailBox@example.com"}]}],"reply_to":{"name":"Error Messages MailBox","email":"developmentteam@example.com"}}
X-SMTPAPI-V3-CONVERSION: 1
由于我们没有添加这些标头,我假设它们是由 smtp.sendgrid.net 添加的,然后它会根据这些相同的标头来退回邮件(?)
我在 2 个月前向 sendgrid 提交了一张支持票,但遇到了一堆未答复的问题。 (此外,如果您在这里遇到同样的问题,请不要理会 support@sendgrid.com 电子邮件;它回复了一封电子邮件,大喊要在他们的支持网站上寻求帮助。我也在 2 个月前提请了他们的注意.)
有没有人知道我们原始邮件中的哪些内容可能触发了错误的 SMTPAPI 标头的生成,以及哪些内容无效?文档不是很好,特别是对于我们不直接使用 SMTPAPI 的人。这些 API 调用是否有任何验证工具?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)