Permalink
Browse files

readme fix, spaces

  • Loading branch information...
1 parent 577747f commit fbb1d95bd4c540ededc1355f0d5917656bbf1c98 andris9 committed Apr 28, 2011
Showing with 41 additions and 44 deletions.
  1. +3 −5 README.md
  2. +29 −30 lib/mail.js
  3. +9 −9 lib/starttls.js
View
@@ -98,7 +98,7 @@ See [examples/example.js](https://github.com/andris9/Nodemailer/blob/master/exam
### SSL Support
-If you want to use SSL (not TLS/STARTTLS, just SSL), you need to set the ssl parameter to true.
+If you want to use SSL (not TLS/STARTTLS, just SSL), you need to set the *ssl* parameter to true.
nodemailer.SMTP = {
host: "smtp.gmail.com",
@@ -109,10 +109,8 @@ If you want to use SSL (not TLS/STARTTLS, just SSL), you need to set the ssl par
pass: "my.password"
}
-Nodemailer supports SSL support, with one big caveat:
-
- - You *must* be using nodejs v0.3+ and its TLS library
-
+NB! Set *ssl* to true only with SSL connection (port 465). If you are connecting to a server
+with STARTTLS support (ie. port 25 or 587), leave *ssl* to false.
E-mail Message Fields
--------------------
View
@@ -510,36 +510,35 @@ EmailMessage.prototype.send = function(callback){
else {
var address = toAddress[i++];
smtp.send("RCPT TO:<"+address+">", function(error, message) {
- if(error) {
- var forwardAddress;
- //Empty addresses are valid (for server sent notifications).
- if(forwardAddress = error.message.match(/^551.*try\s+([<][^>]*[>])/)) {
- mail.emit("forward",address,forwardAddress[1]);
- toAddress.splice(i,0,forwardAddress[1])
- process.nextTick(nextRecipient);
- return;
- }
- //Not all error codes are true failures (we may be able to still send it to other recipients)
- else if(error.message.match(/^(?:552|451|452|500|503|421)/)){
- smtp.close();
- process.nextTick(function(){
- callback && callback(error, null);
- });
- return;
- }
- else {
- mail.emit("retain",address);
- process.nextTick(nextRecipient);
- return;
- }
- }
- if(message && /^251/.test(message.test)) {
- mail.emit("defer",address);
- }
- else {
- mail.emit("send",address);
- }
- process.nextTick(nextRecipient);
+ if(error) {
+ var forwardAddress;
+ //Empty addresses are valid (for server sent notifications).
+ if(forwardAddress = error.message.match(/^551.*try\s+([<][^>]*[>])/)) {
+ mail.emit("forward", address,forwardAddress[1]);
+ toAddress.splice(i,0,forwardAddress[1])
+ process.nextTick(nextRecipient);
+ return;
+ }
+ //Not all error codes are true failures (we may be able to still send it to other recipients)
+ else if(error.message.match(/^(?:552|451|452|500|503|421)/)){
+ smtp.close();
+ process.nextTick(function(){
+ callback && callback(error, null);
+ });
+ return;
+ } else {
+ mail.emit("retain", address);
+ process.nextTick(nextRecipient);
+ return;
+ }
+ }
+
+ if(message && /^251/.test(message.test)) {
+ mail.emit("defer",address);
+ } else {
+ mail.emit("send",address);
+ }
+ process.nextTick(nextRecipient);
});
}
}
View
@@ -38,16 +38,16 @@ module.exports = function starttls(socket, options, cb) {
};
function forwardEvents(events,emitterSource,emitterDestination) {
- var map = {}
+ var map = {}, name, handler;
for(var i = 0; i < events.length; i++) {
- var name = events[i],
- handler = (function generateForwardEvent(){
- return function forwardEvent(name) {
- return emitterDestination.emit.apply(emitterDestination,arguments);
- }
- })(name);
+ name = events[i];
+ handler = (function generateForwardEvent(){
+ return function forwardEvent(name) {
+ return emitterDestination.emit.apply(emitterDestination, arguments);
+ }
+ })(name);
map[name] = handler;
- emitterSource.on(name,handler);
+ emitterSource.on(name, handler);
}
return map;
}
@@ -76,7 +76,7 @@ function pipe(pair, socket) {
}
}
- var map = forwardEvents(["timeout","end","close"],socket,cleartext);
+ var map = forwardEvents(["timeout","end","close"], socket, cleartext);
function onclose() {
socket.removeListener('error', onerror);

0 comments on commit fbb1d95

Please sign in to comment.