Skip to content

Commit 49d5d2b

Browse files
committed
Merge pull request #23 from chadfawcett/add-to-readme
Update Readme
2 parents 828fa40 + 7eb5e14 commit 49d5d2b

File tree

1 file changed

+40
-12
lines changed

1 file changed

+40
-12
lines changed

README.md

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Mailhound is a simple server side script for receiving form posts and emailing t
1515
1. Give your app a name: `blogemailsender`
1616
2. Choose your server region: `United States`
1717
3. Set your environment variables:
18-
1. **ADMIN**: Enter your email
19-
2. **MANDRILL_API_KEY**: Paste in your api key
18+
1. **ADMIN**: Enter your email
19+
2. **MANDRILL_API_KEY**: Paste in your api key
2020
4. Deploy for **Free**!
2121

2222
### Digital Ocean Install ([$10 Credit](http://do.chadf.ca))
@@ -25,30 +25,58 @@ Mailhound is a simple server side script for receiving form posts and emailing t
2525
2. SSH into your newly created droplet
2626
3. Install mailhound with `npm install -g mailhound`
2727
4. Add config variable exports to the end of your `~/.profile` file
28-
1. `export MANDRILL_API_KEY=your_api_key`
29-
2. `export KEY:[email protected]`
28+
1. `export MANDRILL_API_KEY=your_api_key`
29+
2. `export KEY:[email protected]`
3030
5. Reconnect to SSH and run the script `mailhound`
3131

3232
## Usage
3333

34-
<form method="POST" action="http://heroku.url.com?key=ADMIN">
35-
<input type="text" name="name" placeholder="Name">
36-
<input type="email" name="_replyto" placeholder="Email">
37-
<textarea name="message" placeholder="Message" cols="30" rows="8"></textarea>
38-
<input type="submit" value="Send">
39-
</form>
34+
```html
35+
<form method="POST" action="http://heroku.url.com?key=ADMIN">
36+
<input type="text" name="name" placeholder="Name">
37+
<input type="email" name="_replyto" placeholder="Email">
38+
<textarea name="message" placeholder="Message" cols="30" rows="8"></textarea>
39+
<input type="submit" value="Send">
40+
</form>
41+
```
4042

4143
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.
4244

4345
## Advanced Usage
4446

47+
### Custom Keys
48+
The key associated with your email address does not have to be ADMIN. You're also not limited to only one key/email pair per server. Setting a new key/pair anywhere in the config variables, including in the `emails.json` file, will allow you to use that key in the action url of your contact form.
49+
50+
Let's say you want to have a newsletter signup form but you don't want the emails going to the same place as your contact form. Simply create your `email.json` file to have a key to send to your email for signing up.
51+
52+
```json
53+
{
54+
"newsletter": "[email protected]"
55+
}
56+
```
57+
58+
Now when you create your newsletter sign up form, simply use the same action url with the new key.
59+
60+
```html
61+
<form method="POST" action="http://heroku.url.com?key=newsletter">
62+
<input type="text" name="name" placeholder="Name">
63+
<input type="email" name="_replyto" placeholder="Email">
64+
<input type="submit" value="Sign me up!">
65+
</form>
66+
```
67+
68+
### Custom Fields
4569
You can add custom fields to be added to the end of your email message. Usefull for address, phone number, etc. All you have to do is set the input name to `_fields.` followed by a camel case sentence.
4670

47-
<input type="tel" name="_fields.cellNumber">
71+
```javascript
72+
<input type="tel" name="_fields.cellNumber">
73+
```
4874

4975
The above code will result in the following appended to the end of your email message:
5076

51-
Cell number: ### ### ####
77+
```
78+
Cell number: ### ### ####
79+
```
5280

5381
## Contributing
5482

0 commit comments

Comments
 (0)