Fix email service
This commit is contained in:
@@ -141,7 +141,7 @@ module.exports.saveUserToArpa = (userData, db) => {
|
||||
businessCode: ArpaID.data.data.BusinessCode
|
||||
})
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
// console.log(e)
|
||||
|
||||
reject(e)
|
||||
}
|
||||
|
||||
@@ -39,12 +39,12 @@ function sendConfirmationEmail(userId) {
|
||||
/// //// email configs
|
||||
// const hostURL = 'www.asan-service.com'
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: 'mail.asan-service.com',
|
||||
port: 465,
|
||||
secure: true, // true for 465, false for other ports
|
||||
host: 'smtp.c1.liara.email',
|
||||
port: 587,
|
||||
secure: false, // true for 465, false for other ports
|
||||
auth: {
|
||||
user: 'confirmation@asan-service.com',
|
||||
pass: 'N7xNFZp*L_X{'
|
||||
user: 'awesome_bell_ncc1hi',
|
||||
pass: '509f8938-db95-4b8d-83e7-9ea8eccfd28b'
|
||||
},
|
||||
tls: {
|
||||
rejectUnauthorized: false
|
||||
|
||||
@@ -1,3 +1,59 @@
|
||||
const txt = "s-01E33301G-M810924394"
|
||||
const nodemailer = require('nodemailer')
|
||||
|
||||
console.log(newitem)
|
||||
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()
|
||||
Reference in New Issue
Block a user