1
votes

Is there a way to send Cognito verification email as plain text email?

Some of our customers use MMS email for Cognito registration. They use the app Message on iPhone to read those emails. After registration, the email verification comes but shows up on the Message as an HTML attachment, which needs a tap to open up the email content.

We want the content to show up nicely as an bubble-message, which can be done if the email is sent in plain text not HTML. I tried adding <meta http-equiv="Content-Type" content="text/plain; charset=utf-8" /> to the message customizations but it did not work.

2

2 Answers

0
votes

You can, yes.

  1. Setup the Cognito Custom Message Trigger to call a lambda (https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-custom-message.html)
  2. Create a lambda script that sends an email using AWS SES. Using SES you can specify separate HTML and TEXT parts of the message (https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/ses-examples-sending-email.html)
0
votes

Custom sender has solved my problem https://docs.amazonaws.cn/en_us/cognito/latest/developerguide/user-pool-lambda-custom-sender-triggers.html

Note that this trigger is not available in the console, so you must use update-user-pool api call to add it.

One important thing about this api is noted in the document: If you don't provide a value for an attribute, it will be set to the default value. . I wasted a lot of time to debug just to find out that some settings had been changed due to this behavior.