npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mailhound

v3.0.0

Published

Mailhound is a simple server side script for receiving form posts and emailing the form values.

Downloads

20

Readme

mailhound

Mailhound is a simple server side script for receiving form posts and emailing the form values.

Installation

Prerequisites

  1. Create an account with a mail provider like Mailgun or Sendgrid

Heroku Install (Free)

Deploy

  1. Give your app a name: blogemailsender
  2. Choose your server region: United States
  3. Set your environment variables:
  4. ADMIN: Enter your email
  5. SMTP: Your smtp credentials
  6. Deploy for Free!

Digital Ocean Install ($10 Credit)

  1. Create a new droplet using the Node application image
  2. SSH into your newly created droplet
  3. Install mailhound with npm install -g mailhound
  4. Add config variable exports to the end of your ~/.profile file
  5. export SMTP=smtp://postmaster:[email protected]
  6. export [email protected]
  7. Reconnect to SSH and run the script mailhound

Docker

Create the config file .env from .env.example with your environment variables

  1. Run with docker-
  • docker run --env-file=<path to the config file .env> -p 8000:8000 chadfawcett/mailhound
  1. Run with docker compose-
  • docker-compose up

Usage

Typical Setup

<form method="POST" action="http://heroku.url.com?key=ADMIN">
  <input type="text" name="name" placeholder="Name">
  <input type="email" name="_replyto" placeholder="Email">
  <textarea name="message" placeholder="Message" cols="30" rows="8"></textarea>
  <input type="submit" value="Send">
</form>

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.

Main Message

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.

<textarea name="message"></textarea>

Email Subject

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.

<!-- User defined subject -->
<input type="text" name="_subject" />

<!-- Static subject -->
<input type="hidden" name="_subject" value="New message from my website!" />

Reply To

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.

<!-- Basic reply to field -->
<input type="email" name="_replyto" />

<!-- Option for better auto completion -->
<input type="email" name="email" />

Name

This field is simply for the emailer's name.

<input type="text" name="name" />

CC

This field allows you for the user to specify an address to get a cc'd copy of the form.

<input type="text" name="_cc" />

Redirect

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.

<input type="hidden" name="_next" value="http://example.com/thanks" />

Advanced Usage

Custom Keys

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.

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.

{
  "newsletter": "[email protected]"
}

Now when you create your newsletter sign up form, simply use the same action url with the new key.

<form method="POST" action="http://heroku.url.com?key=newsletter">
  <input type="text" name="name" placeholder="Name">
  <input type="email" name="_replyto" placeholder="Email">
  <input type="submit" value="Sign me up!">
</form>

Custom Fields

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.

<input type="tel" name="_fields.cellNumber">

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

Cell number: ### ### ####

Spam Filtering

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.

Simply add the following to your form to prevent spam:

  <input type="text" name="_gotcha" style="display: none">

Contributing

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!

License

This software is free to use under the MIT license. See the LICENSE file fore more details.