I'd like to send an email with a from (source) address that includes a display name, like so:
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)
However, this fails with a "MessageRejected" response. If I replace the source with just "jdoe@test.com", then it works fine. How can I include a display name?
Note that I also tried "John Doe" <jdoe@test.com>
with the same result.
This is indeed supported. The mistake was elsewhere in the message attributes. For record, the correct format is John Doe <jdoe@test.com>
, without the quotes around the display name.