1.0.14 • Published 3 years ago
@volodymyry/xsine-mailer v1.0.14
concured-modules-library
NPM package for our modules that will be reused in multiple part of the code.
List of modules
- Mailer
- ...
Publish to NPM
- change a version of the library in package.json
npm run build
npm publish
npm publish --access=public
- for public access
Use and Setup
To install the library use the following command
npm install --save @volodymyry/xsine-mailer
Mailer module
Important The module supports only SMTP connection at the moment
The mailer can be declared globally as a singleton.
The Mailer class has a private constructor, use specific (only SMTP enabled for now) builders to initialize the instance
import {Mailer} from "@volodymyry/xsine-mailer";
mailer = new Mailer.SMTPMailerBuilder()
.setSenderName("Concured")
.setSenderMail("support@concured.com")
.setOptions({
service: "gmail",
auth: {
type: "",
user: '',
clientId: '',
clientSecret: '',
refreshToken: '',
accessToken: ''
}
}).build();
- setSenderName() - not required. default: "support@concured.com"
- setSenderName() - not required. default: Concured
- setOptions() - see SMTPTransport.Options interface
Sending emails:
- signup:
const context = {
to: "",
context: {
confirmEmailUrl: "",
name: ""
}
};
mailer.sendEmailConfirmationMail(context);
- reset-password:
const context = {
to: "",
context: {
resetPasswordUrl: "",
name: ""
}
};
mailer.sendResetPasswordMail(context);