taisiias / formmailer Goto Github PK
View Code? Open in Web Editor NEWHTTP server that emails data submitted on static website forms.
License: MIT License
HTTP server that emails data submitted on static website forms.
License: MIT License
Add HTML emails support (along with plain-text version). Also, prepare a clean default HTML email template.
Add the ability to do the following:
$ # install package globally
$ npm install -g formmailer
$ # run as system binary
$ formmailer
https://docs.npmjs.com/files/package.json#bin
Optional HTTPS connection support. Document deployment in README.
[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] >
Basic interface should display a simple table with following information:
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.
Config should include URL to redirect to in case of some failure during email sending. Document in README.
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).
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?
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}}
Install @types/smtp-server
.
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.
Way to integrate reCAPTCHA without modifying static site contents, no additional scripts/form changes.
Add all of SMTP settings to config according to Nodemailer documentation. Update README.
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.
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
).
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.