- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
根据“https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SES.html#sendTemplatedEmail-property”中的给定文档。它使用“ sendTemplatedEmail ” API,我们可以使用模板发送电子邮件。它成功了。但是我不知道如何向它添加附件。
在“ sendTemplatedEmail ” API 文档的第 4 点中,它说“邮件的总大小,包括附件,必须小于 10 MB”。如何在此 sendTemplatedEmail API 中添加附件?
还有一个名为“ sendRawEmail ”的API。但这不符合我的要求。我需要使用模板并附加文档。有谁知道该怎么做??
最佳答案
看一下 SendRawEmail 示例:
/* The following example sends an email with an attachment: */
var params = {
Destinations: [],
FromArn: "",
RawMessage: {
Data: <Binary String>
},
ReturnPathArn: "",
Source: "",
SourceArn: ""
};
ses.sendRawEmail(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
/*
data = {
MessageId: "EXAMPLEf3f73d99b-c63fb06f-d263-41f8-a0fb-d0dc67d56c07-000000"
}
*/
});
MIME was defined in 1992 by the Internet Engineering Task Force (IETF). The distinguishing characteristic of a MIME message is the presence of the MIME headers. As long as your mail recipients also have e-mail software that is MIME-compliant (and most e-mail software is), you can swap files containing attachments automatically.
MIME completes the illusion of file attachments by allowing the message body to be divided into distinct parts, each with their own headers. The content type multipart/mixed means that the content of the body is divided into blocks separated by "--" + a unique string guaranteed to not be found anywhere else in the message. If you say that your boundary string is "MyBoundaryString", then all occurrences of that string will be treated as a boundary. So it better not be in the message the user typed or it won't be decoded correctly.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=frontier
This is a message with multiple parts in MIME format.
--frontier
Content-Type: text/plain
This is the body of the message.
--frontier
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64
PGh0bWw+CiAgPGhlYWQ+CiAgPC9oZWFkPgogIDxib2R5PgogICAgPHA+VGhpcyBpcyB0aGUg
Ym9keSBvZiB0aGUgbWVzc2FnZS48L3A+CiAgPC9ib2R5Pgo8L2h0bWw+Cg==
--frontier--
关于amazon-web-services - 如何在 NodeJS 中使用 AWS SES 发送附件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52151723/
我是一名优秀的程序员,十分优秀!