Update Utils/sendEmail.js
This commit is contained in:
parent
b0d479daaf
commit
f361a7f413
@ -1,25 +1,51 @@
|
||||
import nodeMailer from "nodemailer";
|
||||
// import nodeMailer from "nodemailer";
|
||||
// import { createTransport } from "nodemailer";
|
||||
|
||||
// const transporter = createTransport({
|
||||
// host: process.env.SMPT_HOST,
|
||||
// port: process.env.SMPT_PORT,
|
||||
// // service: process.env.SMPT_SERVICE,
|
||||
// auth: {
|
||||
// user: process.env.SMPT_MAIL,
|
||||
// pass: process.env.SMPT_PASSWORD,
|
||||
// },
|
||||
// });
|
||||
|
||||
// const sendEmail = async (options) => {
|
||||
// await transporter.sendMail(options, function (error, info) {
|
||||
// if (error) {
|
||||
// console.log(error);
|
||||
// }
|
||||
// });
|
||||
// };
|
||||
// export default sendEmail;
|
||||
|
||||
import { createTransport } from "nodemailer";
|
||||
|
||||
const transporter = createTransport({
|
||||
host: process.env.SMPT_HOST,
|
||||
port: process.env.SMPT_PORT,
|
||||
// service: process.env.SMPT_SERVICE,
|
||||
host: "smtp-relay.brevo.com",
|
||||
port: 587,
|
||||
secure: false,
|
||||
auth: {
|
||||
user: process.env.SMPT_MAIL,
|
||||
pass: process.env.SMPT_PASSWORD,
|
||||
},
|
||||
user: "78ab42003@smtp-brevo.com",
|
||||
pass: "saTOdNcySftx2PXG"
|
||||
}
|
||||
});
|
||||
|
||||
const sendEmail = async (options) => {
|
||||
await transporter.sendMail(options, function (error, info) {
|
||||
if (error) {
|
||||
console.log(error);
|
||||
}
|
||||
try {
|
||||
await transporter.sendMail({
|
||||
from: options.from || "Cheminova <cheminova2004@gmail.com>",
|
||||
to: options.to,
|
||||
subject: options.subject,
|
||||
html: options.html
|
||||
});
|
||||
return true;
|
||||
} catch (error) {
|
||||
return true;
|
||||
};
|
||||
export default sendEmail;
|
||||
|
||||
export default sendEmail;
|
||||
|
||||
|
||||
// import sgMail from '@sendgrid/mail';
|
||||
|
Loading…
Reference in New Issue
Block a user