Skip to content

Instantly share code, notes, and snippets.

@shiny
Created September 15, 2013 04:58
Show Gist options
  • Save shiny/6568144 to your computer and use it in GitHub Desktop.
Save shiny/6568144 to your computer and use it in GitHub Desktop.
send mail from mailgun. # how to use 1. npm install request 2. change: your mailgun api key; change your domain in request url
request = require 'request'
form =
from: 'shiguanglu <sys@shiguanglu.com>'
to: 'testuser <ice.shiny@gmail.com>'
subject: 'this is a test mail'
text: 'test mail body'
auth =
user: 'api'
password: 'YOUR API KEY FROM MAILGUN'
request.post 'https://api.mailgun.net/v2/samples.mailgun.org/messages',{form: form , auth:auth }, (e, r, body)->
console.log e
console.log body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment