From b35bb3f1d5ad3c5b07092e9fefb9c3ce786dae1e Mon Sep 17 00:00:00 2001 From: Dobie Wollert Date: Sun, 14 Sep 2014 07:05:34 -0400 Subject: [PATCH] Updated emailjs --- .../mimelib/node_modules/addressparser/package.json | 6 +----- .../encoding/node_modules/iconv-lite/package.json | 6 +----- .../mimelib/node_modules/encoding/package.json | 6 +----- node_modules/emailjs/package.json | 10 +++++----- node_modules/emailjs/smtp/message.js | 6 +++++- 5 files changed, 13 insertions(+), 21 deletions(-) diff --git a/node_modules/emailjs/node_modules/mimelib/node_modules/addressparser/package.json b/node_modules/emailjs/node_modules/mimelib/node_modules/addressparser/package.json index 465e745..805d89d 100644 --- a/node_modules/emailjs/node_modules/mimelib/node_modules/addressparser/package.json +++ b/node_modules/emailjs/node_modules/mimelib/node_modules/addressparser/package.json @@ -20,9 +20,5 @@ "readme": "# addressparser\n\nParse e-mail address fields\n\n## Installation\n\nInstall with npm\n\n npm install addressparser\n\n## Usage\n\nInclude the module\n\n var addressparser = require(\"addressparser\");\n\nParse some address strings with addressparser(field)\n\n var addresses = addressparser(\"andris \");\n console.log(addresses); // [{name: \"andris\", address:\"andris@tr.ee\"}]\n\nAnd when using groups\n\n addressparser('Composers:\"Bach, Sebastian\" , mozart@example.com (Mozzie);');\n\nthe result is\n\n [\n {\n name: \"Composers\",\n group: [\n {\n address: \"sebu@example.com\",\n name: \"Bach, Sebastian\"\n },\n {\n address: \"mozart@example.com\",\n name: \"Mozzie\"\n }\n ]\n }\n ]\n\n\n## Notes\n\n * **NB!** this module does not decode any mime-word or punycode encoded strings, it is only a basic parser for parsing the base data, you need to decode the encoded parts later by yourself\n\n## License\n\n**MIT**", "readmeFilename": "README.md", "_id": "addressparser@0.2.1", - "dist": { - "shasum": "f34ffc5926d038f57181440ab7f1e1af7a5a52db" - }, - "_from": "addressparser@~0.2.0", - "_resolved": "https://registry.npmjs.org/addressparser/-/addressparser-0.2.1.tgz" + "_from": "addressparser@~0.2.0" } diff --git a/node_modules/emailjs/node_modules/mimelib/node_modules/encoding/node_modules/iconv-lite/package.json b/node_modules/emailjs/node_modules/mimelib/node_modules/encoding/node_modules/iconv-lite/package.json index 3a89d53..9ba5c12 100644 --- a/node_modules/emailjs/node_modules/mimelib/node_modules/encoding/node_modules/iconv-lite/package.json +++ b/node_modules/emailjs/node_modules/mimelib/node_modules/encoding/node_modules/iconv-lite/package.json @@ -87,9 +87,5 @@ "readme": "## Pure JS character encoding conversion\n\n\n\n * Doesn't need native code compilation. Works on Windows and in sandboxed environments like [Cloud9](http://c9.io).\n * Used in popular projects like [Grunt](http://gruntjs.com/), [Nodemailer](http://www.nodemailer.com/), [Yeoman](http://yeoman.io/) and others.\n * Faster than [node-iconv](https://github.com/bnoordhuis/node-iconv) (see below for performance comparison).\n * Intuitive encode/decode API\n * Streaming support for Node v0.10+\n * Can extend Node.js primitives (buffers, streams) to support all iconv-lite encodings.\n * In-browser usage via [Browserify](https://github.com/substack/node-browserify) (~180k gzip compressed with Buffer shim included).\n * License: MIT.\n\n[![NPM Stats](https://nodei.co/npm/iconv-lite.png?downloads=true)](https://npmjs.org/packages/iconv-lite/)\n\n## Usage\n### Basic API\n```javascript\nvar iconv = require('iconv-lite');\n\n// Convert from an encoded buffer to js string.\nstr = iconv.decode(new Buffer([0x68, 0x65, 0x6c, 0x6c, 0x6f]), 'win1251');\n\n// Convert from js string to an encoded buffer.\nbuf = iconv.encode(\"Sample input string\", 'win1251');\n\n// Check if encoding is supported\niconv.encodingExists(\"us-ascii\")\n```\n\n### Streaming API (Node v0.10+)\n```javascript\n\n// Decode stream (from binary stream to js strings)\nhttp.createServer(function(req, res) {\n var converterStream = iconv.decodeStream('win1251');\n req.pipe(converterStream);\n\n converterStream.on('data', function(str) {\n console.log(str); // Do something with decoded strings, chunk-by-chunk.\n });\n});\n\n// Convert encoding streaming example\nfs.createReadStream('file-in-win1251.txt')\n .pipe(iconv.decodeStream('win1251'))\n .pipe(iconv.encodeStream('ucs2'))\n .pipe(fs.createWriteStream('file-in-ucs2.txt'));\n\n// Sugar: all encode/decode streams have .collect(cb) method to accumulate data.\nhttp.createServer(function(req, res) {\n req.pipe(iconv.decodeStream('win1251')).collect(function(err, body) {\n assert(typeof body == 'string');\n console.log(body); // full request body string\n });\n});\n```\n\n### Extend Node.js own encodings\n```javascript\n// After this call all Node basic primitives will understand iconv-lite encodings.\niconv.extendNodeEncodings();\n\n// Examples:\nbuf = new Buffer(str, 'win1251');\nbuf.write(str, 'gbk');\nstr = buf.toString('latin1');\nassert(Buffer.isEncoding('iso-8859-15'));\nBuffer.byteLength(str, 'us-ascii');\n\nhttp.createServer(function(req, res) {\n req.setEncoding('big5');\n req.collect(function(err, body) {\n console.log(body);\n });\n});\n\nfs.createReadStream(\"file.txt\", \"shift_jis\");\n\n// External modules are also supported (if they use Node primitives, which they probably do).\nrequest = require('request');\nrequest({\n url: \"http://github.com/\", \n encoding: \"cp932\"\n});\n\n// To remove extensions\niconv.undoExtendNodeEncodings();\n```\n\n## Supported encodings\n\n * All node.js native encodings: utf8, ucs2 / utf16-le, ascii, binary, base64, hex.\n * Additional unicode encodings: utf16, utf16-be, utf-7, utf-7-imap.\n * All widespread singlebyte encodings: Windows 125x family, ISO-8859 family, \n IBM/DOS codepages, Macintosh family, KOI8 family, all others supported by iconv library. \n Aliases like 'latin1', 'us-ascii' also supported.\n * All widespread multibyte encodings: CP932, CP936, CP949, CP950, GB2313, GBK, GB18030, Big5, Shift_JIS, EUC-JP.\n\nSee [all supported encodings on wiki](https://github.com/ashtuchkin/iconv-lite/wiki/Supported-Encodings).\n\nMost singlebyte encodings are generated automatically from [node-iconv](https://github.com/bnoordhuis/node-iconv). Thank you Ben Noordhuis and libiconv authors!\n\nMultibyte encodings are generated from [Unicode.org mappings](http://www.unicode.org/Public/MAPPINGS/) and [WHATWG Encoding Standard mappings](http://encoding.spec.whatwg.org/). Thank you, respective authors!\n\n\n## Encoding/decoding speed\n\nComparison with node-iconv module (1000x256kb, on MacBook Pro, Core i5/2.6 GHz, Node v0.10.26). \nNote: your results may vary, so please always check on your hardware.\n\n operation iconv@2.1.4 iconv-lite@0.4.0\n ----------------------------------------------------------\n encode('win1251') ~130 Mb/s ~380 Mb/s\n decode('win1251') ~127 Mb/s ~210 Mb/s\n\n\n## Notes\n\nWhen decoding, be sure to supply a Buffer to decode() method, otherwise [bad things usually happen](https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding). \nUntranslatable characters are set to � or ?. No transliteration is currently supported.\n\n## Testing\n\n```bash\n$ git clone git@github.com:ashtuchkin/iconv-lite.git\n$ cd iconv-lite\n$ npm install\n$ npm test\n \n$ # To view performance:\n$ node test/performance.js\n```\n\n## Adoption\n[![NPM](https://nodei.co/npm-dl/iconv-lite.png)](https://nodei.co/npm/iconv-lite/)\n\n", "readmeFilename": "README.md", "_id": "iconv-lite@0.4.4", - "dist": { - "shasum": "bbdfcbd1214400050e24f5ebbc26345c702186ac" - }, - "_from": "iconv-lite@~0.4.3", - "_resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.4.tgz" + "_from": "iconv-lite@~0.4.3" } diff --git a/node_modules/emailjs/node_modules/mimelib/node_modules/encoding/package.json b/node_modules/emailjs/node_modules/mimelib/node_modules/encoding/package.json index 2a0aaeb..ec2bba5 100644 --- a/node_modules/emailjs/node_modules/mimelib/node_modules/encoding/package.json +++ b/node_modules/emailjs/node_modules/mimelib/node_modules/encoding/package.json @@ -23,9 +23,5 @@ "readme": "# Encoding\n\n**encoding** is a simple wrapper around [node-iconv](https://github.com/bnoordhuis/node-iconv) and [iconv-lite](https://github.com/ashtuchkin/iconv-lite/) to convert strings from one encoding to another. If node-iconv is not available for some reason,\niconv-lite will be used instead of it as a fallback.\n\n## Install\n\nInstall through npm\n\n npm install encoding\n\n## Usage\n\nRequire the module\n\n var encoding = require(\"encoding\");\n\nConvert with encoding.convert()\n\n var resultBuffer = encoding.convert(text, toCharset, fromCharset);\n\nWhere\n\n * **text** is either a Buffer or a String to be converted\n * **toCharset** is the characterset to convert the string\n * **fromCharset** (*optional*, defaults to UTF-8) is the source charset\n\nOutput of the conversion is always a Buffer object.\n\nExample\n\n var result = encoding.convert(\"ÕÄÖÜ\", \"Latin_1\");\n console.log(result); //\n\n## iconv support\n\nBy default only iconv-lite is bundled. If you need node-iconv support, you need to add it\nas an additional dependency for your project:\n\n ...,\n \"dependencies\":{\n \"encoding\": \"*\",\n \"iconv\": \"*\"\n },\n ...\n\n## License\n\n**MIT**", "readmeFilename": "README.md", "_id": "encoding@0.1.8", - "dist": { - "shasum": "dfe6b04ae615f11cf653132d7f9674327a2ebf3c" - }, - "_from": "encoding@~0.1", - "_resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.8.tgz" + "_from": "encoding@~0.1" } diff --git a/node_modules/emailjs/package.json b/node_modules/emailjs/package.json index c7212c0..880b2a6 100644 --- a/node_modules/emailjs/package.json +++ b/node_modules/emailjs/package.json @@ -1,7 +1,7 @@ { "name": "emailjs", "description": "send text/html emails and attachments (files, streams and strings) from node.js to any smtp server", - "version": "0.3.10", + "version": "0.3.11", "author": { "name": "eleith" }, @@ -47,10 +47,10 @@ }, "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.10", + "_id": "emailjs@0.3.11", "dist": { - "shasum": "cccd50cab389af3145e1db3487d658971723d81a" + "shasum": "a6da50c449d0192a7778cde2fde4bfe3489acce4" }, - "_from": "emailjs@0.3.10", - "_resolved": "https://registry.npmjs.org/emailjs/-/emailjs-0.3.10.tgz" + "_from": "emailjs@0.3.11", + "_resolved": "https://registry.npmjs.org/emailjs/-/emailjs-0.3.11.tgz" } diff --git a/node_modules/emailjs/smtp/message.js b/node_modules/emailjs/smtp/message.js index 4d050f4..f7621fa 100644 --- a/node_modules/emailjs/smtp/message.js +++ b/node_modules/emailjs/smtp/message.js @@ -5,6 +5,7 @@ var os = require('os'); var path = require('path'); var moment = require('moment'); var mimelib = require('mimelib'); +var address = require('./address'); var CRLF = "\r\n"; var MIMECHUNK = 76; // MIME standard wants 76 char chunks when sending out. var BASE64CHUNK= 24; // BASE64 bits needed before padding is used @@ -38,7 +39,10 @@ function person2address(l) // a string of comma separated emails or comma separated name+ if(typeof l == 'string') { - return l.replace(/([^<]+[^\s])(\s*)(<[^>]+>)/g, function(full, name, space, email) { return mimelib.encodeMimeWord(name, 'Q', 'utf-8') + space + email; }); + var addresses = address.parse(l); + return addresses.map(function(addr) { + return addr.label !== '' ? mimelib.encodeMimeWord(addr.label, 'Q', 'utf-8') + ' ' + '<' + addr.address + '>' : addr.address; + }).join(', '); } return null;