Send mails to console when no server specified

This commit is contained in:
Timothy Armes
2024-09-30 08:21:44 +02:00
parent 8893076c4d
commit b84cc271af
+7 -3
View File
@@ -121,9 +121,6 @@ export type NodemailerUserConfig = Omit<
export default function Nodemailer(
config: NodemailerUserConfig,
): NodemailerConfig {
if (!config.server)
throw new AuthError("Nodemailer requires a `server` configuration");
return {
id: "nodemailer",
type: "email",
@@ -150,6 +147,13 @@ export default function Nodemailer(
console.log("Connection URL", url);
const { host } = new URL(url);
console.log(config);
if (!(config.server as unknown as any)?.host) {
console.log(text({ url, host, t }));
return;
}
const transport = createTransport(provider.server);
const result = await transport.sendMail({
to: identifier,