Answer the question
In order to leave comments, you need to log in
Why are nodemailer letters not coming from the hosting?
Tell me why nodemailer letters do not come when the application is hosted, and everything works fine on locallhost, even letters do not get into spam, what could be the problem? I also used the sendgrid platform, everything is the same, the site is hosted on vercel hosting
function sendEmail(message: SendEmailProps) {
return new Promise((res, rej) => {
const transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: process.env.GOOGLE_USER,
pass: process.env.GOOGLE_PASSWORD,
},
})
transporter.sendMail(message, function (err, info) {
if (err) {
console.log(err)
rej(err)
} else {
console.log(info)
res(info)
}
})
})
}
export const sendConfirmationEmail = (username: string, email: string, password: string, confirmLink: string) => {
const message = {
from: process.env.GOOGLE_USER,
to: email,
subject: 'Подтверждение почты',
html: `
<h3> Здравствуйте ${username} </h3>
<p>Чтобы подтвердить ваш email, перейдите: <a target="_" href="${process.env.DOMAIN_NAME}/api/users/activate/${confirmLink}">по этой ссылке</a></p>
<p>Ваш логин: ${email}</p>
<p>Ваш пароль: ${password}</p>
`,
}
return sendEmail(message)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question