diff options
Diffstat (limited to 'tools/node_modules/nodemailer/examples')
-rw-r--r-- | tools/node_modules/nodemailer/examples/example_dkim.js | 78 | ||||
-rw-r--r-- | tools/node_modules/nodemailer/examples/example_sendmail.js | 65 | ||||
-rw-r--r-- | tools/node_modules/nodemailer/examples/example_ses.js | 80 | ||||
-rw-r--r-- | tools/node_modules/nodemailer/examples/example_smtp.js | 77 | ||||
-rw-r--r-- | tools/node_modules/nodemailer/examples/example_xoauth.js | 86 | ||||
-rw-r--r-- | tools/node_modules/nodemailer/examples/nyan.gif | bin | 0 -> 29361 bytes | |||
-rw-r--r-- | tools/node_modules/nodemailer/examples/test_private.pem | 12 |
7 files changed, 398 insertions, 0 deletions
diff --git a/tools/node_modules/nodemailer/examples/example_dkim.js b/tools/node_modules/nodemailer/examples/example_dkim.js new file mode 100644 index 0000000..2cccdb4 --- /dev/null +++ b/tools/node_modules/nodemailer/examples/example_dkim.js @@ -0,0 +1,78 @@ +var nodemailer = require('../lib/nodemailer'), + fs = require("fs"), + pathlib = require("path"); + +// Create a SMTP transport object +var transport = nodemailer.createTransport("sendmail"); + +// Set up DKIM signing for outgoing messages with this transport object +transport.useDKIM({ + domainName: "do-not-trust.node.ee", // signing domain + keySelector: "dkim", // selector name (in this case there's a dkim._domainkey.do-not-trust.node.ee TXT record set up) + privateKey: fs.readFileSync(pathlib.join(__dirname,"test_private.pem")) +}); + +// 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 ✔', // + + headers: { + 'X-Laziness-level': 1000 + }, + + // 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', + filePath: __dirname+"/nyan.gif", + cid: 'nyan@node' // should be as unique as possible + } + ] +}; + +console.log('Sending Mail'); +transport.sendMail(message, function(error){ + if(error){ + console.log('Error occured'); + console.log(error.message); + 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 +});
\ No newline at end of file diff --git a/tools/node_modules/nodemailer/examples/example_sendmail.js b/tools/node_modules/nodemailer/examples/example_sendmail.js new file mode 100644 index 0000000..86eac1e --- /dev/null +++ b/tools/node_modules/nodemailer/examples/example_sendmail.js @@ -0,0 +1,65 @@ +var nodemailer = require('../lib/nodemailer'); + +// Create a Sendmail transport object +var transport = nodemailer.createTransport("Sendmail", "/usr/sbin/sendmail"); + +console.log('Sendmail Configured'); + +// 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: 'nyan cat ✔.gif', + filePath: __dirname+"/nyan.gif", + cid: 'nyan@node' // should be as unique as possible + } + ] +}; + +console.log('Sending Mail'); + +transport.sendMail(message, function(error){ + if(error){ + console.log('Error occured'); + console.log(error.message); + return; + } + console.log('Message sent successfully!'); +});
\ No newline at end of file diff --git a/tools/node_modules/nodemailer/examples/example_ses.js b/tools/node_modules/nodemailer/examples/example_ses.js new file mode 100644 index 0000000..5be0586 --- /dev/null +++ b/tools/node_modules/nodemailer/examples/example_ses.js @@ -0,0 +1,80 @@ +var nodemailer = require('../lib/nodemailer'), + fs = require("fs"), + pathlib = require("path"); + +// Create an Amazon SES transport object +var transport = nodemailer.createTransport("SES", { + AWSAccessKeyID: "AWSACCESSKEY", + AWSSecretKey: "/AWS/SECRET", + ServiceUrl: "https://email.us-east-1.amazonaws.com" // optional + }); + +console.log('SES Configured'); + +// optional DKIM signing +/* +transport.useDKIM({ + domainName: "do-not-trust.node.ee", // signing domain + keySelector: "dkim", // selector name (in this case there's a dkim._domainkey.do-not-trust.node.ee TXT record set up) + privateKey: fs.readFileSync(pathlib.join(__dirname,"test_private.pem")) +}); +*/ + +// 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', + filePath: __dirname+"/nyan.gif", + cid: 'nyan@node' // should be as unique as possible + } + ] +}; + +console.log('Sending Mail'); + +transport.sendMail(message, function(error){ + if(error){ + console.log('Error occured'); + console.log(error.message); + return; + } + console.log('Message sent successfully!'); +});
\ No newline at end of file diff --git a/tools/node_modules/nodemailer/examples/example_smtp.js b/tools/node_modules/nodemailer/examples/example_smtp.js new file mode 100644 index 0000000..5b73f21 --- /dev/null +++ b/tools/node_modules/nodemailer/examples/example_smtp.js @@ -0,0 +1,77 @@ +var nodemailer = require('../lib/nodemailer'); + +// Create a SMTP transport object +var transport = nodemailer.createTransport("SMTP", { + service: 'Gmail', // use well known service + auth: { + user: "test.nodemailer@gmail.com", + pass: "Nodemailer123" + } + }); + +console.log('SMTP Configured'); + +// 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 ✔', // + + headers: { + 'X-Laziness-level': 1000 + }, + + // 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', + filePath: __dirname+"/nyan.gif", + cid: 'nyan@node' // should be as unique as possible + } + ] +}; + +console.log('Sending Mail'); +transport.sendMail(message, function(error){ + if(error){ + console.log('Error occured'); + console.log(error.message); + 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 +});
\ No newline at end of file diff --git a/tools/node_modules/nodemailer/examples/example_xoauth.js b/tools/node_modules/nodemailer/examples/example_xoauth.js new file mode 100644 index 0000000..80c5db9 --- /dev/null +++ b/tools/node_modules/nodemailer/examples/example_xoauth.js @@ -0,0 +1,86 @@ +var nodemailer = require('../lib/nodemailer'); + +// Create a SMTP transport object +var transport = nodemailer.createTransport("SMTP", { + service: 'Gmail', // use well known service + auth: { + // Option one - provide pregenerated token + // XOAuthToken: "R0VUIGh0dHBzOi8vbWFpbC5nb29...." + // or alternatively, use built in generator + XOAuthToken: nodemailer.createXOAuthGenerator({ + user: "test.nodemailer@gmail.com", + consumerKey: "anonymous", // optional + consumerSecret: "anonymous", // optional + token: "1/O_HgoO4h2uOUfpus0V--7mygICXrQQ0ZajB3ZH52KqM", + tokenSecret: "_mUBkIwNPnfQBUIWrJrpXJ0c" + }) + }, + debug: true + }); + +console.log('SMTP Configured'); + +// 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 ✔', // + + headers: { + 'X-Laziness-level': 1000 + }, + + // 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', + filePath: __dirname+"/nyan.gif", + cid: 'nyan@node' // should be as unique as possible + } + ] +}; + +console.log('Sending Mail'); +transport.sendMail(message, function(error){ + if(error){ + console.log('Error occured'); + console.log(error.message); + 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 +});
\ No newline at end of file diff --git a/tools/node_modules/nodemailer/examples/nyan.gif b/tools/node_modules/nodemailer/examples/nyan.gif Binary files differnew file mode 100644 index 0000000..bf0314f --- /dev/null +++ b/tools/node_modules/nodemailer/examples/nyan.gif diff --git a/tools/node_modules/nodemailer/examples/test_private.pem b/tools/node_modules/nodemailer/examples/test_private.pem new file mode 100644 index 0000000..9d03266 --- /dev/null +++ b/tools/node_modules/nodemailer/examples/test_private.pem @@ -0,0 +1,12 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIBywIBAAJhANCx7ncKUfQ8wBUYmMqq6ky8rBB0NL8knBf3+uA7q/CSxpX6sQ8N +dFNtEeEd7gu7BWEM7+PkO1P0M78eZOvVmput8BP9R44ARpgHY4V0qSCdUt4rD32n +wfjlGbh8p5ua5wIDAQABAmAm+uUQpQPTu7kg95wqVqw2sxLsa9giT6M8MtxQH7Uo +1TF0eAO0TQ4KOxgY1S9OT5sGPVKnag258m3qX7o5imawcuyStb68DQgAUg6xv7Af +AqAEDfYN5HW6xK+X81jfOUECMQDr7XAS4PERATvgb1B3vRu5UEbuXcenHDYgdoyT +3qJFViTbep4qeaflF0uF9eFveMcCMQDic10rJ8fopGD7/a45O4VJb0+lRXVdqZxJ +QzAp+zVKWqDqPfX7L93SQLzOGhdd7OECMQDeQyD7WBkjSQNMy/GF7I1qxrscIxNN +VqGTcbu8Lti285Hjhx/sqhHHHGwU9vB7oM8CMQDKTS3Kw/s/xrot5O+kiZwFgr+w +cmDrj/7jJHb+ykFNb7GaEkiSYqzUjKkfpweBDYECMFJUyzuuFJAjq3BXmGJlyykQ +TweUw+zMVdSXjO+FCPcYNi6CP1t1KoESzGKBVoqA/g== +-----END RSA PRIVATE KEY----- |