Permalink
Browse files

Updated readme

  • Loading branch information...
1 parent 2685865 commit 7b87567ae90e3a2fff66f21a1e62cb8aa0033f00 Andris Reinman committed Feb 10, 2012
Showing with 34 additions and 2 deletions.
  1. +32 −0 README.md
  2. +1 −1 lib/engines/ses.js
  3. +1 −1 lib/transport.js
View
@@ -35,6 +35,38 @@ If you only want to generate the raw e-mail stream, check out
If you only want to communicate with the SMTP (both as client and the server),
check out [simplesmtp](https://github.com/andris9/simplesmtp).
+## Example
+
+This is a complete example to send an e-mail with plaintext and HTMl body
+
+ var nodemailer = require("nodemailer");
+
+ var transport = new nodemailer.Transport("SMTP",{
+ service: "Gmail",
+ auth: {
+ user: "gmail.user@gmail.com",
+ pass: "userpass"
+ }
+ });
+
+ var mailOptions = {
+ transport: transport, // transport method to use
+ from: "Sender Name <sender@example.com>", // sender address
+ to: "receiver1@example.com, receiver2@example.com", // list of receivers
+ subject: "Hello!", // Subject line
+ text: "Hello world!", // plaintext body
+ html: "<b>Hello world!</b>" // html body
+ }
+
+ nodemailer.sendMail(mailOptions, function(error){
+ if(error){
+ console.log(error);
+ }else{
+ console.log("Message sent!");
+ }
+ transport.close(); // let's shut down the connection pool
+ });
+
## Installation
Install through NPM
View
@@ -77,7 +77,7 @@ SESTransport.prototype.handleMessage = function(email, callback) {
reqObj = {
host: urlparts.hostname,
- path: urlparts.path || "/",
+ path: urlparts.path || "/",
method: "POST",
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
View
@@ -19,7 +19,7 @@ function Transport(type, options){
this.options = options;
- switch((type || "").toString().trim().toUpperCase()){
+ switch((type || "").toString().trim().toUpperCase()){
case "SMTP":
this.transport = new SMTPTransport(this.options);
break;

0 comments on commit 7b87567

Please sign in to comment.