Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated docs etc

  • Loading branch information...
commit 93f2d1f9fbca99b8b072bbc332709c57e9c0186c 1 parent 2ace028
Andris Reinman authored
View
33 README.md
@@ -1,4 +1,35 @@
Nodemailer
==========
-This is a project for a new version of Nodemailer, built from scratch.
+This is a project for a new version of Nodemailer, built from scratch.
+
+## Well known services for SMTP
+
+If you want to use a well known service as the SMTP host, you do not need
+to enter the hostname or port number, just use the 'service' parameter.
+
+Currently cupported services are:
+
+ * **"Gmail"** for Google Mail
+ * **"hot.ee"** for www.hot.ee
+ * **"Hotmail"** for Microsoft Live Hotmail
+ * **"iCloud"** for Apple iCloud
+ * **"mail.ee"** for www.mail.ee
+ * **"Postmark"** for Postmark App
+ * **"SendGrid"** for SendGrid
+ * **"SES"** for Amazon SES
+ * **"Yahoo"** for Yahoo Mail
+ * **"Zoho"** for Zoho Mail
+
+Predefined service data covers 'host', 'port' and secure connection settings,
+any other parameters (ie. auth) need to be set separately.
+
+For example:
+
+ var transport = new nodemailer.Transport("SMTP", {
+ service: "Gmail",
+ auth: {
+ user: "gmail.user@gmail.com",
+ pass: "password"
+ }
+ });
View
3  examples/example_ses.js
@@ -3,7 +3,8 @@ var nodemailer = require('../lib/mail');
// Create an Amazon SES transport object
var transport = new nodemailer.Transport("SES", {
AWSAccessKeyID: "AWSACCESSKEY",
- AWSSecretKey: "/AWS/SECRET"
+ AWSSecretKey: "/AWS/SECRET",
+ ServiceUrl: "https://email.us-east-1.amazonaws.com" // optional
});
console.log('SES Configured');
View
2  examples/example_smtp.js
@@ -2,7 +2,7 @@ var nodemailer = require('../lib/mail');
// Create a SMTP transport object
var transport = new nodemailer.Transport("SMTP", {
- service: 'gmail', // use well known service
+ service: 'Gmail', // use well known service
auth: {
user: "test.nodemailer@gmail.com",
pass: "Nodemailer123"
View
9 lib/engines/ses.js
@@ -66,15 +66,15 @@ SESTransport.prototype.handleMessage = function(email, callback) {
//Execute the request on the correct protocol
if(urlparts.protocol.substr() == "https:") {
- request = https.request(reqObj, this.buildResponseHandler.bind(this, callback));
+ request = https.request(reqObj, this.responseHandler.bind(this, callback));
} else {
- request = http.request(reqObj, this.buildResponseHandler.bind(this, callback));
+ request = http.request(reqObj, this.responseHandler.bind(this, callback));
}
request.end(params);
}
//Adds the callback to the response handler's scope
-SESTransport.prototype.buildResponseHandler = function(callback, response) {
+SESTransport.prototype.responseHandler = function(callback, response) {
var body = "";
response.setEncoding('utf8');
@@ -98,6 +98,8 @@ SESTransport.prototype.buildResponseHandler = function(callback, response) {
});
}
+// It really sucks but I don't know a good way to stream a POST request with
+// unknown legth, so the message needs to be fully composed as a string
SESTransport.prototype.generateMessage = function(emailMessage, callback) {
var email = "";
@@ -111,7 +113,6 @@ SESTransport.prototype.generateMessage = function(emailMessage, callback) {
});
emailMessage.streamMessage();
-
}
SESTransport.prototype.buildKeyValPairs = function(config){
View
38 lib/wellknown.js
@@ -1,19 +1,21 @@
-
+/*
+ * This is a collection of well known SMTP service providers
+ */
module.exports = {
- "gmail":{
+ "Gmail":{
host: "smtp.gmail.com",
secureConnection: true,
port: 465,
requiresAuth: true
},
- "yahoo":{
+ "Yahoo":{
host: "smtp.mail.yahoo.com",
secureConnection: true,
port: 465,
requiresAuth: true
},
- "hotmail":{
+ "Hotmail":{
host: "smtp.live.com",
port: 587,
requiresAuth: true
@@ -25,5 +27,33 @@ module.exports = {
"mail.ee":{
host: "smtp.mail.ee",
requiresAuth: true
+ },
+ "SES":{
+ host: "email-smtp.us-east-1.amazonaws.com",
+ secureConnection: true,
+ port: 465,
+ requiresAuth: true
+ },
+ "Zoho":{
+ host: "smtp.zoho.com",
+ secureConnection: true,
+ port: 465,
+ requiresAuth: true
+ },
+ "iCloud":{
+ host:"smtp.mail.me.com",
+ port: 587,
+ requiresAuth: true
+ },
+ "SendGrid":{
+ host: "smtp.sendgrid.net",
+ secureConnection: true,
+ port: 465,
+ requiresAuth: true
+ },
+ "Postmark":{
+ host: "smtp.postmarkapp.com",
+ port: 25,
+ requiresAuth: true
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.