Most Web Framework Mailer Module
Last updated 9 months ago by themost .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @themost/mailer 
SYNC missed versions from official npm registry.


Most Web Framework Mailer simplifies mail operations inside in a MOST web application.

Install with npm

npm install @themost/mailer

Note: If you want to install the previous version (0.1.x) of most-web-mailer module use:

npm install most-web-mailer

Use most-web-mailer to send an html static email:

var mm = require('most-web-mailer'), 
web = require('most-web');
//init mail in the current HTTP context
    .subject('Hello from user')
    .body('<p style="color:#0040D0">Hello World</p>').send({}, function(err) {

You can use default mail transporter as it is defined in application configuration section settings#mail. In this case you can omit transporter initialization. Here is the section as may be defined in application configuration:

"settings": {
  "mail": {
      "from": "user@example.com"
      "auth": {

Note: MOST Web Framework Mailer uses nodemailer as sender engine.

MOST Web Framework Mailer gives you also the opportunity to send dynamic mail templates by using the registered view engines. So, create a folder in app/templates/mails directory

+ app
  + templates
    + mails
      + my-first-template

Create a file named html.ejs (Note: EJS is the default view engine for every MOST Web Framework application):

      <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/css/bootstrap.css" />
        <div class="page-header">
            <h1>MOST Web Framework Team</h1>
        <p>Hello <%=model.name%></p>

Finally send dynamic mail template:

import mailer from '@themost/mailer';
//init mail in the current HTTP context
    .subject('Hello from user')
    .template('my-first-template').send({ name: 'George' }, (err)=> {

Current Tags

  • 2.1.4                                ...           latest (9 months ago)

5 Versions

  • 2.1.4                                ...           9 months ago
  • 2.1.3                                ...           9 months ago
  • 2.1.2                                ...           9 months ago
  • 2.1.1                                ...           2 years ago
  • 2.0.1                                ...           2 years ago
Maintainers (1)
Today 0
This Week 1
This Month 1
Last Day 1
Last Week 0
Last Month 2
Dependencies (2)
Dev Dependencies (3)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |