Skip to content

Commit

Permalink
changed mail bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
usm0n committed Jul 12, 2024
1 parent 53fb788 commit 064a7ad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Binary file modified .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import movieRoutes from "./routes/movie.routes.js";
import apiKeyMiddleware from "./utils/apiKeyMiddleware.js";
import { engine } from "express-handlebars";
import "dotenv/config";
import { sendMail } from "./utils/sendMail.js";

const app = express();
const MONGODB_KEY = process.env.MONGODB_KEY;
Expand Down
16 changes: 8 additions & 8 deletions utils/sendMail.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import nodemailer from "nodemailer";
import "dotenv/config"

export const sendMail = async (email, subject, text) => {
try {
const transporter = nodemailer.createTransport({
service: "gmail",
host: "smtp.gmail.com",
port: 587,
secure: true,
host: process.env.MAIL_HOST,
port: process.env.MAIL_PORT,
secure: process.env.MAIL_SECURE,
auth: {
user: "usmon.umarovich.09@gmail.com",
pass: "eeip agee pyyr ltnz",
user: process.env.MAIL_EMAIL,
pass: process.env.MAIL_PASSWORD,
},
});

await transporter.sendMail({
from: "usmon.umarovich.09@gmail.com",
from: { address: process.env.MAIL_EMAIL, name: process.env.MAIL_NAME },
to: email,
subject: subject,
text: text,
Expand All @@ -23,4 +23,4 @@ export const sendMail = async (email, subject, text) => {
} catch (error) {
console.log("Email sent error: " + error);
}
};
};

0 comments on commit 064a7ad

Please sign in to comment.