Skip to content
Browse files

fix for full email in 'to' field

  • Loading branch information...
1 parent 23607a9 commit 03f1d895b9fadec68aa921b77ecf8960cb688548 @indutny indutny committed Feb 8, 2011
Showing with 10 additions and 3 deletions.
  1. +9 −2 lib/node_mailer.js
  2. +1 −1 package.json
View
11 lib/node_mailer.js
@@ -109,9 +109,16 @@ Connection.prototype = {
self._stream.promise.wait('accepted', _cb_tpl(writeTo));
}
-
+
function writeTo() {
- self._stream.write('rcpt to: ' + email.options.to + '\r\n');
+ function extractEmail(fullEmail) {
+ var m = fullEmail.match(/<([^>]+)>/);
+ return m? m[1]: fullEmail;
+ }
+
+ // thx @viktar
+ self._stream.write('rcpt to: ' + extractEmail(email.options.to) +
+ '\r\n');
self._stream.promise.wait('accepted', _cb_tpl(writeDataStart));
}
View
2 package.json
@@ -1,7 +1,7 @@
{
"name": "mailer",
"description": "send emails from node.js to a smtp server, simple as cake",
- "version": "0.4.52",
+ "version": "0.4.54",
"author": "Marak Squires",
"contributors" : [
"Elijah Insua <tmpvar@gmail.com> (http://tmvpar.com/)",

0 comments on commit 03f1d89

Please sign in to comment.
Something went wrong with that request. Please try again.