Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
HTTP API for contacting you via e-mail as a node.js module!
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
.travis.yml
LICENSE
README.md
example.js
index.js
package.json
test.js

README.md

contact-you  Build Status

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

Install

npm install contact-you --save

Usage

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: 'auto@matteocollina.com'
      , to: 'hello@matteocollina.com'
      , 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": "aaa@matteocollina.com" }' 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')({ ... })

License

MIT

Something went wrong with that request. Please try again.