Using SES sendEmail to deliver HTML formatted emails

0

I'm using the AWS SDK for PHP and when I compose and send an email, they always arrive in plain text format rather than the HTML format provided. I provide both the HTML and Text attributes for the Body. The documentation indicates that you can provide one or the other or both, but leaving off the Text attribute results in a validation error.

I've sent emails to two different recipient systems, and both display the plain text content.

What am I missing?

1개 답변
0

Hi,

The following document shows how to use the AWS SDK for PHP to send an email through Amazon SES: https://docs.aws.amazon.com/ses/latest/dg/send-an-email-using-sdk-programmatically.html#send-an-email-using-sdk-programmatically-examples

The code in this tutorial was tested using PHP 7.2.7. This code sample sends the email in both the formats – HTML and plain text. When you use both formats to send the same content in a single message, the recipient's email client decides which to display, based upon its capabilities as discussed here: https://docs.aws.amazon.com/ses/latest/dg/send-email-concepts-email-format.html#send-email-concepts-email-format-body

You may send the email in only HTML format by modifying the Body attribute as follows:

'Body' => [
              'Html' => [
                  'Charset' => $char_set,
                  'Data' => $html_body,
              ],
          ],

Also to view the email in HTML format, please ensure that you use HTML-enabled email clients.

AWS
지원 엔지니어
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠