mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 03:17:11 +00:00
Add: plugin: strapi-email-amazon-ses.
This commit is contained in:
parent
dc9dfa71da
commit
b73e3561f5
16
packages/strapi-email-amazon-ses/.editorconfig
Normal file
16
packages/strapi-email-amazon-ses/.editorconfig
Normal file
@ -0,0 +1,16 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[{package.json,*.yml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
96
packages/strapi-email-amazon-ses/.gitignore
vendored
Normal file
96
packages/strapi-email-amazon-ses/.gitignore
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
############################
|
||||
# OS X
|
||||
############################
|
||||
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
Icon
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
._*
|
||||
|
||||
|
||||
############################
|
||||
# Linux
|
||||
############################
|
||||
|
||||
*~
|
||||
|
||||
|
||||
############################
|
||||
# Windows
|
||||
############################
|
||||
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
Desktop.ini
|
||||
$RECYCLE.BIN/
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
|
||||
############################
|
||||
# Packages
|
||||
############################
|
||||
|
||||
*.7z
|
||||
*.csv
|
||||
*.dat
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.seed
|
||||
*.so
|
||||
*.swo
|
||||
*.swp
|
||||
*.swn
|
||||
*.swm
|
||||
*.out
|
||||
*.pid
|
||||
|
||||
|
||||
############################
|
||||
# Logs and databases
|
||||
############################
|
||||
|
||||
.tmp
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
|
||||
|
||||
############################
|
||||
# Misc.
|
||||
############################
|
||||
|
||||
*#
|
||||
.idea
|
||||
nbproject
|
||||
|
||||
|
||||
############################
|
||||
# Node.js
|
||||
############################
|
||||
|
||||
lib-cov
|
||||
lcov.info
|
||||
pids
|
||||
logs
|
||||
results
|
||||
build
|
||||
node_modules
|
||||
.node_history
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
104
packages/strapi-email-amazon-ses/.npmignore
Normal file
104
packages/strapi-email-amazon-ses/.npmignore
Normal file
@ -0,0 +1,104 @@
|
||||
############################
|
||||
# OS X
|
||||
############################
|
||||
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
Icon
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
._*
|
||||
|
||||
|
||||
############################
|
||||
# Linux
|
||||
############################
|
||||
|
||||
*~
|
||||
|
||||
|
||||
############################
|
||||
# Windows
|
||||
############################
|
||||
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
Desktop.ini
|
||||
$RECYCLE.BIN/
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
|
||||
############################
|
||||
# Packages
|
||||
############################
|
||||
|
||||
*.7z
|
||||
*.csv
|
||||
*.dat
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.seed
|
||||
*.so
|
||||
*.swo
|
||||
*.swp
|
||||
*.swn
|
||||
*.swm
|
||||
*.out
|
||||
*.pid
|
||||
|
||||
|
||||
############################
|
||||
# Logs and databases
|
||||
############################
|
||||
|
||||
.tmp
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
|
||||
|
||||
############################
|
||||
# Misc.
|
||||
############################
|
||||
|
||||
*#
|
||||
ssl
|
||||
.editorconfig
|
||||
.gitattributes
|
||||
.idea
|
||||
nbproject
|
||||
|
||||
|
||||
############################
|
||||
# Node.js
|
||||
############################
|
||||
|
||||
lib-cov
|
||||
lcov.info
|
||||
pids
|
||||
logs
|
||||
results
|
||||
build
|
||||
node_modules
|
||||
.node_history
|
||||
|
||||
|
||||
############################
|
||||
# Tests
|
||||
############################
|
||||
|
||||
test
|
||||
7
packages/strapi-email-amazon-ses/LICENSE.md
Normal file
7
packages/strapi-email-amazon-ses/LICENSE.md
Normal file
@ -0,0 +1,7 @@
|
||||
Copyright (c) 2018 Nikolay Tsenkov (nikolay@tsenkov.net).
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
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 SOFTWARE.
|
||||
11
packages/strapi-email-amazon-ses/README.md
Normal file
11
packages/strapi-email-amazon-ses/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# strapi-email-amazon-ses
|
||||
|
||||
## Resources
|
||||
|
||||
- [MIT License](LICENSE.md)
|
||||
|
||||
## Links
|
||||
|
||||
- [Strapi website](http://strapi.io/)
|
||||
- [Strapi community on Slack](http://slack.strapi.io)
|
||||
- [Strapi news on Twitter](https://twitter.com/strapijs)
|
||||
77
packages/strapi-email-amazon-ses/lib/index.js
Normal file
77
packages/strapi-email-amazon-ses/lib/index.js
Normal file
@ -0,0 +1,77 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
/* eslint-disable import/no-unresolved */
|
||||
/* eslint-disable prefer-template */
|
||||
// Public node modules.
|
||||
const _ = require('lodash');
|
||||
const nodeSES = require('node-ses');
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
module.exports = {
|
||||
provider: 'amazon-ses',
|
||||
name: 'Amazon SES',
|
||||
auth: {
|
||||
amazon_ses_default_from: {
|
||||
label: 'Amazon SES Default From',
|
||||
type: 'text'
|
||||
},
|
||||
amazon_ses_default_replyto: {
|
||||
label: 'Amazon SES Default Reply-To',
|
||||
type: 'text'
|
||||
},
|
||||
amazon_ses_api_key: {
|
||||
label: 'Amazon SES API Key',
|
||||
type: 'text'
|
||||
},
|
||||
amazon_ses_secret: {
|
||||
label: 'Amazon SES Secret',
|
||||
type: 'text'
|
||||
},
|
||||
amazon_ses_endpoint: {
|
||||
label: 'Amazon SES Endpoint',
|
||||
type: 'text'
|
||||
}
|
||||
},
|
||||
init: (config) => {
|
||||
|
||||
var client = nodeSES.createClient({
|
||||
key: config.amazon_ses_api_key,
|
||||
secret: config.amazon_ses_secret,
|
||||
amazon: config.amazon_ses_endpoint || null
|
||||
});
|
||||
|
||||
return {
|
||||
send: (options, cb) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// Default values.
|
||||
options = _.isObject(options) ? options : {};
|
||||
options.from = options.from || config.amazon_ses_default_from;
|
||||
options.replyTo = options.replyTo || config.amazon_ses_default_replyto;
|
||||
options.text = options.text || options.html;
|
||||
options.html = options.html || options.text;
|
||||
|
||||
let msg = {
|
||||
from: options.from,
|
||||
to: options.to,
|
||||
replyTo: options.replyTo,
|
||||
subject: options.subject,
|
||||
altText: options.text,
|
||||
message: options.html
|
||||
};
|
||||
|
||||
nodeSES.sendEmail(msg, function (err) {
|
||||
if (err) {
|
||||
reject([{ messages: [{ id: 'Auth.form.error.email.invalid' }] }]);
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
45
packages/strapi-email-amazon-ses/package.json
Normal file
45
packages/strapi-email-amazon-ses/package.json
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "strapi-email-amazon-ses",
|
||||
"version": "3.0.0-alpha.12.7.1",
|
||||
"description": "Amazon SES provider for strapi email",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
"email",
|
||||
"strapi",
|
||||
"amazon",
|
||||
"ses"
|
||||
],
|
||||
"directories": {
|
||||
"lib": "./lib"
|
||||
},
|
||||
"main": "./lib",
|
||||
"dependencies": {
|
||||
"node-ses": "^2.1.0"
|
||||
},
|
||||
"strapi": {
|
||||
"isProvider": true
|
||||
},
|
||||
"author": {
|
||||
"email": "nikolay@tsenkov.net",
|
||||
"name": "Nikolay tsenkov"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Strapi team",
|
||||
"email": "hi@strapi.io",
|
||||
"url": "http://strapi.io"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/strapi/strapi.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/strapi/strapi/issues"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 9.0.0",
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user