Permalink
Browse files

jshinted code

  • Loading branch information...
1 parent 3aa42b1 commit 441b3ca95974de7b72267720283b43f755b0b548 @andris9 andris9 committed Mar 10, 2013
View
@@ -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
@@ -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.
@@ -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.
```
@@ -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
View
@@ -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":
@@ -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()}})
@@ -136,7 +136,7 @@ if(argv.stdin){
}else{
html = stdin;
}
- });
+ });
}else{
sendMessage();
}
@@ -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 ✔', //
@@ -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
});
@@ -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
};
@@ -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
});
View
@@ -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 ✔', //
@@ -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',
@@ -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
});
@@ -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',
View
@@ -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',
Oops, something went wrong.

0 comments on commit 441b3ca

Please sign in to comment.