{ "name": "emailjs", "description": "send text/html emails and attachments (files, streams and strings) from node.js to any smtp server", "version": "0.3.11", "author": { "name": "eleith" }, "contributors": [ { "name": "izuzak" }, { "name": "Hiverness" }, { "name": "mscdex" }, { "name": "jimmybergman" } ], "repository": { "type": "git", "url": "http://github.com/eleith/emailjs.git" }, "dependencies": { "moment": "= 1.7.0", "mimelib": "0.2.14", "bufferjs": "=1.1.0" }, "optionalDependencies": { "bufferjs": "=1.1.0" }, "devDependencies": { "mocha": "= 1.7.4", "chai": "= 1.1.0", "simplesmtp": "0.3.32", "mailparser": "0.4.1", "iconv": "2.0.7" }, "engine": [ "node >= 0.10" ], "main": "email", "scripts": { "test": "mocha -R spec -t 5000" }, "readme": "# emailjs [![Build Status](https://secure.travis-ci.org/eleith/emailjs.png)](http://travis-ci.org/eleith/emailjs)\n\nsend emails, html and attachments (files, streams and strings) from node.js to any smtp server\n\n## INSTALLING\n\n\tnpm install emailjs\n\n## FEATURES\n - works with SSL and TLS smtp servers \n - supports smtp authentication (PLAIN, LOGIN, CRAMMD5)\n - emails are queued and the queue is sent asynchronously\n - supports sending html emails and emails with multiple attachments (MIME)\n - attachments can be added as strings, streams or file paths\n - supports utf-8 headers and body\n\n## REQUIRES\n - auth access to an SMTP Server\n - if your service (ex: gmail) uses two-step authentication, use an applicaiton specific password\n\n## EXAMPLE USAGE - text only emails\n\n```javascript\nvar email \t= require(\"./path/to/emailjs/email\");\nvar server \t= email.server.connect({\n user: \"username\", \n password:\"password\", \n host: \"smtp.your-email.com\", \n ssl: true\n});\n\n// send the message and get a callback with an error or details of the message that was sent\nserver.send({\n text: \"i hope this works\", \n from: \"you \", \n to: \"someone , another \",\n cc: \"else \",\n subject: \"testing emailjs\"\n}, function(err, message) { console.log(err || message); });\n```\n\n## EXAMPLE USAGE - html emails and attachments\n\n```javascript\nvar email \t= require(\"./path/to/emailjs/email\");\nvar server \t= email.server.connect({\n user:\t\"username\", \n password:\"password\", \n host:\t\"smtp.your-email.com\", \n ssl:\t\ttrue\n});\n\nvar message\t= {\n text:\t\"i hope this works\", \n from:\t\"you \", \n to:\t\t\"someone , another \",\n cc:\t\t\"else \",\n subject:\t\"testing emailjs\",\n attachment: \n [\n {data:\"i hope this works!\", alternative:true},\n {path:\"path/to/file.zip\", type:\"application/zip\", name:\"renamed.zip\"}\n ]\n};\n\n// send the message and get a callback with an error or details of the message that was sent\nserver.send(message, function(err, message) { console.log(err || message); });\n\n// you can continue to send more messages with successive calls to 'server.send', \n// they will be queued on the same smtp connection\n\n// or you can create a new server connection with 'email.server.connect' \n// to asynchronously send individual emails instead of a queue\n```\n\n## EXAMPLE USAGE - sending through hotmail/outlook\n\n```javascript\nvar email \t= require(\"./path/to/emailjs/email\");\nvar server \t= email.server.connect({\n user:\t\"username\", \n password:\"password\", \n host:\t\"smtp-mail.outlook.com\", \n tls: {ciphers: \"SSLv3\"}\n});\n\nvar message\t= {\n text:\t\"i hope this works\", \n from:\t\"you \", \n to:\t\t\"someone , another \",\n cc:\t\t\"else \",\n subject:\t\"testing emailjs\",\n attachment: \n [\n {data:\"i hope this works!\", alternative:true},\n {path:\"path/to/file.zip\", type:\"application/zip\", name:\"renamed.zip\"}\n ]\n};\n\n// send the message and get a callback with an error or details of the message that was sent\nserver.send(message, function(err, message) { console.log(err || message); });\n```\n\n# API \n\n## email.server.connect(options)\n\n\t// options is an object with the following keys\n\toptions =\n\t{\n\t\tuser \t\t// username for logging into smtp \n\t\tpassword // password for logging into smtp\n\t\thost\t\t// smtp host\n\t\tport\t\t// smtp port (if null a standard port number will be used)\n\t\tssl\t\t// boolean or object {key, ca, cert} (if true or object, ssl connection will be made)\n\t\ttls\t\t// boolean or object (if true or object, starttls will be initiated)\n\t\ttimeout\t// max number of milliseconds to wait for smtp responses (defaults to 5000)\n\t\tdomain\t// domain to greet smtp with (defaults to os.hostname)\n\t}\n\t\n## email.server.send(message, callback)\n\t\n\t// message can be a smtp.Message (as returned by email.message.create)\n\t// or an object identical to the first argument accepted by email.message.create\n\n\t// callback will be executed with (err, message)\n\t// either when message is sent or an error has occurred\n\n## message\n\n\t// headers is an object ('from' and 'to' are required)\n\t// returns a Message object\n\n\t// you can actually pass more message headers than listed, the below are just the\n\t// most common ones you would want to use\n\n\theaders =\n\t{\n\t\ttext\t\t// text of the email \n\t\tfrom\t\t// sender of the format (address or name
or \"name\"
)\n\t\tto\t\t\t// recipients (same format as above), multiple recipients are separated by a comma\n\t\tcc\t\t\t// carbon copied recipients (same format as above)\n\t\tbcc\t\t// blind carbon copied recipients (same format as above)\n\t\tsubject\t// string subject of the email\n attachment // one attachment or array of attachments\n\t}\n\n## attachment\n\n\t// can be called multiple times, each adding a new attachment\n\t// options is an object with the following possible keys:\n \n options =\n {\n // one of these fields is required\n path // string to where the file is located\n data // string of the data you want to attach\n stream // binary stream that will provide attachment data (make sure it is in the paused state)\n // better performance for binary streams is achieved if buffer.length % (76*6) == 0\n // current max size of buffer must be no larger than Message.BUFFERSIZE\n \n // optionally these fields are also accepted\n type\t // string of the file mime type\n name // name to give the file as perceived by the recipient\n alternative // if true, will be attached inline as an alternative (also defaults type='text/html')\n inline // if true, will be attached inline\n encoded // set this to true if the data is already base64 encoded, (avoid this if possible)\n headers // object containing header=>value pairs for inclusion in this attachment's header\n related // an array of attachments that you want to be related to the parent attachment\n }\n\t\n## Authors\n\neleith\n\n## Testing\n\n\tnpm install -d\n\tnpm test\n\n## Contributions\n\nissues and pull requests are welcome\n", "readmeFilename": "Readme.md", "_id": "emailjs@0.3.11", "dist": { "shasum": "a6da50c449d0192a7778cde2fde4bfe3489acce4" }, "_from": "emailjs@0.3.11", "_resolved": "https://registry.npmjs.org/emailjs/-/emailjs-0.3.11.tgz" }