@ohos-ports/node-mailer 0.0.0-stage → 0.1.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Readme.md ADDED
@@ -0,0 +1,25 @@
1
+
2
+ # Node-mailer
3
+
4
+ Mailer on top of nodemailer (https://github.com/andris9/Nodemailer).
5
+
6
+ See server.js in examples/
7
+
8
+ ## Installation
9
+
10
+ npm install node-mailer
11
+
12
+ ## Quick Start
13
+
14
+ var mailer = require('node-mailer');
15
+
16
+ new mailer.Mail({
17
+ from: 'noreply@domain.com',
18
+ to: 'rodolphe@domain.com',
19
+ subject: 'My Subject',
20
+ body: 'My body',
21
+ callback: function(err, data){
22
+ console.log(err);
23
+ console.log(data);
24
+ }
25
+ });
@@ -0,0 +1,21 @@
1
+ var http = require('http'),
2
+ mailer = require('../lib/node-mailer');
3
+
4
+ http.createServer(function (req, res) {
5
+
6
+ new mailer.Mail({
7
+ from: 'noreply@domain.com',
8
+ to: 'rodolphe@domain.com',
9
+ subject: 'My Subject',
10
+ body: 'My body',
11
+ callback: function(err, data){
12
+ console.log(err);
13
+ console.log(data);
14
+ }
15
+ });
16
+
17
+ res.writeHead(200, {'Content-Type': 'text/plain'});
18
+ res.end('Hello World\n');
19
+ }).listen(1337, "127.0.0.1");
20
+
21
+ console.log('Server running at http://127.0.0.1:1337/');
package/index.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./lib/node-mailer');
@@ -0,0 +1,53 @@
1
+ var mailer = require("nodemailer");
2
+
3
+ var Mail = function(options) {
4
+ this.from = options.from;
5
+ this.to = options.to;
6
+ this.subject = options.subject;
7
+ this.body = options.body;
8
+ this.callback = options.callback;
9
+ this.host = options.host;
10
+ this.port = options.port;
11
+ this.domain = options.domain;
12
+
13
+ this.init();
14
+ };
15
+
16
+ Mail.prototype = {
17
+ from: null,
18
+ to: null,
19
+ subject: null,
20
+ body: null,
21
+ callback: null,
22
+ host: null,
23
+ port: null,
24
+ domain: null
25
+ };
26
+
27
+ Mail.prototype.init = function() {
28
+ var self = this;
29
+
30
+ var transport = mailer.createTransport({
31
+ host: this.host || 'localhost',
32
+ port: this.port || 25,
33
+ name: this.domain
34
+ });
35
+
36
+ transport.sendMail({
37
+ from: this.from,
38
+ to: this.to,
39
+ subject: this.subject,
40
+ text: this.body
41
+ }, function(error, info) {
42
+ if(error){
43
+ self.callback(error);
44
+ return false;
45
+ }
46
+
47
+ self.callback(null, true);
48
+ console.log("Message sent");
49
+ });
50
+ };
51
+
52
+ exports.version = '0.1.1';
53
+ exports.Mail = Mail;
package/package.json CHANGED
@@ -1,6 +1,26 @@
1
1
  {
2
2
  "name": "@ohos-ports/node-mailer",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1-beta.1",
4
+ "description": "Mailer on top of nodemailer",
5
+ "homepage": "https://github.com/srod/node-mailer",
6
+ "author": {
7
+ "name": "Rodolphe Stoclin",
8
+ "email": "rodolphe@2clics.net",
9
+ "url": "http://2clics.net"
10
+ },
11
+ "main": "index",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/ohos-ports/ohos-ports.git",
15
+ "directory": "ports/node-mailer/0.1.1"
16
+ },
17
+ "dependencies": {
18
+ "nodemailer": ">= 6.0.0"
19
+ },
20
+ "keywords": [
21
+ "e-mail",
22
+ "mime",
23
+ "email",
24
+ "sendmail"
25
+ ]
26
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.