Skip to content

Instantly share code, notes, and snippets.

@AleksMeshkov
Created February 5, 2013 10:43
Show Gist options
  • Save AleksMeshkov/4713659 to your computer and use it in GitHub Desktop.
Save AleksMeshkov/4713659 to your computer and use it in GitHub Desktop.
http = require 'http'
nodemailer = require 'nodemailer'
transport = nodemailer.createTransport 'SMTP',
host: 'smtp.....' # hostname
port: 25 # port for secure SMTP
auth:
user: 'user'
pass: 'password'
console.log 'SMTP Configured'
send = (cb) ->
message =
from: 'from....'
to: "to....."
subject: 'subject'
text: 'body'
transport.sendMail message, (error) ->
throw error if error
cb()
http.createServer (req, res) ->
res.writeHead 200, 'Content-Type': 'text/plain'
send () ->
res.end 'Done\n'
.listen process.env.VMC_APP_PORT || 1337, null
console.log 'Server running at http://127.0.0.1:1337/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment