| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # formmail | |
| 2 | |
| 3 The web handler that extracts form data from a POST request, uses it to | |
| 4 populate an email template and then sends the produced email to a configured | |
| 5 list of addresses. | |
| 6 | |
| 7 ## Dependencies | |
| 8 | |
| 9 * [Python 2.7](https://www.python.org/download/releases/2.7/) | |
| 10 * [Jinja2](http://jinja.pocoo.org/docs/2.10/intro/) | |
| 11 * Other packages are required for testing, please see the list of 'deps' in | |
| 12 [`tox.ini`](../../tox.ini) | |
| 13 | |
| 14 ## Running the web handler | |
| 15 | |
| 16 Normally, the formmail web handler is run by the multiplexer, and configured | |
| 17 via the sitescripts config file. Please refer to the main [README](../../README. md) | |
| 18 for more information about the multiplexer and configuring `sitescripts.ini`. | |
| 19 | |
| 20 In order to activate this handler, add the following line to the multiplexer | |
| 21 config file: | |
| 22 | |
| 23 [multiplexer] | |
| 24 sitescripts.formmail.web.formmail = | |
| 25 | |
| 26 ## Configuring the web handler | |
| 27 | |
| 28 `formmail.py` can handle multiple URLs and forms. Each URL will correspond to a | |
| 29 group of config variables that all start with the same prefix, for example: | |
| 30 handler1. These variables are configured in the [formmail] section of the | |
| 31 config file. | |
| 32 | |
| 33 The URL of the form, where the POST request comes from: | |
| 34 | |
| 35 [formmail] | |
| 36 handler1.url=formmail/test/apply/submit | |
| 37 | |
| 38 The CSV file into which all submissions will be saved (optional): | |
| 39 | |
| 40 handler1.csv_log = /var/log/something.csv_log | |
|
rhowell
2019/01/18 20:08:07
Does the spacing around the `=` matter? This is th
Vasily Kuznetsov
2019/01/21 13:54:18
AFAIK it doesn't. This is parsed by python ConfigP
rhowell
2019/01/22 22:53:54
Done.
| |
| 41 | |
| 42 The Jinja2 template for the email. This is where the recipient email addresses | |
| 43 are entered. [(See an example email template.)](formmail/test/template/test.mail ): | |
| 44 | |
| 45 handler1.template=formmail/test/template/test.mail | |
| 46 | |
| 47 The `handler1.fields.xxx` subgroup includes the descriptions of the form fields: | |
| 48 | |
| 49 handler1.fields.email=mandatory, email | |
| 50 handler1.fields.email.mandatory=You failed the email test | |
| 51 handler1.fields.email.email=You failed the email validation | |
| 52 handler1.fields.non_mandatory_email=email | |
| 53 handler1.fields.non_mandatory_message= | |
| 54 handler1.fields.mandatory=mandatory | |
| OLD | NEW |