@akemona-org/strapi-provider-email-sendgrid 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 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,77 @@
1
+ # strapi-provider-email-sendgrid
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-sendgrid`.
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-sendgrid` 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-sendgrid) and with the following name on NPM: `@strapi/provider-email-sendgrid`.
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-sendgrid
40
+
41
+ # using npm
42
+ npm install strapi-provider-email-sendgrid --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 | Provider options | yes | |
51
+ | providerOptions.apiKey | object | Api key given to the function setApiKey. Please refer to [@sendgrid/mail](https://www.npmjs.com/package/@sendgrid/mail) | yes | |
52
+ | settings | object | Settings | no | {} |
53
+ | settings.defaultFrom | string | Default sender mail address | no | undefined |
54
+ | settings.defaultReplyTo | string \| array<string> | Default address or addresses the receiver is asked to reply to | no | undefined |
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: 'sendgrid',
67
+ providerOptions: {
68
+ apiKey: env('SENDGRID_API_KEY'),
69
+ },
70
+ settings: {
71
+ defaultFrom: 'myemail@protonmail.com',
72
+ defaultReplyTo: 'myemail@protonmail.com',
73
+ },
74
+ },
75
+ // ...
76
+ });
77
+ ```
package/lib/index.js ADDED
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ const sendgrid = require('@sendgrid/mail');
4
+ const { removeUndefined } = require('@akemona-org/strapi-utils');
5
+
6
+ module.exports = {
7
+ init: (providerOptions = {}, settings = {}) => {
8
+ sendgrid.setApiKey(providerOptions.apiKey);
9
+
10
+ return {
11
+ send: (options) => {
12
+ return new Promise((resolve, reject) => {
13
+ const { from, to, cc, bcc, replyTo, subject, text, html, ...rest } = options;
14
+
15
+ let msg = {
16
+ from: from || settings.defaultFrom,
17
+ to,
18
+ cc,
19
+ bcc,
20
+ replyTo: replyTo || settings.defaultReplyTo,
21
+ subject,
22
+ text,
23
+ html,
24
+ ...rest,
25
+ };
26
+
27
+ sendgrid.send(removeUndefined(msg), function (err) {
28
+ if (err) {
29
+ reject(err);
30
+ } else {
31
+ resolve();
32
+ }
33
+ });
34
+ });
35
+ },
36
+ };
37
+ },
38
+ };
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@akemona-org/strapi-provider-email-sendgrid",
3
+ "version": "3.7.0",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "description": "Sendgrid provider for strapi email",
8
+ "homepage": "https://strapi.akemona.com",
9
+ "keywords": [
10
+ "email",
11
+ "strapi",
12
+ "sendgrid"
13
+ ],
14
+ "directories": {
15
+ "lib": "./lib"
16
+ },
17
+ "main": "./lib",
18
+ "dependencies": {
19
+ "@akemona-org/strapi-utils": "3.7.0",
20
+ "@sendgrid/mail": "6.4.0"
21
+ },
22
+ "strapi": {
23
+ "isProvider": true
24
+ },
25
+ "author": {
26
+ "email": "strapi@akemona.com",
27
+ "name": "Akemona team",
28
+ "url": "https://strapi.akemona.com"
29
+ },
30
+ "maintainers": [
31
+ {
32
+ "name": "Akemona team",
33
+ "email": "strapi@akemona.com",
34
+ "url": "https://strapi.akemona.com"
35
+ }
36
+ ],
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git://github.com/akemona/strapi.git"
40
+ },
41
+ "bugs": {
42
+ "url": "https://github.com/akemona/strapi/issues"
43
+ },
44
+ "engines": {
45
+ "node": ">=10.16.0 <=14.x.x",
46
+ "npm": ">=6.0.0"
47
+ },
48
+ "license": "SEE LICENSE IN LICENSE",
49
+ "scripts": {
50
+ "test": "echo \"no tests yet\""
51
+ },
52
+ "gitHead": "129a8d6191b55810fd66448dcc47fee829df986c"
53
+ }