emailjs/Readme.md

68 lines
2.0 KiB
Markdown
Raw Normal View History

2011-02-23 21:23:37 +00:00
#v0.1
2011-02-23 21:54:56 +00:00
###send emails, html and attachments from node.js to any smtp server
2011-02-23 21:23:37 +00:00
### Installing
npm install emailjs
# FEATURES
- works with SSL smtp servers (ex: gmail)
- works with smtp server authentication (PLAIN, LOGIN, CRAMMD5)
- emails are queued and the queue is sent asynchronously
- supports sending html emails and emails with multiple attachments
- works with nodejs 3.8 and above
# REQUIRES
- access to an SMTP Server (ex: gmail)
# USAGE - text only emails
2011-02-23 22:14:20 +00:00
var email = require("./path/to/emailjs/email");
var server = email.server.connect({
user:yourUSER,
password:yourPASS,
host:"smtp.gmail.com",
port:465,
domain:yourDOMAIN,
secure:true});
2011-02-23 21:23:37 +00:00
// send the message and get a callback with an error or details of the message that was sent
2011-02-23 22:14:20 +00:00
server.send({
text:"i hope this works",
from:yourUSER + "@gmail.com",
to:yourFRIEND,
subject:"testing emailjs"},
function(err, message) {
console.log(err || message);
});
2011-02-23 21:23:37 +00:00
# USAGE - html emails and attachments
2011-02-23 22:14:20 +00:00
var email = require("./path/to/emailjs/email");
var server = email.server.connect({
user:yourUSER,
password:yourPASS,
host:"smtp.gmail.com",
port:465,
domain:yourDOMAIN,
secure:true});
2011-02-23 21:23:37 +00:00
var message = email.message.create("i hope this works", {from:yourUSER + "@gmail.com", to:yourFRIEND, subject:"testing emailjs"});
// attach an alternative html email for those with advanced email clients
message.attach_alternative("i <i>hope</i> this works!");
// attach attachments because you can!
message..attach("path/to/file.zip", "application/zip", "renamed.zip");
// send the message and get a callback with an error or details of the message that was sent
server.send(message, function(err, message) { console.log(err || message); });
// you can continue to send more messages with successive calls to 'server.send', they will be queued on the same smtp connection
// or you can create a new server connection with 'email.server.connect' to async send individual emails instead of a queue
## Authors
eleith