RFC 2822 格式 - 是否包含附件

RFC 2822 format - does it include attachments

一些背景知识 - 我正在尝试使用 Gmail rest API 发送带有 curl/libcurl 的电子邮件。我可以发送普通的纯文本电子邮件,但我很难理解有关附件的 API 文档。

API 要求电子邮件以 RFC 2822 格式传递。我对这种格式几乎一无所知,但我正在努力学习。我突然意识到 Gmail API 没有明确处理附件的原因可能是因为 RFC 2822 处理附件。

我的问题是 - RFC 2822 是否将附件格式包含在电子邮件中?如果是这样,那么我很乐意看到带有几个 header 字段的示例消息,一个简单的 body 和一个简单的文本文件作为附件。谁能为初学者指出这样的例子。

此 RFC 2822 仅包含电子邮件的文本部分。没有附件或其他 MIME 类型。

直接引用 RFC 2822:

Scope

This standard specifies a syntax for text messages that are sent
between computer users, within the framework of "electronic mail"
messages. This standard supersedes the one specified in Request For
Comments (RFC) 822, "Standard for the Format of ARPA Internet Text
Messages" [RFC822], updating it to reflect current practice and
incorporating incremental changes that were specified in other RFCs
[STD3].

This standard specifies a syntax only for text messages. In
particular, it makes no provision for the transmission of images,
audio, or other sorts of structured data in electronic mail messages. There are several extensions published, such as the MIME document
series [RFC2045, RFC2046, RFC2049], which describe mechanisms for the transmission of such data through electronic mail, either by
extending the syntax provided here or by structuring such messages to conform to this syntax. Those mechanisms are outside of the scope of this standard.

In the context of electronic mail, messages are viewed as having an envelope and contents. The envelope contains whatever information is needed to accomplish transmission and delivery. (See [RFC2821] for a discussion of the envelope.) The contents comprise the object to be
delivered to the recipient. This standard applies only to the format and some of the semantics of message contents. It contains no
specification of the information in the envelope.