Add support for Resend mailer
This update expands the mailer support by adding the Resend mailer as an alternative to NodeMailer and Cloudflare Mailer. After setting the environment variable 'MAILER_PROVIDER' to 'resend', users can utilize the Resend HTTP API for mailing. Necessary instructions and variable settings regarding the usage of Resend mailer have also been added to README.md and related modules.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const MAILER_PROVIDER = z
|
||||
.enum(['nodemailer', 'cloudflare'])
|
||||
.enum(['nodemailer', 'cloudflare', 'resend'])
|
||||
.default('nodemailer')
|
||||
.parse(process.env.MAILER_PROVIDER);
|
||||
|
||||
@@ -26,6 +26,12 @@ export async function getMailer() {
|
||||
return new CloudflareMailer();
|
||||
}
|
||||
|
||||
case 'resend': {
|
||||
const { ResendMailer } = await import('./impl/resend');
|
||||
|
||||
return new ResendMailer();
|
||||
}
|
||||
|
||||
default:
|
||||
throw new Error(`Invalid mailer: ${MAILER_PROVIDER as string}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user