pixl-mail 1.0.12 → 1.0.14

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.
Files changed (2) hide show
  1. package/README.md +25 -25
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -6,33 +6,33 @@ This module provides a very simple e-mail sender, which leans heavily on the awe
6
6
 
7
7
  Use [npm](https://www.npmjs.com/) to install the module:
8
8
 
9
- ```
9
+ ```sh
10
10
  npm install pixl-mail
11
11
  ```
12
12
 
13
13
  Then use `require()` to load it in your code:
14
14
 
15
- ```javascript
16
- var PixlMail = require('pixl-mail');
15
+ ```js
16
+ const PixlMail = require('pixl-mail');
17
17
  ```
18
18
 
19
19
  Instantiate a mailer object and pass in the SMTP hostname (defaults to `127.0.0.1`) and the port number (defaults to `25`):
20
20
 
21
- ```javascript
22
- var mail = new PixlMail( 'smtp.myserver.com', 25 );
23
- var mail = new PixlMail( '127.0.0.1' );
24
- var mail = new PixlMail();
21
+ ```js
22
+ let mail = new PixlMail( 'smtp.myserver.com', 25 );
23
+ let mail = new PixlMail( '127.0.0.1' );
24
+ let mail = new PixlMail();
25
25
  ```
26
26
 
27
27
  Send mail using the `send()` method. Pass in the complete e-mail message as a multi-line string including `To`, `From` and `Subject` headers, and a callback:
28
28
 
29
- ```javascript
30
- var message =
29
+ ```js
30
+ let message =
31
31
  "To: president@whitehouse.gov\n" +
32
32
  "From: citizen@email.com\n" +
33
- "Subject: NASA Budget\n" +
33
+ "Subject: State Budget\n" +
34
34
  "\n" +
35
- "Dear Mr. President,\nPlease give NASA back their money.\n";
35
+ "Dear Mr. President,\nOur state needs more money.\n";
36
36
 
37
37
  mail.send( message, function(err) {
38
38
  if (err) console.log( "Mail Error: " + err );
@@ -43,13 +43,13 @@ For multiple recipients, simply separate them by commas on the `To` line. You c
43
43
 
44
44
  ## Placeholder Substitution
45
45
 
46
- The library supports a simple e-mail templating system, where you can insert `[bracket_placeholders]` in your e-mail message, and have the library fill them with appropriate content from a separate object. This feature uses the [sub()](https://www.npmjs.com/package/pixl-tools#sub) function from the [pixl-tools](https://www.npmjs.com/package/pixl-tools) package.
46
+ The library supports a simple e-mail templating system, where you can insert `[bracket_placeholders]` in your e-mail message, and have the library fill them with appropriate content from a separate object. This feature uses the [sub()](https://github.com/jhuckaby/pixl-tools#sub) function from the [pixl-tools](https://github.com/jhuckaby/pixl-tools) package.
47
47
 
48
48
  As an example, imagine a welcome e-mail for a new user who has signed up for your app. You have the welcome e-mail "template" stored separately, and want to fill in the user's e-mail address, full name and username at sending time. Here is how to do this:
49
49
 
50
- ```javascript
50
+ ```js
51
51
  // email template
52
- var message =
52
+ let message =
53
53
  "To: [email]\n" +
54
54
  "From: support@myapp.com\n" +
55
55
  "Subject: Welcome to My App, [full_name]!\n" +
@@ -57,7 +57,7 @@ var message =
57
57
  "Dear [full_name],\nWelcome to My App! Your username is '[username]'.\n";
58
58
 
59
59
  // placeholder args
60
- var user = {
60
+ let user = {
61
61
  username: "jhuckaby",
62
62
  full_name: "Joseph Huckaby",
63
63
  email: "jhuckaby@email.com"
@@ -79,14 +79,14 @@ Dear Joseph Huckaby,
79
79
  Welcome to My App! Your username is 'jhuckaby'.
80
80
  ```
81
81
 
82
- You can actually use a complex hash / array tree of arguments, and then specify `[filesystem/style/paths]` or `[dot.style.paths]` in your placeholders. See the [sub()](https://www.npmjs.com/package/pixl-tools#sub) docs for details.
82
+ You can actually use a complex hash / array tree of arguments, and then specify `[filesystem/style/paths]` or `[dot.style.paths]` in your placeholders. See the [sub()](https://github.com/jhuckaby/pixl-tools#sub) docs for details.
83
83
 
84
84
  ## Loading From Files
85
85
 
86
86
  You can specify a file path instead of the raw message, like this:
87
87
 
88
- ```javascript
89
- var user = {
88
+ ```js
89
+ let user = {
90
90
  username: "jhuckaby",
91
91
  full_name: "Joseph Huckaby",
92
92
  email: "jhuckaby@email.com"
@@ -101,8 +101,8 @@ mail.send( "conf/emails/new_user_welcome.txt", user, function(err) {
101
101
 
102
102
  To attach files, include an `attachments` array in your `args` object, and specify a `filename` and `path` for each one. This is passed directly to [nodemailer](https://nodemailer.com/), so you can use all of their attachment features. Example:
103
103
 
104
- ```javascript
105
- var args = {
104
+ ```js
105
+ let args = {
106
106
  attachments: [
107
107
  { filename: "contract.pdf", path: "files/contracts/4573D.PDF" },
108
108
  { filename: "policy.pdf", path: "files/misc/POLICY-2015.PDF" }
@@ -120,13 +120,13 @@ For details, see the [Attachments](https://nodemailer.com/message/attachments/)
120
120
 
121
121
  If you want to send HTML formatted e-mails, the library will automatically detect this. Just provide the headers in plain text, two end-of-lines, then start your HTML markup. Example:
122
122
 
123
- ```javascript
124
- var message =
123
+ ```js
124
+ let message =
125
125
  "To: president@whitehouse.gov\n" +
126
126
  "From: citizen@email.com\n" +
127
- "Subject: NASA Budget\n" +
127
+ "Subject: State Budget\n" +
128
128
  "\n" +
129
- "<h1>Dear Mr. President,</h1>\n<p><b>Please</b> give NASA back their <i>money</i>.</p>\n";
129
+ "<h1>Dear Mr. President,</h1>\n<p><b>Please</b> give our state more <i>money</i>.</p>\n";
130
130
 
131
131
  mail.send( message, function(err) {
132
132
  if (err) console.log( "Mail Error: " + err );
@@ -141,7 +141,7 @@ You can set a number of options using the `setOption()` or `setOptions()` method
141
141
 
142
142
  The `setOption()` method takes one single key/value to set or replace, while `setOptions()` accepts an object containing multiple keys/values.
143
143
 
144
- ```javascript
144
+ ```js
145
145
  mail.setOption( 'secure', true ); // use ssl
146
146
  mail.setOption( 'auth', { user: 'fsmith', pass: '12345' } );
147
147
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixl-mail",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "A very simple class for sending e-mail via SMTP.",
5
5
  "author": "Joseph Huckaby <jhuckaby@gmail.com>",
6
6
  "homepage": "https://github.com/jhuckaby/pixl-mail",
@@ -19,9 +19,9 @@
19
19
  "smtp"
20
20
  ],
21
21
  "dependencies": {
22
- "nodemailer": "6.6.1",
22
+ "nodemailer": "6.9.9",
23
23
  "pixl-tools": "^1.0.19",
24
- "pixl-class": "^1.0.0"
24
+ "pixl-class": "^1.0.3"
25
25
  },
26
26
  "devDependencies": {
27
27