tegarkurniawan

mail

Sep 27th, 2016
190
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. host: 'smtp.gmail.com', // hostname
  4. secureConnection: true, // use SSL
  5. port: 465, // port for secure SMTP
  6. transportMethod: 'SMTP', // default is SMTP. Accepts anything that nodemailer accepts
  7. auth: {
  8. pass: 'userpass'
  9. }
  10. });
  11.  
  12. app.mailer.send('email', {
  13. to: '[email protected]', // REQUIRED. This can be a comma delimited string just like a normal email to field.
  14. subject: 'Test Email', // REQUIRED.
  15. otherProperty: 'Other Property' // All additional properties are also passed to the template as local variables.
  16. }, function (err) {
  17. if (err) {
  18. // handle error
  19. console.log(err);
  20. res.send('There was an error sending the email');
  21. return;
  22. }
  23. res.send('Email Sent');
  24. });
  25. });
Advertisement
Add Comment
Please, Sign In to add comment