Permalink
Browse files

[docs] Added template demo example.

  • Loading branch information...
1 parent 54a3409 commit 16241c9a4506b21675ec281d403d53d263144f26 @Marak committed May 18, 2011
Showing with 30 additions and 0 deletions.
  1. +30 −0 demo-template.js
View
@@ -0,0 +1,30 @@
+var email = require("./lib/node_mailer");
+
+for(var i = 0; i < 10; i++){
+
+ email.send({
+ host : "localhost", // smtp server hostname
+ port : "25", // smtp server port
+ domain : "localhost", // domain used by client to identify itself to server
+ to : "marak.squires@gmail.com",
+ from : "obama@whitehouse.gov",
+ subject : "node_mailer test email",
+ template : "./templates/sample.txt", // path to template name
+ data : {
+ "username": "Billy Bob",
+ "color": function(){
+ var arr = ["purple", "red", "green", "yello"];
+ return arr[Math.floor(Math.random()*3)];
+ },
+ "animal": "monkey",
+ "adverb": "quickly",
+ "noun": "hot lava"
+ },
+
+ username : "dXNlcm5hbWU=", // Base64 encoded username
+ password : "cGFzc3dvcmQ=" // Base64 encoded password
+ },
+ function(err, result){
+ if(err){ console.log(err); }
+ });
+}

0 comments on commit 16241c9

Please sign in to comment.