Emailer
Email server for EpochTalk Frontend.
Installation and Configuration
- Checkout repository using git:
$ git clone git@github.com:epochtalk/emailer.git
- Change directories and install dependencies using npm
$ cd emailer$ npm install
- Add and set the following configs to a
.env
file.
SMTP_HOST=smtp.example.comSMTP_USER=info@example.comSMTP_PASS=password
- Run the server using foreman
$ foreman start -f Profile
Adding Templates
- Create an html template using doT notation for parameters
- Place html file in
/templates
folder - Add export for new template to
emails.js
Example
Add Template File (templates/recover-account.html
)
Account Recovery Recover your account by visiting the link below and resetting your password: Username: {{=it.username}} Password: Reset
Add Template Export to email.js
exportsrecoverAccount = schema: username: joi reset_url: joi email: joi { var template = doT; return from: configsenderEmail to: paramsemail subject: '[EpochTalk] Account Recovery' html: ; };
schema
- validation schema for email template paramscompile
- returns email object with compiled template
Call Server
Call the emailer server using a library that supports unix domain sockets like request.
var request = ; var params = username: 'john' email: 'john@example.com' reset_url: 'http://localhost:8080/reset/john/123412412412412'; request;