parse-mail-smtp-adapter
v1.0.0
Published
Parse Server Mail Adapter for basic SMTP
Downloads
5
Maintainers
Readme
parse-mail-adapter-smtp-ejs
Parse Server Mail Adapter for basic SMTP
Installation
Install npm module in your parse server project
$ npm install --save parse-mail-smtp-adapter
$ yarn add parse-mail-smtp-adapter
Use
"use strict";
const Express = require('express');
const ParseServer = require('parse-server').ParseServer;
const app = Express();
const APP_PORT = 8080;
let api = new ParseServer({
appName: "Parse Test",
appId: "appid",
masterKey: "secret",
serverURL: "http://localhost:8080/parse",
publicServerURL: "http://localhost:8080/parse",
databaseURI: "mongodb://user:pass@host:27017/parse",
port: APP_PORT,
//This is the config for email adapter
emailAdapter: {
module: "parse-mail-smtp-adapter",
options: {
nodeMailerOptions: {
host: 'your.smtp.host',
port: 465,
secure: true, //True or false if you are using ssl
auth: {
user: '[email protected]',
pass: 'AwesomePassword',
}
// you can add here other custom props for nodemailer like "tls"...
},
defaultFrom: '[email protected]', // Use for ResetPassword, VerifyEmail
}
}
});
app.use('/parse', api);
app.listen(APP_PORT, function () {
console.log(`Parse Server Ready and listening on port ${APP_PORT}`);
});
Variables (resetPassword & verifyMail)
- appName //This is the name of your parse app
- link //This is the link for reset the password
- user //This is a Parse object of the current user
Send Mail From Cloud Code
Parse.Cloud.sendEmail({
from: "[email protected]",
to: "[email protected]",
subject: "my Subejct",
html: "",
text: "", // Email Text
data: {} // data gives to ejs
});