1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

cognito user-poolからtextメールを送信する

Posted at

Cognitoからの各種メールはhtmlメールとなる。
textメールを送る場合は以下の手順。

1 CognitoへCustomEmailSender lambdaメソッドを登録する
2 lambdaメソッドから、SES等を使用してメールを送信する

1 CognitoへCustomEmailSender lambdaメソッドを登録する

こちらの記事を参考に、ほぼ完了
https://qiita.com/kiwi26/items/0ed9e51c9089cf6e7ca9

補足、plaintextのテキスト文字列の取得方法

plaintextはプレーンなテキストではない

.ts
import { decode } from "html-entities";

const { plaintext, messageHeader } = await decrypt(keyring, b64.toByteArray(code));
const plainTextCode = decode(plaintext.toString());

@aws-crypto/client-node => decryptで取得したplaintextのtoStringによりテキストを取得する。
この文字列は & が & とゆー感じで、パスコードの記号部分が変換されている。
html-entitiesを使って、デコードする。

lambdaへは、KMSへのアクセス権限が必要

2 lambdaメソッドから、SES等を使用してメールを送信する

ここは、普通にSESで送れば良い。

最後に。
これくらい、設定で出来るようにして欲しいと思う。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?