I am making an application with angularjs and I have a form of contact with name, email, phone and message.
I need the contents of this form to go to the client's email and I'm trying to use the nodemailer but I'm not sure.
I created a structure as follows:
root: | index.html | js: | script.js
Inside the scrirpt js I put the code below:
var nodemailer = require('nodemailer');
var transportador = nodemailer.createTransport({
service: 'gmail',
auth: {
user: '[email protected]',
pass: 'futebol11'
}
});
exports.send = function(){
var configuracoes = {
from: 'Seu Nome <[email protected]>',
to: 'Nome do Destinatário <[email protected]>, Outra Pessoa <[email protected]>',
subject: 'Assunto do Email',
text: 'Conteúdo do email em texto',
html: '<h1>Conteúdo do email em HTML</h1>'
};
transportador.sendMail(configuracoes, function(error, info) {
if (error) {
console.log(error);
} else {
console.log('Email enviado ' + info.response);
}
});
}
I do not know how to call the upload file from the submit or an event on the button.
Can anyone help me?