Skip to content

Commit

Permalink
jshinted code
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Mar 10, 2013
1 parent 3aa42b1 commit 441b3ca
Show file tree
Hide file tree
Showing 20 changed files with 302 additions and 305 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ var smtpTransport = nodemailer.createTransport("SMTP",{
```

Actually, if you are authenticatinw with an e-mail address that has a domain name
like @gmail.com or @yahoo.com etc., then you don't even need to provide the service name,
like @gmail.com or @yahoo.com etc., then you don't even need to provide the service name,
it is detected automatically.

```javascript
Expand Down Expand Up @@ -579,13 +579,13 @@ var mailOptions = {

### Alternative fields

In addition to text and HTML, any kind of data can be inserted as an alternative content of the main body - for example a word processing document with the same text as in the HTML field. It is the job of the e-mail client to select and show the best fitting alternative to the reader.
In addition to text and HTML, any kind of data can be inserted as an alternative content of the main body - for example a word processing document with the same text as in the HTML field. It is the job of the e-mail client to select and show the best fitting alternative to the reader.

Attahcment object consists of the following properties:

* **contents** - String or a Buffer contents for the attachment
* **contentType** - optional content type for the attachment, if not set will be set to "application/octet-stream"
* **contentEncoding** - optional value of how the data is encoded, defaults to "base64"
* **contentEncoding** - optional value of how the data is encoded, defaults to "base64"

If `contents` is empty, the alternative will be discarded. Other fields are optional.

Expand Down Expand Up @@ -622,8 +622,8 @@ or with formatted name (includes unicode support)
"Ноде Майлер" <foobar@blurdybloop.com>
```

To, Cc and Bcc fields accept comma separated list of e-mails or an array of
emails or an array of comma separated list of e-mails - use it as you like.
To, Cc and Bcc fields accept comma separated list of e-mails or an array of
emails or an array of comma separated list of e-mails - use it as you like.
Formatting can be mixed.

```
Expand Down Expand Up @@ -700,7 +700,7 @@ var mailOptions = {
};
```

The image linked is fetched and added automatically as an attachment and the url
The image linked is fetched and added automatically as an attachment and the url
in the HTML is replaced automatically with a proper `cid:` string.

## Return callback
Expand Down
26 changes: 13 additions & 13 deletions bin/nodemailer
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,24 @@ if(configFile){
configFile = {}
}

var transportType = (argv.transport || configFile.transport || process.env.NODEMAILER_TRANSPORT || "").trim(),
service = argv.service || configFile.service || process.env.NODEMAILER_SERVICE,
user = argv.user || argv.u || configFile.user || process.env.NODEMAILER_USER,
pass = argv.pass || argv.p || configFile.pass || process.env.NODEMAILER_PASS,
host = argv.host || argv.h || configFile.host || process.env.NODEMAILER_HOST,
port = argv.port || configFile.port || process.env.NODEMAILER_PORT,
secure = (argv.secure || configFile.secure || process.env.NODEMAILER_SECURE || "").toString().toLowerCase().trim(),
key = argv.key || argv.k || configFile.key || process.env.NODEMAILER_KEY,
secret = argv.secret || configFile.secret || process.env.NODEMAILER_SECRET
token = argv.token || configFile.token || process.env.NODEMAILER_TOKEN;
var transportType = (argv.transport || configFile.transport || process.env.NODEMAILER_TRANSPORT || "").trim(),
service = argv.service || configFile.service || process.env.NODEMAILER_SERVICE,
user = argv.user || argv.u || configFile.user || process.env.NODEMAILER_USER,
pass = argv.pass || argv.p || configFile.pass || process.env.NODEMAILER_PASS,
host = argv.host || argv.h || configFile.host || process.env.NODEMAILER_HOST,
port = argv.port || configFile.port || process.env.NODEMAILER_PORT,
secure = (argv.secure || configFile.secure || process.env.NODEMAILER_SECURE || "").toString().toLowerCase().trim(),
key = argv.key || argv.k || configFile.key || process.env.NODEMAILER_KEY,
secret = argv.secret || configFile.secret || process.env.NODEMAILER_SECRET,
token = argv.token || configFile.token || process.env.NODEMAILER_TOKEN;

if(!transportType){
transportType = host?"smtp": (key?"ses":"sendmail");
}

secure = ["false", "null", "0", "undefined"].indexOf(secure)>=0 ? false : !!secure;

var transportOptions = {debug: !!argv.debug || !!argv.d};
var transportOptions = {debug: !!argv.debug || !!argv.d};

switch(transportType.toUpperCase().trim()){
case "SMTP":
Expand Down Expand Up @@ -104,7 +104,7 @@ var from = argv.from || argv.f || configFile.from || process.env.NODEMAILER_FROM
text = argv.text,
html = argv.html,
headers = argv.headers,
attachments = (argv.attachment || argv.a || "").toString().trim();
attachments = (argv.attachment || argv.a || "").toString().trim();

if(attachments.length){
attachments = attachments.split(",").map(function(a){return {filePath: a.trim()}})
Expand Down Expand Up @@ -136,7 +136,7 @@ if(argv.stdin){
}else{
html = stdin;
}
});
});
}else{
sendMessage();
}
Expand Down
10 changes: 5 additions & 5 deletions examples/example_alternative.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ var transport = nodemailer.createTransport("SMTP", {
console.log('SMTP Configured');

// Message object
var message = {
var message = {

// sender info
from: 'Sender Name <sender@example.com>',

// Comma separated list of recipients
to: '"Receiver Name" <nodemailer@disposebox.com>',

// Subject of the message
subject: 'Nodemailer is unicode friendly ✔', //

Expand Down Expand Up @@ -47,7 +47,7 @@ transport.sendMail(message, function(error){
return;
}
console.log('Message sent successfully!');

// if you don't want to use this transport object anymore, uncomment following line
//transport.close(); // close the connection pool
});
14 changes: 7 additions & 7 deletions examples/example_autoembedding.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ var transport = nodemailer.createTransport("SMTP", {
console.log('SMTP Configured');

// Message object
var message = {
var message = {

// sender info
from: 'Sender Name <sender@example.com>',

// Comma separated list of recipients
to: '"Receiver Name" <receiver@example.com>',

// Subject of the message
subject: 'Automatically embedded image', //

// HTML body with image that will be converted to embedded attachment
html:'<p>Embedded image: <img src="'+__dirname+'/nyan.gif"/></p>',

forceEmbeddedImages: true
};

Expand All @@ -37,7 +37,7 @@ transport.sendMail(message, function(error){
return;
}
console.log('Message sent successfully!');

// if you don't want to use this transport object anymore, uncomment following line
//transport.close(); // close the connection pool
});
22 changes: 11 additions & 11 deletions examples/example_dkim.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ transport.useDKIM({
});

// Message object
var message = {
var message = {

// sender info
from: 'Sender Name <sender@example.com>',

// Comma separated list of recipients
to: '"Receiver Name" <receiver@example.com>',

// Subject of the message
subject: 'Nodemailer is unicode friendly ✔', //

Expand All @@ -30,31 +30,31 @@ var message = {

// plaintext body
text: 'Hello to myself!',

// HTML body
html:'<p><b>Hello</b> to myself <img src="cid:note@node"/></p>'+
'<p>Here\'s a nyan cat for you as an embedded attachment:<br/><img src="cid:nyan@node"/></p>',

// An array of attachments
attachments:[

// String attachment
{
fileName: 'notes.txt',
contents: 'Some notes about this e-mail',
contentType: 'text/plain' // optional, would be detected from the filename
},

// Binary Buffer attachment
{
fileName: 'image.png',
contents: new Buffer('iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD/' +
'//+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4U' +
'g9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC', 'base64'),

cid: 'note@node' // should be as unique as possible
},

// File Stream attachment
{
fileName: 'nyan cat ✔.gif',
Expand All @@ -72,7 +72,7 @@ transport.sendMail(message, function(error){
return;
}
console.log('Message sent successfully!');

// if you don't want to use this transport object anymore, uncomment following line
//transport.close(); // close the connection pool
});
18 changes: 9 additions & 9 deletions examples/example_sendmail.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,43 @@ console.log('Sendmail Configured');

// Message object
var message = {

// sender info
from: 'Sender Name <sender@example.com>',

// Comma separated list of recipients
to: '"Receiver Name" <nodemailer@disposebox.com>',

// Subject of the message
subject: 'Nodemailer is unicode friendly ✔', //

// plaintext body
text: 'Hello to myself!',

// HTML body
html:'<p><b>Hello</b> to myself <img src="cid:note@node"/></p>'+
'<p>Here\'s a nyan cat for you as an embedded attachment:<br/><img src="cid:nyan@node"/></p>',

// An array of attachments
attachments:[

// String attachment
{
fileName: 'notes.txt',
contents: 'Some notes about this e-mail',
contentType: 'text/plain' // optional, would be detected from the filename
},

// Binary Buffer attachment
{
fileName: 'image.png',
contents: new Buffer('iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD/' +
'//+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4U' +
'g9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC', 'base64'),

cid: 'note@node' // should be as unique as possible
},

// File Stream attachment
{
fileName: 'nyan cat ✔.gif',
Expand Down
18 changes: 9 additions & 9 deletions examples/example_ses.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,43 +22,43 @@ transport.useDKIM({

// Message object
var message = {

// sender info
from: 'Sender Name <sender@example.com>',

// Comma separated list of recipients
to: '"Receiver Name" <receiver@example.com>',

// Subject of the message
subject: 'Nodemailer is unicode friendly ✔', //

// plaintext body
text: 'Hello to myself!',

// HTML body
html:'<p><b>Hello</b> to myself <img src="cid:note@node"/></p>'+
'<p>Here\'s a nyan cat for you as an embedded attachment:<br/><img src="cid:nyan@node"/></p>',

// An array of attachments
attachments:[

// String attachment
{
fileName: 'notes.txt',
contents: 'Some notes about this e-mail',
contentType: 'text/plain' // optional, would be detected from the filename
},

// Binary Buffer attachment
{
fileName: 'image.png',
contents: new Buffer('iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD/' +
'//+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4U' +
'g9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC', 'base64'),

cid: 'note@node' // should be as unique as possible
},

// File Stream attachment
{
fileName: 'nyancat.gif',
Expand Down
Loading

0 comments on commit 441b3ca

Please sign in to comment.