简体   繁体   English

Mailjet/Sendgrid:发送带有冒号的 email 显示“无内容”

[英]Mailjet/Sendgrid: Sending an email with a colon in the body shows "No content'

For the past couple days, I've been trying to send a fairly simple plain text e-mail using both Mailjet and Sendgrid.在过去的几天里,我一直在尝试使用 Mailjet 和 Sendgrid 发送一封相当简单的纯文本电子邮件。 There's no error when I send it, but the recipient can't open the message, which shows a "No content" error on most mail clients.我发送时没有错误,但收件人无法打开邮件,这在大多数邮件客户端上显示“无内容”错误。

Here's the body of the email:这是 email 的主体:

Date: 2021-02-05日期:2021-02-05
From: +1-202-555-0137来自:+1-202-555-0137
Content: Lorem ipsum dolor sit amet, consectetur adipiscing elit.内容:Lorem ipsum dolor sit amet,consectetur adipiscing elit。

I've come to the conclusion that the problem is the colons present in the mail.我得出的结论是,问题在于邮件中的冒号。 When removed, the recipient can open the message with the full content.删除后,收件人可以打开包含完整内容的邮件。 From my understanding, this is because colons are used to separate between header key and values.据我了解,这是因为冒号用于分隔 header 键和值。

To fix the problem, just insert a blank line ( \n ) at the beginning of the body, such that the headers and body will be properly separated.要解决此问题,只需在正文的开头插入一个空行( \n ),这样标题和正文就会正确分开。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM