demo-template.js 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. var email = require("./lib/node_mailer");
  2. for(var i = 0; i < 10; i++){
  3. email.send({
  4. host : "localhost", // smtp server hostname
  5. port : "25", // smtp server port
  6. domain : "localhost", // domain used by client to identify itself to server
  7. to : "marak.squires@gmail.com",
  8. from : "obama@whitehouse.gov",
  9. subject : "node_mailer test email",
  10. template : "./templates/sample.txt", // path to template name
  11. data : {
  12. "username": "Billy Bob",
  13. "color": function(){
  14. var arr = ["purple", "red", "green", "yello"];
  15. return arr[Math.floor(Math.random()*3)];
  16. },
  17. "animal": "monkey",
  18. "adverb": "quickly",
  19. "noun": "hot lava"
  20. },
  21. authentication : "login", // auth login is supported; anything else is no auth
  22. username : undefined, // username
  23. password : undefined, // password
  24. debug: true // log level per message
  25. },
  26. function(err, result){
  27. if(err){ console.log(err); }
  28. });
  29. }