Archive. Date of access: 12 Jan 2022
Fedor Indutny eace7c1bf4 bump new version, wait for accept and continue responses before sending email | 14 år sedan | |
---|---|---|
lib | 14 år sedan | |
templates | 14 år sedan | |
vendor | 14 år sedan | |
MIT-LICENSE | 14 år sedan | |
Readme.md | 14 år sedan | |
package.json | 14 år sedan | |
stubSMTP | 14 år sedan |
#v0.4.4
###send emails from node.js to your smtp server, simple as cake.
curl http://npmjs.org/install.sh | sh
npm install mailer
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",
body: "Hello! This is a test of the node_mailer.",
authentication : "login", // auth login is supported; anything else is no auth
username : "dXNlcm5hbWU=", // Base64 encoded username
password : "cGFzc3dvcmQ=" // Base64 encoded password
},
function(err, result){
if(err){ console.log(err); }
});
}
/templates/sample.text
Hello {{username}},
This is a sample template of the node mailer.
It uses mustache templating to do basic search and replaces.
The {{color}} {{animal}} {{adverb}} ran over the {{noun}}.
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"
},
authentication : "login", // auth login is supported; anything else is no auth
username : "dXNlcm5hbWU=", // Base64 encoded username
password : "cGFzc3dvcmQ=" // Base64 encoded password
},
function(err, result){
if(err){ console.log(err); }
});
}
Marak Squires, Elijah Insua