NodeJS API for contact forms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Keith Irwin 33be91e6d5
Added .env.sample
2 weeks ago
.dockerignore Added docker-compose.yml to ignorefiles 1 year ago
.env.sample Added .env.sample 2 weeks ago
.gitignore Added docker-compose.yml to ignorefiles 1 year ago
Dockerfile Added docker 1 year ago
LICENSE Added documentation and clientside code 1 year ago
README.md Added documentation and clientside code 1 year ago
docker-compose.yml.sample Moved env vars to docker-compose.yml 1 year ago
index.html.sample Replaced msg with alerts on clientside 1 year ago
index.js Removed token logging 1 year ago
package-lock.json Added code to send email 1 year ago
package.json Switched to body-parser 1 year ago

README.md

mailapi

This is a PGP-enabled contact form that you can use. It has two parts:

  • A static web form that uses javascript to encrypt a message and send it to an api endpoint
  • An API which checks the captcha and sends the message by email

Setting up a server

Download the source; it's not on docker hub.

git clone https://gitea.gf4.pw/ki9/mailapi.git
cd mailapi

Copy the sample environment files and edit them to suit your needs.

cp .env.sample .env
cp docker-compose.yml.sample docker-compose.yml

Start the service with docker:

docker-compose up -d

...or start the service directly, or with a daemon manager:

npm run start

The API should now be listening on port 8080 or whatever you set in the docker-compose.yml. You may choose to run this through a proxy server or whatever.

Serving the clientside app

You can use the contact form in index.html.sample. Tweak it to your needs and put it in your clientside code. I'm not offering support for your particular set up, but the code in both index.html.sample and index.js is short and easy to modify to your use case.

MIT License

Copyright © 2021 Keith Irwin

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.