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";
|
import { createTransport } from "nodemailer";
|
||||||
|
|
||||||
const transporter = createTransport({
|
const transporter = createTransport({
|
||||||
host: process.env.SMPT_HOST,
|
host: "smtp-relay.brevo.com",
|
||||||
port: process.env.SMPT_PORT,
|
port: 587,
|
||||||
// service: process.env.SMPT_SERVICE,
|
secure: false,
|
||||||
auth: {
|
auth: {
|
||||||
user: process.env.SMPT_MAIL,
|
user: "78ab42003@smtp-brevo.com",
|
||||||
pass: process.env.SMPT_PASSWORD,
|
pass: "saTOdNcySftx2PXG"
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const sendEmail = async (options) => {
|
const sendEmail = async (options) => {
|
||||||
await transporter.sendMail(options, function (error, info) {
|
try {
|
||||||
if (error) {
|
await transporter.sendMail({
|
||||||
console.log(error);
|
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';
|
// import sgMail from '@sendgrid/mail';
|
||||||
|
Loading…
Reference in New Issue
Block a user