Skip to content

Commit

Permalink
Minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
tanish35 committed Oct 13, 2024
1 parent f239b9b commit d7b9e94
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions backend/src/mail/sendMail.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import nodemailer from 'nodemailer';
import nodemailer from "nodemailer";

const sendMail = (htmlContent: any, receiverEmail: string) => {
const port = process.env.SMTP_PORT;
Expand All @@ -7,31 +7,29 @@ const sendMail = (htmlContent: any, receiverEmail: string) => {
const password = process.env.SMTP_PASSWORD;
let transporter = nodemailer.createTransport({
// @ts-ignore
host: 'smtp.gmail.com',
port: port,
secure: true,
host: "smtp.gmail.com",
port: port,
secure: true,
auth: {
user: host,
user: host,
pass: password,
},
});

let mailOptions = {
from: `"Campus-Chatter Admin" <${senderEmail}>`,
to: receiverEmail,
subject: 'OTP Verification',
text: htmlContent,
html: htmlContent,
from: `"Campus-Chatter Admin" <${senderEmail}>`,
to: receiverEmail,
subject: "OTP Verification",
text: htmlContent,
html: htmlContent,
};

transporter.sendMail(mailOptions, (error, info) => {
if (error) {
return console.log('Error while sending email:', error);
return console.log("Error while sending email:", error);
}
console.log('Email sent successfully:', info.response);
// console.log('Email sent successfully:', info.response);
});
};


}

export default sendMail
export default sendMail;

0 comments on commit d7b9e94

Please sign in to comment.