GithubHelp home page GithubHelp logo

mailgunner's Introduction

Mailgunner - A lightweight Node.js Mailgun Server

Written to act as a lightweight API companion alongside other applications.

Example: a perfect use-case would be when used in conjunction with a Ghost blog hosted on the same server instance. Ghost would post an ajax call to the server which acts as an API which then communicates directly with the mailgun API on your behalf.

This lightweight API could also be used as a middle-man to host your pre-configured email templates.

Getting Started

To get up and running with the mailgunner server is really straightforward. First, make sure you have npm installed (you'll need that for working with node so I'll assume you already have node package manager installed).

You can then install mailgunner by just running the following command from the root:

npm install

Once done get pm2 (it's a process manager and it's handy for starting your app and viewing logs etc.) installed:

npm install -g pm2

You can also use forever or nodemon etc.

Before mailgunner can be started you need to setup the config. By default it's called default.json and is located in the config/ directory.

Your default.json should contain:

{
  "Mailgun": {
    "apiKey": "YOUR_PRIVATE_API_KEY",
    "domain": "yourdomain.com",
    "sender": "[email protected]"
  }
}

Once you have that setup you should be good to start Mailgunner using pm2:

pm2 start bin/www.js --name mailgunner

You can see if it's started correctly by looking at the logs:

pm2 logs mailgunner

If it's started okay you should see something similar to this:

mailgunner-10 (out): Express server listening on port 3032

I found that the default port 3030 didn't work for me (because I already had an app running on 3030) so you can change the port by passing a PORT env variable when running it e.g.

PORT=3032 pm2 start bin/www.js --name mailgunner

API

POST /api/submit/:mail

Parameters: :mail - where you want to send the email to

Body:

{
	"name": "James Murphy",
	"email": "[email protected]",
	"subject": "Checking mailgunner works",
	"htmlBody": "<html><h1>Yup, looks like it works!</h1><p>This is a paragraph</p></html>"
}

Headers:

Content-Type: application/json

Response:

200 OK

You should be all set up now. All you need to do is copy this application and start it wherever you want a local server.

Let me know if you've got any feedback about it or feature requests!

HuBoard - Github Task Tracking

HuBoard - Task Tracking

letsencrypt

To use with letsencrypt, run the following command from the directory where letsencrypt is installed:

./letsencrypt-auto certonly --webroot -w /var/www/mailgunner/ -d mailgun.example.com

Once the certificate has been generated, uncomment the relevant lines in the nginx conf for the mailgun server.

Don't forget to add a CNAME record for your domain.

To auto renew the letsencrypt certificate (they expire every three months), add the following command to your crontab:

./letsencrypt-auto certonly --renew --webroot -w /var/www/mailgunner/ -d mailgun.example.com

If the certificate failed to generate, you may need to manually create the .well-known folder in the mailgunner root directory:

mkdir .well-known

and then add the acme-challenge directory:

cd .well-known
mkdir acme-challenge

mailgunner's People

Contributors

murphyj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

martincarlin87

mailgunner's Issues

checking the PM2 logs gives me this

I'm on Ubuntu 14.04
NPM 2.15
Node 4.4.7

mailgunner-0 (err):     at Function.Module._load (module.js:276:25)
mailgunner-0 (err):     at Function._load (/usr/lib/node_modules/pm2/node_modules/pmx/lib/transaction.js:62:21)
mailgunner-0 (err):     at Module.require (module.js:353:17)
mailgunner-0 (err):     at require (internal/module.js:12:17)
mailgunner-0 (err):     at Object.<anonymous> (/var/www/mailgunner/app.js:3:12)
mailgunner-0 (err):     at Module._compile (module.js:409:26)
mailgunner-0 (err):     at Object.Module._extensions..js (module.js:416:10)
mailgunner-0 (err):     at Module.load (module.js:343:32)
mailgunner-0 (err):     at Function.Module._load (module.js:300:12)
mailgunner-0 (err): Error: Cannot find module 'cors'
mailgunner-0 (err):     at Function.Module._resolveFilename (module.js:325:15)
mailgunner-0 (err):     at Function.Module._load (module.js:276:25)
mailgunner-0 (err):     at Function._load (/usr/lib/node_modules/pm2/node_modules/pmx/lib/transaction.js:62:21)
mailgunner-0 (err):     at Module.require (module.js:353:17)
mailgunner-0 (err):     at require (internal/module.js:12:17)
mailgunner-0 (err):     at Object.<anonymous> (/var/www/mailgunner/app.js:3:12)
mailgunner-0 (err):     at Module._compile (module.js:409:26)
mailgunner-0 (err):     at Object.Module._extensions..js (module.js:416:10)
mailgunner-0 (err):     at Module.load (module.js:343:32)
mailgunner-0 (err):     at Function.Module._load (module.js:300:12)

front end ?

hi
can you pls provide front end part ?

thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.