Skip to content

Commit

Permalink
Merge branch 'release/0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
DominusKelvin committed Mar 18, 2024
2 parents 32c5bb5 + 3f62214 commit 77f3194
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
20 changes: 5 additions & 15 deletions lib/private/mail/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ module.exports = {
description: 'The mailer to used.',
extendedDescription:
'The mailer should be configured properly in config/mails.js. If not specified, the default mailer in sails.config.mail.default will be used',
defaultsTo:
sails.config.mailer ||
sails.config.mail.default ||
process.env.MAIL_MAILER
defaultsTo: process.env.MAIL_MAILER || sails.config.mail.default
},
template: {
description:
Expand Down Expand Up @@ -82,7 +79,8 @@ module.exports = {
'An override for the default "from" email that\'s been configured.',
example: '[email protected]',
isEmail: true,
defaultsTo: sails.config.mail.from.address || process.env.MAIL_FROM_ADRESS
defaultsTo:
sails.config.mail.from.address || process.env.MAIL_FROM_ADDRESS
},

fromName: {
Expand Down Expand Up @@ -190,25 +188,18 @@ module.exports = {
const nodemailer = getModule('nodemailer')
var transporter = nodemailer.createTransport({
host:
sails.config[mailer]?.host ||
sails.config.mail.mailers[mailer]?.host ||
process.env.MAIL_HOST,
sails.config.mail.mailers[mailer]?.host || process.env.MAIL_HOST,
port:
sails.config[mailer]?.port ||
sails.config.mail.mailers[mailer]?.port ||
process.env.MAIL_PORT,
sails.config.mail.mailers[mailer]?.port || process.env.MAIL_PORT,
secure:
sails.config[mailer]?.secure ||
sails.config.mail.mailers[mailer]?.secure ||
process.env.MAIL_SECURE ||
false,
auth: {
user:
sails.config[mailer]?.username ||
sails.config.mail.mailers[mailer]?.username ||
process.env.MAIL_USERNAME,
pass:
sails.config[mailer]?.password ||
sails.config.mail.mailers[mailer]?.password ||
process.env.MAIL_PASSWORD
}
Expand All @@ -232,7 +223,6 @@ module.exports = {
case 'resend':
const { Resend } = getModule('resend')
const apiKey =
sails.config[mailer]?.apiKey ||
sails.config.mail.mailers[mailer]?.apiKey ||
process.env.RESEND_API_KEY
const resend = new Resend(apiKey)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sails-hook-mail",
"version": "0.0.9",
"version": "0.1.0",
"description": "The simple elegant way to send emails from a Sails application",
"main": "lib/sails-hook-mail.js",
"scripts": {
Expand Down

0 comments on commit 77f3194

Please sign in to comment.