Skip to content

Commit 217b356

Browse files
committed
Merge pull request #27 from chadfawcett/release-1.0.5
Release 1.0.5
2 parents 49d5d2b + fbe696f commit 217b356

File tree

3 files changed

+67
-4
lines changed

3 files changed

+67
-4
lines changed

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Mailhound is a simple server side script for receiving form posts and emailing t
3131

3232
## Usage
3333

34+
### Typical Setup
35+
3436
```html
3537
<form method="POST" action="http://heroku.url.com?key=ADMIN">
3638
<input type="text" name="name" placeholder="Name">
@@ -42,6 +44,62 @@ Mailhound is a simple server side script for receiving form posts and emailing t
4244

4345
Make sure to update the `action` url to be your Heroku app url, and the key should be `ADMIN` or a custom key that matches your config variables.
4446

47+
### Main Message
48+
49+
The main text message of your email. This field is usually a `<textarea>` with a `name="message"` set. This will default to '**No message was provided**' if the field is ommited.
50+
51+
```html
52+
<textarea name="message"></textarea>
53+
```
54+
55+
### Email Subject
56+
57+
This field allows you to set the subject of the email. Defaults to '**Email from mailhound**'. It is not always beneficial to allow the user to specify the subjet, in this case you can simply hide the field.
58+
59+
```html
60+
<!-- User defined subject -->
61+
<input type="text" name="_subject" />
62+
63+
<!-- Static subject -->
64+
<input type="hidden" name="_subject" value="New message from my website!" />
65+
```
66+
67+
### Reply To
68+
69+
The reply to field is meant for the user's email. It allows for simply replying to the email sent to you instead of having to copy the user's address to a new email.
70+
71+
```html
72+
<!-- Basic reply to field -->
73+
<input type="email" name="_replyto" />
74+
75+
<!-- Option for better auto completion -->
76+
<input type="email" name="email" />
77+
```
78+
79+
### Name
80+
81+
This field is simply for the emailer's name.
82+
83+
```html
84+
<input type="text" name="name" />
85+
```
86+
87+
### CC
88+
89+
This field allows you for the user to specify an address to get a cc'd copy of the form.
90+
91+
```html
92+
<input type="text" name="_cc" />
93+
```
94+
95+
### Redirect
96+
97+
By default, the script redirects to the page that sent the form. If you would like to redirect the user to a specific page after the form has been sent, simply specify the url in this hidden field.
98+
99+
```html
100+
<input type="hidden" name="_next" value="http://example.com/thanks" />
101+
```
102+
45103
## Advanced Usage
46104

47105
### Custom Keys
@@ -78,6 +136,14 @@ The above code will result in the following appended to the end of your email me
78136
Cell number: ### ### ####
79137
```
80138

139+
### Spam Filtering
140+
One of the downsides of having a contact form is that you will start receving lot's of spam (bots that automatically fill out forms). To combat this, mailhound supports a visually hidden field that when filled in, will silently fail. This will catch a lot of bots, keeping your inbox much cleaner.
141+
142+
Simply add the following to your form to prevent spam:
143+
```html
144+
<input type="text" name="_gotcha" style="display: none">
145+
```
146+
81147
## Contributing
82148

83149
Please feel free to create an issue with any bugs you find or any improvements you would like to share. Pull requests for new features are also very welcome!

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"body-parser": "^1.10.2",
2727
"express": "^4.11.1",
2828
"mandrill-api": "^1.0.41",
29-
"multer": "^0.1.7",
3029
"nconf": "^0.7.1"
3130
},
3231
"devDependencies": {

server.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
var express = require('express')
44
var bodyParser = require('body-parser');
5-
var multer = require('multer');
65
var mandrill = require('mandrill-api/mandrill');
76
var nconf = require('nconf');
87

@@ -18,7 +17,6 @@ var app = express();
1817
// Needed for 'req.body'
1918
app.use(bodyParser.json());
2019
app.use(bodyParser.urlencoded({ extended: true }));
21-
app.use(multer());
2220

2321
app.get('/', function(req, res) {
2422
res.sendFile(__dirname + '/index.html');
@@ -66,7 +64,7 @@ app.post('/', function(req, res) {
6664
var message = {
6765
'text': emailMessage || 'No message was provided',
6866
'subject': req.body._subject || 'Email from mailhound',
69-
'from_email': req.body._replyto,
67+
'from_email': req.body._replyto || req.body.email,
7068
'from_name': req.body.name,
7169
'to': [
7270
{

0 commit comments

Comments
 (0)