Advertisement
Guest User

Untitled

a guest
Nov 30th, 2016
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. var mailer = require('express-mailer');
  2. mailer.extend(app, {
  3. from: 'No Reply <no-reply@no-reply.com>',
  4. host: 'email-smtp.us-east-1.amazonaws.com',
  5. secureConnection: false,
  6. port: 587,
  7. transportMethod: 'SMTP',
  8. auth: {
  9. user: 'user',
  10. pass: 'password'
  11. }
  12. });
  13.  
  14. var mailConfig = {
  15. to: 'me@email.com',
  16. subject: 'email_subject',
  17. data: {
  18. name: 'name'
  19. }
  20. };
  21.  
  22. var sendOptions = {
  23. template: 'emailTemplate',
  24. attachments: [{
  25. fileName: 'attachment.pdf', filePath: 'data/attachment.pdf'}
  26. }]
  27. };
  28.  
  29. app.mailer.send(sendOptions, mailConfig, function (err)
  30. {
  31. if (err)
  32. console.log(err + 'n' + __filename + ' ' + __functionName + ' ' + __lineNumber);
  33. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement