Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mcollina/contact-you
HTTP API for contacting you via e-mail as a node.js module!
https://github.com/mcollina/contact-you
Last synced: 2 months ago
JSON representation
HTTP API for contacting you via e-mail as a node.js module!
- Host: GitHub
- URL: https://github.com/mcollina/contact-you
- Owner: mcollina
- License: mit
- Created: 2014-08-06T07:10:07.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-20T13:28:31.000Z (about 10 years ago)
- Last Synced: 2024-10-10T14:18:06.846Z (2 months ago)
- Language: JavaScript
- Size: 184 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
contact-you [![Build Status](https://travis-ci.org/mcollina/contact-you.png)](https://travis-ci.org/mcollina/contact-you)
===========HTTP API for contacting you via e-mail as a node.js module!
Install
-------```bash
npm install contact-you --save
```Usage
-----```js
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: '[email protected]'
, to: '[email protected]'
, text: null
// or you can pass a function that accepts the data object
// and returns a string
}))
, port = 3000server.listen(port, function() {
console.log('http server listening on port', port)
})
```To test, configure the [nodemailer](http://npm.im/nodemailer) transport
and then start it and send a POST request:```bash
curl -X POST -d '{ "subject": "a subject", "text": "hello world", "from": "[email protected]" }' http://localhost:3000
```Usage with Express/Connect
------------------contact-you supports express/connect, just use it a standard connect
middleware:```js
var app = express()app.use('/send', require('contact-you')({ ... })
```License
-------MIT