59 lines
2.7 KiB
JavaScript
59 lines
2.7 KiB
JavaScript
const nodemailer = require('nodemailer')
|
|
|
|
function sendConfirmationEmail() {
|
|
return new Promise(async (resolve, reject) => {
|
|
try {
|
|
|
|
|
|
/// //// email configs
|
|
// const hostURL = 'www.asan-service.com'
|
|
const transporter = nodemailer.createTransport({
|
|
host: 'smtp.c1.liara.email',
|
|
port: 587,
|
|
secure: false, // true for 465, false for other ports
|
|
auth: {
|
|
user: 'awesome_bell_ncc1hi',
|
|
pass: '509f8938-db95-4b8d-83e7-9ea8eccfd28b'
|
|
},
|
|
tls: {
|
|
rejectUnauthorized: false
|
|
}
|
|
})
|
|
|
|
const emailHTMLTemplate = `
|
|
<div style="direction: rtl;background-color: #065495;overflow: hidden;">
|
|
<div
|
|
style="width: 70%;border-radius: 10px;margin: 150px auto;background: #fff;text-align: center;padding: 20px;box-shadow: 0 15px 30px #000;"
|
|
>
|
|
<h1 style="color: #000;font-size: 25px;margin-bottom: 20px;">
|
|
<span> این ایمیل در وبسایت</span>
|
|
<strong style="color: #065495"> آسان سرویس </strong>
|
|
<span> ثبت شده است. </span>
|
|
</h1>
|
|
<p style="color: #000;">کد تایید آدرس ایمیل شما:</p>
|
|
<div style="text-align: center;margin-top: 5px;">
|
|
<p style="color: #065495;text-align: center;font-weight: bold;font-size: 20px;direction: ltr;">
|
|
${54534}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`
|
|
|
|
// send mail with defined transport object
|
|
await transporter.sendMail({
|
|
from: '"AsanService" <confirmation@asan-service.com>', // sender address
|
|
to: "www.amir.com007@gmail.com", // list of receivers
|
|
subject: 'تایید ایمیل',
|
|
text: emailHTMLTemplate,
|
|
html: emailHTMLTemplate
|
|
})
|
|
|
|
resolve()
|
|
} catch (err) {
|
|
reject(err)
|
|
}
|
|
})
|
|
}
|
|
|
|
sendConfirmationEmail() |