code push for email

This commit is contained in:
ROSHAN GARG 2025-05-07 13:13:03 +05:30
commit 51df007051

View File

@ -1,79 +1,84 @@
import nodeMailer from "nodemailer"; import nodeMailer from "nodemailer";
import { createTransport } from "nodemailer"; import { createTransport } from "nodemailer";
const transporter = createTransport({ const transporter = createTransport({
host: process.env.SMPT_HOST, host: process.env.SMPT_HOST,
port: process.env.SMPT_PORT, port: process.env.SMPT_PORT,
// service: process.env.SMPT_SERVICE, // service: process.env.SMPT_SERVICE,
auth: { auth: {
user: process.env.SMPT_MAIL, user: process.env.SMPT_MAIL,
pass: process.env.SMPT_PASSWORD, pass: process.env.SMPT_PASSWORD,
}, },
}); });
const sendEmail = async (options) => { const sendEmail = async (options) => {
await transporter.sendMail(options, function (error, info) { await transporter.sendMail(options, function (error, info) {
if (error) { if (error) {
console.log(error); console.log(error);
} }
}); });
}; };
export default sendEmail; 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)
// import sgMail from '@sendgrid/mail';
// } // sgMail.setApiKey(process.env.SENDGRID_API_KEY)
// export default sendEmail // // console.log(process.env.SENDGRID_API_KEY)
// const sendEmail = async (options) => {
// from message bird SMS send------------------------------------ // sgMail.send(options)
// import { initClient } from "messagebird";
// const messagebird = initClient("p2YaqxU9uYx2F3d3dV8ywAFtk"); // }
// // e7HGr3kMl6su4c79DKjNAwlLQ // export default sendEmail
// //7oOgyzfNuwBnqMc2oK6aGfczs
// //11yKY8EbdFJpugJzaKyAH3YaK // from message bird SMS send------------------------------------
import { initClient } from "messagebird"; // import { initClient } from "messagebird";
// const messagebird = initClient("p2YaqxU9uYx2F3d3dV8ywAFtk");
const messagebird = initClient("p2YaqxU9uYx2F3d3dV8ywAFtk"); // // e7HGr3kMl6su4c79DKjNAwlLQ
export const sendOtp = async (recipient, message) => { // //7oOgyzfNuwBnqMc2oK6aGfczs
if (!recipient || !message) { // //11yKY8EbdFJpugJzaKyAH3YaK
return; import { initClient } from "messagebird";
}
const messagebird = initClient("p2YaqxU9uYx2F3d3dV8ywAFtk");
const params = { export const sendOtp = async (recipient, message) => {
originator: "+447418314922", if (!recipient || !message) {
recipients: [recipient], return;
body: message, }
};
const params = {
messagebird.messages.create(params, (err, response) => { originator: "+447418314922",
if (err) { recipients: [recipient],
console.error("Error sending message:", err); body: message,
return; };
}
// console.log("Message sent successfully:", response); messagebird.messages.create(params, (err, response) => {
}); if (err) {
}; console.error("Error sending message:", err);
// export const sendOtp = async (recipient, message) => { return;
// if (!recipient || !message) { }
// return; // console.log("Message sent successfully:", response);
// } });
// console.log(recipient, message); };
// const params = { // export const sendOtp = async (recipient, message) => {
// originator: "+447418314922", // if (!recipient || !message) {
// recipients: [recipient], // return;
// body: message, // }
// }; // console.log(recipient, message);
// const params = {
// messagebird.messages.create(params, (err, response) => { // originator: "+447418314922",
// if (err) { // recipients: [recipient],
// console.error("Error sending message-------:", err); // body: message,
// return; // };
// }
// // console.log("Message sent successfully:", response); // messagebird.messages.create(params, (err, response) => {
// // console.log("Message details:", response, response?.recipients?.items); // if (err) {
// }); // console.error("Error sending message-------:", err);
// }; // return;
// }
// // console.log("Message sent successfully:", response);
// // console.log("Message details:", response, response?.recipients?.items);
// });
// };