simple-sendmail
v1.0.22
Published
Send emails with different contexts using beautiful templates for common scenarios such as email confirmation and email recovery
Downloads
2
Maintainers
Readme
simpleSend
This tool will help you optimize the process of sending recurring emails such as email confirmation and password recovery.
Who has never needed to create an email confirmation or password recovery system? Well, this tool aims to make the life of us developers easier, bringing beautiful and easily deliverable templates with minimal configuration.
DISCLAIMER
The app is still in alpha, so it may not work as expected. If you find any bugs or has an suggestion, please report them in the issues section.
template 01 - recovery password
template 01 - Confirm Email
use Examples
Simple Sendmail
Installation You can install Simple Sendmail using npm:
npm install simple-sendmail
confirm Email Example
import simpleSend, {Message, Config} from "simple-sendmail";
import Template, {ConfirmEmail} from 'simple-sendmail/dist/templates/template';
Usage
Creating an Email Template Here you can choose the language for the email text. If not specified, it will be sent in English. Options: 'en' and 'pt'.
const template:Template = new Template();
Configuring Email Options Each template (HTML) has its own options. For the 'confirmEmail' template, there are only two options, with the title being optional.
const confirmEmailOptions: ConfirmEmail = {
title: 'Please confirm your e-mail', // optional
confirmationCode: 999999 // mandatory
};
Configuring Email Settings This tool uses nodemailer for sending emails, so you need to configure it accordingly.
// Node mailer configuration
const config: Config = {
host: "your_host.com",
port: 999,
auth: {
user: '[email protected]',
pass: 'your_password'
}
};
Creating the Email Message
const message: Message = {
from: '[email protected]', // mandatory
to: '[email protected]', // mandatory
subject: "<only a test>", // optional
html: template.confirmEmail(confirmEmailOptions) // choose the template and its options here
};
Sending the Email
const sender = new simpleSend(config);
sender.send(message);