问题描述
我想发送一封包含显示名称的发件人(来源)地址的电子邮件,如下所示:
const command = new Ses.SendEmailCommand({
Destination: {
ToAddresses: [ 'some-recipient@test.com' ],},Source: 'John Doe <jdoe@test.com>',Message: {
Subject: {
Data: 'some subject',Body: {
Html: {
Data: 'some html message',}
}
}
})
const response = await this.client.send(command)
但是,这会失败并返回“MessageRejected”响应。如果我只用“jdoe@test.com”替换源代码,那么它工作正常。如何包含显示名称?
请注意,我也尝试了 "John Doe" <jdoe@test.com>
,结果相同。
解决方法
也许试试这个:
"John Doe" <johndoe@example.com>
文档:http://docs.aws.amazon.com/ses/latest/DeveloperGuide/email-format.html
,这确实是支持的。错误出现在消息属性的其他地方。作为记录,正确的格式是 John Doe <jdoe@test.com>
,显示名称周围没有引号。