email nodemailer brevo
This commit is contained in:
parent
4899944d71
commit
8263b0a684
9
.env
9
.env
@ -15,3 +15,12 @@ SEND_EMAIL_FROM="project.boloai@gmail.com"
|
||||
|
||||
# Bolo Ai
|
||||
SENDGRID_API_KEY="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"
|
||||
|
||||
POCKETBASE_API_KEY="xsmtpsib-e227d98b5030a0f616551a01683f3f9e0d3982afc734667fab873d17979320ad-K47RGbsECv6pLjaA"
|
||||
|
||||
SMPT_HOST="smtp-relay.brevo.com"
|
||||
SMPT_PORT="587"
|
||||
SMPT_MAIL="project.boloai@gmail.com"
|
||||
SMPT_PASSWORD="xsmtpsib-e227d98b5030a0f616551a01683f3f9e0d3982afc734667fab873d17979320ad-K47RGbsECv6pLjaA"
|
||||
|
||||
|
||||
|
@ -1,36 +1,40 @@
|
||||
// import nodeMailer from "nodemailer"
|
||||
import nodeMailer from "nodemailer";
|
||||
import { createTransport } from "nodemailer";
|
||||
|
||||
// const sendEmail = async (options) => {
|
||||
// const transporter = nodeMailer.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,
|
||||
// },
|
||||
// });
|
||||
// // console.log(process.env.SMPT_PORT)
|
||||
// // console.log(process.env.SMPT_MAIL)
|
||||
// // console.log(process.env.SMPT_PASSWORD)
|
||||
// //console.log(transporter)
|
||||
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 mailOptions = {
|
||||
// from: process.env.SMPT_MAIL,
|
||||
// to: options.email,
|
||||
// subject: options.subject,
|
||||
// text: options.message,
|
||||
// };
|
||||
// const mailOptions = {
|
||||
// from: process.env.SMPT_MAIL,
|
||||
// to: options.email,
|
||||
// subject: options.subject,
|
||||
// text: options.message,
|
||||
// };
|
||||
|
||||
// await transporter.sendMail(mailOptions);
|
||||
// };
|
||||
// export default sendEmail;
|
||||
import sgMail from '@sendgrid/mail';
|
||||
sgMail.setApiKey(process.env.SENDGRID_API_KEY)
|
||||
// console.log(process.env.SENDGRID_API_KEY)
|
||||
const sendEmail = async (options) => {
|
||||
sgMail.send(options)
|
||||
console.log(options);
|
||||
await transporter.sendMail(options, function (error, info) {
|
||||
if (error) {
|
||||
console.log(error);
|
||||
} else {
|
||||
console.log("Email sent: " + info.response);
|
||||
}
|
||||
});
|
||||
};
|
||||
export default sendEmail;
|
||||
|
||||
// import sgMail from '@sendgrid/mail';
|
||||
// sgMail.setApiKey(process.env.SENDGRID_API_KEY)
|
||||
// // console.log(process.env.SENDGRID_API_KEY)
|
||||
// const sendEmail = async (options) => {
|
||||
// sgMail.send(options)
|
||||
|
||||
}
|
||||
export default sendEmail
|
||||
// }
|
||||
// export default sendEmail
|
||||
|
1995
package-lock.json
generated
1995
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -25,7 +25,7 @@
|
||||
"mongoose": "^6.3.5",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"multer-storage-cloudinary": "^4.0.0",
|
||||
"nodemailer": "^6.7.5",
|
||||
"nodemailer": "^6.9.4",
|
||||
"secure-random-password": "^0.2.3",
|
||||
"validator": "^13.7.0"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user