Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
chris-parse-smtp-template
Advanced tools
Readme
An easy way to send email templates via SMTP with your Parse Server!
(Multi Language Support)
Report Bug
·
Request Feature
This is a module made it for Parse Server and an easy solution to send emails via SMTP with templates in HTML, also with the posibility of use a multi language support for your templates.
We recomend you to use the Cerberus project for the email templates.
( if you know about other templates you can added )
This module is a very simple solution and because of that you can get it up and running in a few minutes.
npm
npm i parse-smtp-template
yarn
yarn add parse-smtp-template
var api = new ParseServer({
...
emailAdapter: {
module: 'parse-smtp-template',
options: {
port: 587,
host: "smtp.mail.com",
user: "name@domain.com",
password: "SecurePassword",
fromAddress: 'app@domain.com'
}
}
})
Now is ready to use!
--
In this module you can choise to use a simple template (1 template for bouth emails) or multiTemplate (1 template per type of email) If you want to use the multi Language mode you need to set up the multi languaje mode.
Use it, it´s very easy 😎😃👌
This template is used to send bouth email (password recovery and email confirmation)
The templates have access to 6 parameters :
To use it you only need to write ${parameter}
on the template
If you want a custome template is necessary to select the correct file.
In this example we are gonna use template.html
index.js
emailAdapter: {
module: 'parse-smtp-template',
options: {
...
template: true,
templatePath: "views/templates/template.html",
// Custome options to your emails
// You can add more options if you need
passwordOptions: {
subject: "Password recovery",
body: "Custome pasword recovery email body",
btn: "Recover your password"
/* --EXTRA PARAMETERS--
others: {
extraParameter
}
*/
},
confirmOptions: {
subject: "E-mail confirmation",
body: "Custome email confirmation body",
btn: "confirm your email"
},
}
}
To use the extra parameters please use
${options.extraParameter}
directory
project
│ index.js
│
└─ views
│ └─ templates
│ └─ template.html
|
└─ node_modules
|
template.html
...
<tr>
<td style="padding: 20px; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555;">
<h1 style="margin: 0 0 10px; font-size: 25px; line-height: 30px; color: #333333; font-weight: normal;"> ${subject} </h1>
<br>
<ul style="padding: 0; margin: 0; list-style-type: disc;">
<li style="margin:0 0 10px 30px;" class="list-item-first">App name: <b> ${appName} </b></li>
<li style="margin:0 0 10px 30px;">Username: <b> ${username} </b></li>
<li style="margin: 0 0 10px 30px;">link:</li>
<li style="margin: 0 0 0 30px;" class="list-item-last"> ${link} </li>
</ul>
</td>
</tr>
...
You can look up the template by default to get a better understanding
--
This option is a better way to customize your emails because you are able to use a different template per type of email.
This template have access to 7 parameters:
The options parameter needs to have subject, body and btn like minimun
index.js
emailAdapter: {
module: 'parse-smtp-template',
options: {
...
multiTemplate: true,
confirmTemplatePath: "views/templates/confirmTemplate.html",
passwordTemplatePath: "views/templates/passwordTemplate.html",
// Custome options to your emails
// You can add as much as you need
passwordOptions: {
subject: "Password recovery",
body: "Custome pasword recovery email body",
btn: "Recover your password"
/* --EXTRA PARAMETERS--
others: {
extraParameter
}
*/
},
confirmOptions: {
subject: "E-mail confirmation",
body: "Custome email confirmation body",
btn: "confirm your email"
},
}
}
To use the extra parameters please use ${options.extraParameter}
--
To be able to use Multi language is necesary set multiTemplate
and multiLang
true and pass the column name where the language is stored in the multiLangColumn
option. Default of multiLangColumn
is lang
.
multiLangColumn and the object needs to have the same value.
index.js
emailAdapter: {
module: 'parse-smtp-template',
options: {
...
multiTemplate: true,
confirmTemplatePath: "views/templates/confirmTemplate.html",
passwordTemplatePath: "views/templates/passwordTemplate.html",
multiLang: true,
multiLangColumn: "language", // Default is "lang".
multiLangPass: {
es: {
subject: "Recuperación de Contraseña",
body: "Cuerpo del correo de recuperación de contrseña",
btn: "recupera tu contraseña"
/* --EXTRA PARAMETERS--
others: {
extraParameter
}
*/
},
en: {
subject: "Password recovery",
body: "Password recovery email body",
btn: "Recover your password"
},
fr: {
subject: "Récupération du mot de passe",
body: "Corps de l'e-mail de récupération de mot de passe",
btn: "récupérer votre mot de passe"
}
},
multiLangConfirm: {
es: {
subject: "Confirmación de Correo",
body: "Cuerpo del correo de confirmación de correo",
btn: "confirma tu correo"
},
en: {
subject: "E-mail confirmation",
body: "Mail confirmation email body",
btn: "confirm your email"
},
fr: {
subject: "Mail de confirmation",
body: "Courriel de confirmation du corps de l'e-mail",
btn: "confirmez votre email"
}
},
// Default options if the lang of the user isn´t in some of the multiLanguage objects
passwordOptions: {
subject: "Password recovery",
body: "Custome pasword recovery email body",
btn: "Recover your password"
/* --EXTRA PARAMETERS--
others: {
extraParameter
}
*/
},
confirmOptions: {
subject: "E-mail confirmation",
body: "Custome email confirmation body",
btn: "confirm your email"
},
}
}
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)Distributed under the MIT License. See LICENSE
for more information.
Arturo Ortega - @MacarthurOr - arturo.ortegaro@gmail.com
Project Link: https://github.com/macarthuror/parse-smtp-template
FAQs
Parse Server Module to send emails via SMTP with a customizable template option and Multi Language
The npm package chris-parse-smtp-template receives a total of 2 weekly downloads. As such, chris-parse-smtp-template popularity was classified as not popular.
We found that chris-parse-smtp-template demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.