node package manager


Sending mails over HTTP.


Sending mails over HTTP. Pigeon can be used as a library and a command line tool.

Install with npm:

$ npm install pigeon

Creating the server:

var Pigeon = require('pigeon');
var server = new Pigeon(config, secret).server();

The Pigeon class accepts two parameters, config and secret.

config is an object contains several email services:

    gmail: {
        type: "SMTP",
        host: "",
        port: 465,
        auth: {
            user: "",
            pass: "userpass"

Find more on Nodemailer

Special Key Name:

  1. qq, we will send emails to qq users with this address
  2. gmail, we will send emails to gmail users with this address

Start an HTTP server with the command line:

$ pigeon -c config.js -p 8000 -s mysecret

Now send your emails with a POST request to the /send url path:

Content-Type: application/json
X-Pigeon-Secret: mysecret

    "user": "",
    "title": "This is a testing email",
    "text": "Hello there"
  1. X-Pigeon-Secret: a secret token that is the same with your pigeon server
  2. Content-Type: content type must be in application/json

The POST request payload should in JSON format. Required fields:

  1. user: the receiver's email address
  2. title: subject title of the email

Email content is also required, but it can be:

  1. text: a plain text email
  2. html: a html text email
  3. content: pigeon will render a html data from the given content

Optional fields:

  1. cc: cc field in email
  2. bcc: bcc field in email
  3. headers: email headers

You can create a new repo, and use pigeon as a dependency.


var Pigeon = require('pigeon');
var server = new Pigeon({
    gmail: {
        service: "Gmail",
        sender: "Mr. Hook <>",
        auth: {
          user: "",
          pass: "password"
}, 'a-secret-token').server();


web: node app.js