GitHub - matthiasmullie/post-to-email: Supporting contact forms for static websi...
source link: https://github.com/matthiasmullie/post-to-email
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Post to email
Contact forms for static websites.
Turn POST requests into email, enabling contact forms etc. on otherwise static websites.
Instructions
1. Deploy the container
Run the matthiasmullie/post-to-email
Docker container in whatever configuration makes sense.
Below are detailed instructions to run this in a couple of different ways - pick whichever makes most sense for your usecase.
2. Build a simple form & submit it
Submit a POST request (with remaining variables - see configuration)
Check out this simple example to build a form that submits forms to the service we deployed in the first step.
3. Receive an email
You've got this! We're done here.
Configuration
Email configuration can be set globally on the server hosting this script (via environment variables), or per request on the client calling this (via POST or GET params)
If set, environment variables always get precedence over POST, which gets precedence over GET params.
This can be useful to lock down certain settings (e.g. RECIPIENT
or DSN
) within your hosting environment to prevent abuse.
Available params:
DSN
: DSN string for a transport (e.g. SMTP) to send emails withSENDER
: sender email addressRECIPIENT
: recipient email addressREPLY_TO
(optional, defaults toSENDER
): reply-to email addressSUBJECT
(optional, defaults to "Form to email"): email subjectREDIRECT
(optional, defaults to referrer): location to redirect back to after handing submission, or explicitly blank for no redirectALLOW_ORIGIN
[ENV only] (optional, defaults to*
): allowed CORS domain
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK