Advertisement
tegarkurniawan

mail

Sep 27th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. app.post('/barang/update/:id', isLoggedIn, upload.single('foto'), BarangController.update, function(req, res, next){
  2. mailer.extend(app, {
  3. from: 'no-reply@example.com',
  4. host: 'smtp.gmail.com', // hostname
  5. secureConnection: true, // use SSL
  6. port: 465, // port for secure SMTP
  7. transportMethod: 'SMTP', // default is SMTP. Accepts anything that nodemailer accepts
  8. auth: {
  9. user: 'gmail.user@gmail.com',
  10. pass: 'userpass'
  11. }
  12. });
  13.  
  14. app.mailer.send('email', {
  15. to: 'example@example.com', // REQUIRED. This can be a comma delimited string just like a normal email to field.
  16. subject: 'Test Email', // REQUIRED.
  17. otherProperty: 'Other Property' // All additional properties are also passed to the template as local variables.
  18. }, function (err) {
  19. if (err) {
  20. // handle error
  21. console.log(err);
  22. res.send('There was an error sending the email');
  23. return;
  24. }
  25. res.send('Email Sent');
  26. });
  27. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement