fix: migrate to @aws-sdk/client-sesv2 for nodemailer v9 compatibility
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
import express from 'express';
|
||||
import cors from 'cors';
|
||||
import nodemailer from 'nodemailer';
|
||||
import { SESClient } from '@aws-sdk/client-ses';
|
||||
import { SESv2Client } from '@aws-sdk/client-sesv2';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { readFileSync, existsSync } from 'node:fs';
|
||||
@@ -27,7 +27,7 @@ const sesConfigured = !!process.env.SES_ACCESS_KEY_ID;
|
||||
|
||||
let transporter;
|
||||
if (sesConfigured) {
|
||||
const ses = new SESClient({
|
||||
const ses = new SESv2Client({
|
||||
region: process.env.SES_REGION || 'ap-southeast-1',
|
||||
credentials: {
|
||||
accessKeyId: process.env.SES_ACCESS_KEY_ID,
|
||||
@@ -35,7 +35,7 @@ if (sesConfigured) {
|
||||
},
|
||||
});
|
||||
transporter = nodemailer.createTransport({
|
||||
SES: { ses, aws: { SendRawEmailCommand: undefined } },
|
||||
SES: { sesv2: true, ses },
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user