mirror of
https://github.com/BradNut/remix-syntax
synced 2025-09-08 17:40:28 +00:00
31 lines
613 B
TypeScript
31 lines
613 B
TypeScript
|
|
import nodemailer from 'nodemailer';
|
||
|
|
|
||
|
|
export async function sendEmail({
|
||
|
|
to,
|
||
|
|
text,
|
||
|
|
}:{
|
||
|
|
to: string;
|
||
|
|
text: string;
|
||
|
|
}) {
|
||
|
|
let testAccount = await nodemailer.createTestAccount();
|
||
|
|
let transporter = nodemailer.createTransport({
|
||
|
|
host: 'smtp.ethereal.email',
|
||
|
|
port: 587,
|
||
|
|
secure: false,
|
||
|
|
auth: {
|
||
|
|
user: testAccount.user,
|
||
|
|
pass: testAccount.pass,
|
||
|
|
}
|
||
|
|
})
|
||
|
|
|
||
|
|
let info = await transporter.sendMail({
|
||
|
|
from: "Syntax <scott@syntax.fm>",
|
||
|
|
to,
|
||
|
|
subject: "Potluck Message",
|
||
|
|
text,
|
||
|
|
});
|
||
|
|
|
||
|
|
console.log('Message send:', nodemailer.getTestMessageUrl(info));
|
||
|
|
|
||
|
|
return "success";
|
||
|
|
}
|