Skip to content
/ form2email Public

A 120-line Express server to turn POSTed form data into an email. Great for static websites with contact forms!

Notifications You must be signed in to change notification settings

zaz/form2email

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

form2email

Server Setup

  1. Upload this app to a server.
  2. Register for a Mailgun account (free up to 10,000 emails/month).
  3. Set your server's MAILGUN_API_KEY environment variable to your private Mailgun API key.
    • If this is not possible, edit the app.js line const apiKey =
  4. Run form2email using npm start
  5. Point a DNS record to your server, e.g. form2email.example.com

Website Setup

Simply add a contact form to any site as so:

<form action="https://form2email.example.com/john@anydomain.com" method="post">
	<textarea type="text" name="body" placeholder="Message" required></textarea>
	<input type="text" name="name" placeholder="Name" required>
<input type="text" name="company" placeholder="Company">
	<input type="email" name="email" placeholder="Email" required>
<input type="tel" name="tel" placeholder="Telephone">
	<input type="submit" value="SEND">
</form>

form2email will set "name" <email> as the Reply-To address unless a reply_to form value is specified.

Fields can be omitted or set to required as desired. form2email will add details in the footer as so:

--

name
company
email
tel

See also formspree: It works very similarly to form2email, but is more complicated, better tested, and allows for arbitrary form data. You can use their server https://formspree.io without registering, but their emails are branded.

About

A 120-line Express server to turn POSTed form data into an email. Great for static websites with contact forms!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published