0
I am making an application with Angularjs and have a contact form 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 having doubts.
I created a structure as follows:
root: |index.html |js: |script.js
Inside the js scrirpt 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 don’t know how to call the upload file from Submit or an event on the button.
Can someone help me?