Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including contact-you with all npm packages installed. Try it out:

var contactYou = require("contact-you")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

contact-you v1.0.0

HTTP API for contacting you via e-mail as a node.js module!

contact-you  Build Status

HTTP API for contacting you via e-mail as a node.js module!


npm install contact-you --save


var mailer = require('nodemailer')
  , contact = require('contact-you')
  , http  = require('http')
  , transport = mailer.createTransport({
      // configure your nodemailer transport
  , server = http.createServer(contact({
        transport: transport
      , from: ''
      , to: ''
      , text: null
        // or you can pass a function that accepts the data object
        // and returns a string
  , port = 3000

server.listen(port, function() {
  console.log('http server listening on port', port)

To test, configure the nodemailer transport and then start it and send a POST request:

curl -X POST -d '{ "subject": "a subject", "text": "hello world", "from": "" }' http://localhost:3000

Usage with Express/Connect

contact-you supports express/connect, just use it a standard connect middleware:

var app = express()

app.use('/send', require('contact-you')({ ... })



RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free