You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
686 B
29 lines
686 B
import nodemailer from "nodemailer";
|
|
import dotenv from "dotenv";
|
|
|
|
dotenv.config();
|
|
|
|
export const sendEmail = async (to: string, subject: string, text: string) => {
|
|
const transporter = nodemailer.createTransport({
|
|
service: "gmail",
|
|
auth: {
|
|
user: "wheeparamsoft.mail",
|
|
pass: "gjyr slpt zwhv whvf",
|
|
},
|
|
});
|
|
|
|
const mailOptions = {
|
|
from: "support@wheeparam.com",
|
|
to,
|
|
subject,
|
|
text,
|
|
};
|
|
|
|
try {
|
|
await transporter.sendMail(mailOptions);
|
|
console.log(`Email sent to ${to}`);
|
|
} catch (error) {
|
|
console.error("Email sending error:", error);
|
|
throw error;
|
|
}
|
|
};
|