I need to create module for this code, please help to change for express.js module? I use basic express-generator.
mailer.extend(app, {
from: 'mail@mail.com',
host: 'smtp.gmail.com',
secureConnection: true,
port: 465,
transportMethod: 'SMTP',
auth: {
user: 'mail@mail.com',
pass: 'password'
}
});
app.get('/ticket', function (req, res, next) {
app.mailer.send('email', {
to: 'mail@mail.com',
subject: 'Test Email',
otherProperty: 'Other Property'
}, function (err) {
if (err) {
console.log(err);
res.send('There was an error sending the email');
return;
}
res.send('Email Sent');
});
});
via Ooos
No comments:
Post a Comment