Created
June 27, 2018 17:07
-
-
Save gabrielrufino/725134bee96723972027bc2e9e44a0b5 to your computer and use it in GitHub Desktop.
Nodemailer: O pombo-correio do Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const nodemailer = require('nodemailer') // Importa o módulo principal | |
const transporter = nodemailer.createTransport({ // Configura os parâmetros de conexão com servidor. | |
host: 'smtp.umbler.com', | |
port: 547, | |
secure: false, | |
auth: { | |
user: 'exemplo@gabrielrufino.com', | |
pass: 'ex3mpl0' | |
} | |
}) | |
const mailOptions = { // Define informações pertinentes ao E-mail que será enviado | |
from: 'exemplo@gabrielrufino.com', | |
to: 'contato@gabrielrufino.com', | |
subject: 'Projeto de software', | |
text: 'Hey Gabriel, preciso de um software. Quando podemos marcar um café?' | |
} | |
tranporter.sendMail(mailOptions, (err, info) => { // Função que, efetivamente, envia o email. | |
if (err) { | |
return console.log(err) | |
} | |
console.log(info) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment