Search code examples
amazon-web-servicesamazon-ses

Can I include a display name when sending email from the AWS SES Javascript v3 SDK?


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: [ '[email protected]' ],
      },
      Source: 'John Doe <[email protected]>',
      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 "[email protected]", then it works fine. How can I include a display name?

Note that I also tried "John Doe" <[email protected]> with the same result.


Solution

  • This is indeed supported. The mistake was elsewhere in the message attributes. For record, the correct format is John Doe <[email protected]>, without the quotes around the display name.