@akemona-org/strapi-provider-email-sendmail 3.7.0
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/LICENSE +22 -0
- package/README.md +107 -0
- package/lib/index.js +40 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2015-present Strapi Solutions SAS
|
|
2
|
+
|
|
3
|
+
Portions of the Strapi software are licensed as follows:
|
|
4
|
+
|
|
5
|
+
* All software that resides under an "ee/" directory (the “EE Software”), if that directory exists, is licensed under the license defined in "ee/LICENSE".
|
|
6
|
+
|
|
7
|
+
* All software outside of the above-mentioned directories or restrictions above is available under the "MIT Expat" license as set forth below.
|
|
8
|
+
|
|
9
|
+
MIT Expat License
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# strapi-provider-email-sendmail
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## Deprecation Warning :warning:
|
|
6
|
+
|
|
7
|
+
Hello! We have some news to share,
|
|
8
|
+
|
|
9
|
+
We’ve decided it’ll soon be time to end the support for `strapi-provider-email-sendmail`.
|
|
10
|
+
|
|
11
|
+
After years of iterations, Strapi is going to V4 and we won’t maintain V3 packages when it’ll reach its end-of-support milestone (~end of Q3 2022).
|
|
12
|
+
|
|
13
|
+
If you’ve been using `strapi-provider-email-sendmail` and have migrated to V4 (or if you want to), you can find the equivalent and updated version of this package at this [URL](https://github.com/strapi/strapi/tree/master/packages/providers/email-sendmail) and with the following name on NPM: `@strapi/provider-email-sendmail`.
|
|
14
|
+
|
|
15
|
+
If you’ve contributed to the development of this package, thank you again for that! We hope to see you on the V4 soon.
|
|
16
|
+
|
|
17
|
+
The Akemona team
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Resources
|
|
22
|
+
|
|
23
|
+
- [License](LICENSE)
|
|
24
|
+
|
|
25
|
+
## Links
|
|
26
|
+
|
|
27
|
+
- [Strapi website](https://strapi.akemona.com/)
|
|
28
|
+
- [Strapi community on Slack](https://slack.strapi.io)
|
|
29
|
+
- [Strapi news on Twitter](https://twitter.com/strapijs)
|
|
30
|
+
|
|
31
|
+
## Prerequisites
|
|
32
|
+
|
|
33
|
+
You need to have the plugin `strapi-plugin-email` installed in you Strapi project.
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# using yarn
|
|
39
|
+
yarn add strapi-provider-email-sendmail
|
|
40
|
+
|
|
41
|
+
# using npm
|
|
42
|
+
npm install strapi-provider-email-sendmail --save
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Configuration
|
|
46
|
+
|
|
47
|
+
| Variable | Type | Description | Required | Default |
|
|
48
|
+
| ----------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------ | -------- | --------- |
|
|
49
|
+
| provider | string | The name of the provider you use | yes | |
|
|
50
|
+
| providerOptions | object | Will be directly given to `require('sendmail')`. Please refer to [sendmail](https://www.npmjs.com/package/sendmail) doc. | no | {} |
|
|
51
|
+
| settings | object | Settings | no | {} |
|
|
52
|
+
| settings.defaultFrom | string | Default sender mail address | no | undefined |
|
|
53
|
+
| settings.defaultReplyTo | string \| array | Default address or addresses the receiver is asked to reply to | no | undefined |
|
|
54
|
+
| providerOptions.dkim | object \| boolean | DKIM parameters having two properties: { privateKey, keySelector } | no | false |
|
|
55
|
+
|
|
56
|
+
> :warning: The Shipper Email (or defaultfrom) may also need to be changed in the `Email Templates` tab on the admin panel for emails to send properly
|
|
57
|
+
|
|
58
|
+
### Example
|
|
59
|
+
|
|
60
|
+
**Path -** `config/plugins.js`
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
module.exports = ({ env }) => ({
|
|
64
|
+
// ...
|
|
65
|
+
email: {
|
|
66
|
+
provider: 'sendmail',
|
|
67
|
+
settings: {
|
|
68
|
+
defaultFrom: 'myemail@protonmail.com',
|
|
69
|
+
defaultReplyTo: 'myemail@protonmail.com',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
// ...
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Example with DKIM
|
|
77
|
+
|
|
78
|
+
Using **DKIM** (DomainKeys Identified Mail) can prevent emails from being considered as spam. More details about this subject can be found in the discussion on the Strapi forum: [Unsolved problem: emails goes to spam!](https://forum.strapi.io/t/unsolved-problem-emails-goes-to-spam/512?u=soringfs)
|
|
79
|
+
|
|
80
|
+
#### Generate the keys using OpenSSL
|
|
81
|
+
|
|
82
|
+
```perl
|
|
83
|
+
openssl genrsa -out dkim-private.pem 1024
|
|
84
|
+
openssl rsa -in dkim-private.pem -pubout -out dkim-public.pem
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Path -** `config/plugins.js`
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
module.exports = ({ env }) => ({
|
|
91
|
+
// ...
|
|
92
|
+
email: {
|
|
93
|
+
provider: 'sendmail',
|
|
94
|
+
providerOptions: {
|
|
95
|
+
dkim: {
|
|
96
|
+
privateKey: 'replace-with-dkim-private-key',
|
|
97
|
+
keySelector: 'abcd', // the same as the one set in DNS txt record, use online dns lookup tools to be sure that is retreivable
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
settings: {
|
|
101
|
+
defaultFrom: 'myemail@protonmail.com',
|
|
102
|
+
defaultReplyTo: 'myemail@protonmail.com',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
// ...
|
|
106
|
+
});
|
|
107
|
+
```
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const sendmailFactory = require('sendmail');
|
|
4
|
+
const { removeUndefined } = require('@akemona-org/strapi-utils');
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
init: (providerOptions = {}, settings = {}) => {
|
|
8
|
+
const sendmail = sendmailFactory({
|
|
9
|
+
silent: true,
|
|
10
|
+
...providerOptions,
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
send: (options) => {
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
const { from, to, cc, bcc, replyTo, subject, text, html, ...rest } = options;
|
|
16
|
+
|
|
17
|
+
let msg = {
|
|
18
|
+
from: from || settings.defaultFrom,
|
|
19
|
+
to,
|
|
20
|
+
cc,
|
|
21
|
+
bcc,
|
|
22
|
+
replyTo: replyTo || settings.defaultReplyTo,
|
|
23
|
+
subject,
|
|
24
|
+
text,
|
|
25
|
+
html,
|
|
26
|
+
...rest,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
sendmail(removeUndefined(msg), (err) => {
|
|
30
|
+
if (err) {
|
|
31
|
+
reject(err);
|
|
32
|
+
} else {
|
|
33
|
+
resolve();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@akemona-org/strapi-provider-email-sendmail",
|
|
3
|
+
"publishConfig": {
|
|
4
|
+
"access": "public"
|
|
5
|
+
},
|
|
6
|
+
"version": "3.7.0",
|
|
7
|
+
"description": "Sendmail provider for strapi email",
|
|
8
|
+
"homepage": "https://strapi.akemona.com",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"email",
|
|
11
|
+
"strapi"
|
|
12
|
+
],
|
|
13
|
+
"directories": {
|
|
14
|
+
"lib": "./lib"
|
|
15
|
+
},
|
|
16
|
+
"main": "./lib",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@akemona-org/strapi-utils": "3.7.0",
|
|
19
|
+
"sendmail": "^1.6.1"
|
|
20
|
+
},
|
|
21
|
+
"strapi": {
|
|
22
|
+
"isProvider": true
|
|
23
|
+
},
|
|
24
|
+
"author": {
|
|
25
|
+
"email": "strapi@akemona.com",
|
|
26
|
+
"name": "Akemona team",
|
|
27
|
+
"url": "https://strapi.akemona.com"
|
|
28
|
+
},
|
|
29
|
+
"maintainers": [
|
|
30
|
+
{
|
|
31
|
+
"name": "Akemona team",
|
|
32
|
+
"email": "strapi@akemona.com",
|
|
33
|
+
"url": "https://strapi.akemona.com"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git://github.com/akemona/strapi.git"
|
|
39
|
+
},
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/akemona/strapi/issues"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=10.16.0 <=14.x.x",
|
|
45
|
+
"npm": ">=6.0.0"
|
|
46
|
+
},
|
|
47
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
48
|
+
"scripts": {
|
|
49
|
+
"test": "echo \"no tests yet\""
|
|
50
|
+
},
|
|
51
|
+
"gitHead": "129a8d6191b55810fd66448dcc47fee829df986c"
|
|
52
|
+
}
|