Skip to content

Commit

Permalink
Did requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Joyosmit committed Jun 2, 2024
2 parents f32e496 + f2257df commit a75cc0c
Show file tree
Hide file tree
Showing 11 changed files with 157 additions and 616 deletions.
5 changes: 3 additions & 2 deletions backend/.env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
DATABASE_URL="mongodb+srv://<username>:<password>@clustername/syleshare"
JWT_SECRET="secret"
PORT=3001
EMAIL_USER=user_email_id
EMAIL_PASS=16char_app_password
# EMAIL_USER=user_email_id
# EMAIL_PASS=16char_app_password
# SEND_EMAIL=true
5 changes: 5 additions & 0 deletions backend/src/helpers/mail/sendOtpMail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import nodemailer from "nodemailer";
import getOtpMailBody from "./otpMailBody";

export const sendVerificationEmail = async (email: string, otp: number) => {
if (!process.env.SEND_EMAIL) {
console.log("SEND_EMAIL environment variable is not set. Email not sent.");
return;
}

let transporter = nodemailer.createTransport({
service: "Gmail",
auth: {
Expand Down
7 changes: 5 additions & 2 deletions backend/src/helpers/mail/sendWelcomeMail.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// import nodemailer from "nodemailer";
// @ts-ignore
import nodemailer from "nodemailer";

export const sendWelcomeEmail = async (email: string, username: string) => {
if (!process.env.SEND_EMAIL) {
console.log("SEND_EMAIL environment variable is not set. Email not sent.");
return;
}

let transporter = nodemailer.createTransport({
service: "Gmail",
auth: {
Expand Down
Loading

0 comments on commit a75cc0c

Please sign in to comment.