将 aws cli SES 作为文件附件发送
Sending aws cli SES as a file attachmennt
我正在尝试通过 AWS CLI
将我的文件作为附件发送到我的 AWS SES
中。
下面给出的是 aws 文档
提供的 message.json
示例
{
"Data": "From: sender@example.com\nTo: recipient@example.com\nSubject: Test email sent using the AWS CLI (contains an attachment)\nMIME-Version: 1.0\nContent-type: Multipart/Mixed; boundary=\"NextPart\"\n\n--NextPart\nContent-Type: text/plain\n\nThis is the message body.\n\n--NextPart\nContent-Type: text/plain;\nContent-Disposition: attachment; filename=\"attachment.txt\"\n\nThis is the text in the attachment.\n\n--NextPart--"
}
这个json
需要的附件路径在哪里添加
有人可以帮忙吗?
提前致谢
您需要将附件文件编码为 Base64
并在 json
正文中使用。
示例:
Content-Type: application/pdf; name="filename.extension" Content-Description: filename.extension Content-Disposition: attachment; filename="filename.ext"; Content-Transfer-Encoding: base64
\n\nbase-64-text-body\n\n--
您可以使用Python
或node.js
代码自动为您转换。
我正在尝试通过 AWS CLI
将我的文件作为附件发送到我的 AWS SES
中。
下面给出的是 aws 文档
message.json
示例
{
"Data": "From: sender@example.com\nTo: recipient@example.com\nSubject: Test email sent using the AWS CLI (contains an attachment)\nMIME-Version: 1.0\nContent-type: Multipart/Mixed; boundary=\"NextPart\"\n\n--NextPart\nContent-Type: text/plain\n\nThis is the message body.\n\n--NextPart\nContent-Type: text/plain;\nContent-Disposition: attachment; filename=\"attachment.txt\"\n\nThis is the text in the attachment.\n\n--NextPart--"
}
这个json
需要的附件路径在哪里添加
有人可以帮忙吗?
提前致谢
您需要将附件文件编码为 Base64
并在 json
正文中使用。
示例:
Content-Type: application/pdf; name="filename.extension" Content-Description: filename.extension Content-Disposition: attachment; filename="filename.ext"; Content-Transfer-Encoding: base64
\n\nbase-64-text-body\n\n--
您可以使用Python
或node.js
代码自动为您转换。