Olá, estou recebendo o erro 'Unexpected socket close'
async function enviaEmail(usuario) {
const contaTeste = await nodemailer.createTestAccount();
const transportador = nodemailer.createTransport({
host: 'smtp.ethereal.email',
auth: {
user: contaTeste.user,
pass: contaTeste.pass
}
});
const info = await transportador.sendMail({
from: '"Blog" <noreply@blog.com.br>',
to: 'usuario.email',
subject: 'Teste de email',
text: 'E-mail de teste',
html: '<h1> Olá! </h1> <p> E-mail de teste</p>'
});
console.log('URL: '+ nodemailer.getTestMessageUrl(info));
}
module.exports = { enviaEmail };