GithubHelp home page GithubHelp logo

taisiias / formmailer Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 1.0 2.7 MB

HTTP server that emails data submitted on static website forms.

License: MIT License

TypeScript 57.17% HTML 42.74% JavaScript 0.08%
forms http nodejs smtp static-site

formmailer's People

Contributors

mitskevich avatar taisiias avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

formmailer's Issues

HTML emails

Add HTML emails support (along with plain-text version). Also, prepare a clean default HTML email template.

HTTPS connection

Optional HTTPS connection support. Document deployment in README.

Referrer is not shown in email body

[SMTP] > Content-Type: text/plain
[SMTP] > From: formmailer@localhost
[SMTP] > To: root@localhost
[SMTP] > Subject: Form submitted on
[SMTP] >  http://mydomain.com/form/page/contact/
[SMTP] > Message-ID: <cf53063f-481f-26b3-ca21-f0a46406c361@localhost>
[SMTP] > Content-Transfer-Encoding: 7bit
[SMTP] > Date: Tue, 12 Sep 2017 23:24:12 +0000
[SMTP] > MIME-Version: 1.0
[SMTP] > 
[SMTP] > Submitted user form was received by FormMailer server, see details below.
[SMTP] > 
[SMTP] > Referrer page: 
[SMTP] > 
[SMTP] > user_name: iii
[SMTP] > 
[SMTP] > 
[SMTP] > Submitter IP address: 127.0.0.1
[SMTP] > 

Interface for browsing sent emails history

Basic interface should display a simple table with following information:

  • When request was processed
  • Contents of request
  • Contents of generated email
  • Recipient address(es)
  • IP Address of user that has submitted the request
  • URL of the page that contains the submitted form

This interface should be provided by another HTTP server instance that has its own listening IP/port settings. That way it can be deployed inside local intranet.

Manual reCAPTCHA integration

https://www.google.com/recaptcha/intro/index.html

First, we add an optional reCaptchaSecret field to the configuration (string). If it is not set, ignore all spam-checking all together.

Next (if reCaptchaSecret is set), for each POST request, check POST field g-recaptcha-response. If it is provided, make a POST request to the URL https://www.google.com/recaptcha/api/siteverify as described in documentation. If reCapcha says that submission is spam, just return empty response.

Finally, add a boolean configuration field requireReCaptchaResponse (default: false). If it is enabled, receiver handler should always check g-recaptcha-response to be present in POST.

If requireReCaptchaResponse is enabled, but reCaptchaSecret is not provided, that's a configuration error (should be reported to user).

Add command to test email sending configuration / SSL error

When trying to use formMailer with a STARTTLS-secured submission service on port 587, it only outputs

[2019-03-25T11:18:50.635] [WARN] formMailer - Error in Connection Handler: Error: 140662448305984:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:252:

The blank line is included in the original. This error message will not help a lot in debugging the failed connection attempt. The credentials are tested to be working with other clients.

How may I continue from here?

Providing form name in email

Let's add a special input to HTML form: _formName. If it is provided, email should contain additional field (right after referrer):

Submitted form: {{_formName}}

Ability to send different forms to different recipients

First, user should add a dictionary similar to this one in the configuration file:

"formTargets": {
    "contact": "[email protected]",
    "support": ["[email protected]", "[email protected]"],
    "sales": {
        "recipient": "[email protected]",
        "subject": "Purchase inquiry submitted"
    }
}

After that, user will provide form's action URL in format http://formmailer.domain.com/submit/:formtarget where :formtarget is a key from this dictionary:

<form method="POST" action="http://formmailer.domain.com/submit/sales"> ...

FormMailer should use a corresponding recipient (and optionally a subject) instead of the default one.

Automatic reCAPTCHA

Way to integrate reCAPTCHA without modifying static site contents, no additional scripts/form changes.

SMTP Settings

Add all of SMTP settings to config according to Nodemailer documentation. Update README.

web interface loads indefinitely

When formMailer is bound to a local port, it will only respond to the public interface. Requests to the web interface will time out eventually.

[2019-03-25T11:25:25.084] [WARN] formMailer - Error in Connection Handler: Error: Incorrect request: / (GET)

This is a log from a request to the public interface. The request to the private web interface will not produce such an output, and the browser will keep on loading for a while.

This is the case with an installation that did not yet manage to send any email message, see #52. Inspecting the SQLite database on disk also reveals, that no data is stored there, either.

AJAX data request support

FormMailer should automatically determine if the contents of the request contain AJAX data by checking ContentType header (should be set to application/json or text/json).

Automated tesing

Set up automated testing. Test should at least include processing of a set of POST requests and use mock SMTP server to check if sent emails output is correct.

Special input for specifying form URL

Referrer information from HTTP headers is not very reliable. We should add an optional special form field _formurl that may contain a URL of the website page that has the submitted form.

When this field is provided in the submitted request, its content should replace the referrer information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.