AWS SES API uses a proxy that prevents the image to appear in the email


I have been setting up a SES account (without SMTP), I have also setup the API for it and currently I am able to send emails via the SES API service. Initially, I was using the code example that is in the SDK documentation. After several tests I have realised that the emails were having encoding issues.

I have switched to use the sendRawEmail function and the email is sent and no encoding issue happen with this function. However, the images from the email are not appearing. The reason for this seems to be due to the use of a proxy:

Is there a way to have the API sending emails and have the images to show as expected?

asked a month ago285 views
2 Answers

To send an email using the Amazon SES API and include an image in its body, you have couple of options depending on your requirements:

Option 1: Using Raw Email Format:

  1. Create the email content in MIME format with the appropriate headers, text body, and embedded image. The image data needs to be encoded and included as an attachment.
  2. You would need to encode the image as base64 and include it as part of the MIME message.
  3. Make an API call to SendEmail (SES API V2) and pass the raw MIME message as a parameter[1].
  4. Amazon SES will attempt to send the email to the specified recipients.

NOTE: The image attachment needs to follow MIME encoding standards. Common formats like JPG, PNG, GIF are supported.

Example codes can be referred in following document:

[1] Sending raw email using the Amazon SES API v2 - Sending raw email using the Amazon SES API v2 -

Option 2: Using HTML with inline Images:

For this use-case you can use the SendEmail/SendRawEmail API. Here are the basic steps:

  1. Create the HTML email content with <img> tags that reference the embedded images. The images need to be encoded and included as attachments in the same raw message.
  2. Construct the complete raw MIME message with the HTML body, image attachments, and appropriate headers like Content-Type, Content-Disposition etc.
  3. Make an API call to SendEmail/SendRawEmail and pass the raw MIME message.
  4. Amazon SES will attempt to send the email and render the HTML content including displaying the embedded images.

NOTE: When composing the raw message, you need to follow the MIME encoding standards for embedding images and constructing the multipart message. Common formats like JPG, PNG are supported. You also need to within the attachment size limits.

Example codes can be referred in following document:

[2] Code examples -

Lastly, to check issues related to intermediate proxy, we need to understand your work-flow and investigate internal logs of outbound email. Therefore, I request you to open case with Premium Support for complete investigation of issue along with message-id of concerned email.

answered a month ago
profile picture
reviewed a month ago

Hi, many thanks for this answer. The second link you provide suggests to use sendEmail sdk method. Yet, this method does not work as it leaves the email with encoding issues.

In summary, if I read your 2 solutions correctly: I need to use the image as an attachment and set the header with a mime-content value. I will try this and well update you indeed

As with regards to the proxy, at this time, I'd like to understand/verify several things:

  • is the proxy used for all SES API emails and if so why is it used and yet there is no documentation how to circumvent its side-effects?
  • I am currently testing SES API on my local environment and the latter is neither secure (does not use https), nor is the environment visible to AWS. Would this be a reason for the proxy not to be able to get the image correctly rendered for instance?
answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions