Socket
Socket
Sign inDemoInstall

github.com/jmoiron/contact-form

Package Overview
Dependencies
0
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/jmoiron/contact-form


Version published

Readme

Source

contact-form

license

A simple stand-alone web server which implements a contact form on an otherwise static website.

Contains code from Alex Edward's Form Validation blog post which is licensed under the MIT licence.

usage

If you run contact-form in a directory, it will serve up everything in that directory as a static file in the same way a server like nginx or apache would, defaulting to index.html when a "directory" is accessed.

It also sets up a listener on /contact/, which does a few things:

  • You can POST with email, subject, and message to attempt to send an email. This returns a json message {"success": true} on success and {"success": false, "error": "<an error message"} on failure.

  • If there are validation erorrs on particular fields (eg message length, invalid email address, etc.), then those fields will have an error message in the returned json, eg: {"email": "invalid email address"}.

spam control

By default, contact-form will check incoming messages against the postmark spamcheck API. If you do not want this, or it gets discontinued or changed, you can disable this with the -nospam flag or an environ variable.

configuring

You can use the following environment variables to control the way that contact-form behaves and sends email.

CONTACT_PORT        listener http port
CONTACT_NOSPAM      if set, do not check messages for spam
CONTACT_MAILPORT    outgoing mail server port
CONTACT_MAILHOST    outgoing mail server host
CONTACT_MAILUSER    outgoing mail server username
CONTACT_MAILPASS    outgoing mail server passsword
CONTACT_DESTEMAIL   destination email address for messages

FAQs

Last updated on 23 Mar 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc