diff --git a/main.py b/main.py index fdfb1a7..e85c5b1 100755 --- a/main.py +++ b/main.py @@ -52,7 +52,7 @@ token_chars = string.ascii_lowercase+string.ascii_uppercase+string.digits token_len = 50 # form template regex -form_regex = '\{\{(\w+)(\|[\w\s,\.\?\'\"\!\[\]]+)?\}\}' +form_regex = '\{\{(\w+)(\|[\w\s,\.\?\-\'\"\!\[\]]+)?\}\}' # Load file from .env file. load_dotenv(os.path.dirname(__file__) + '.env') @@ -137,6 +137,9 @@ def submission (): save_mail (token, form['mail'], from_address, subject, content) response.status = 500 error = 'Impossible de trouver le destinataire du mail. Votre message a été enregistré, il sera remis manuellement à son destinataire.' + except Exception as e: + save_mail (token, form['mail'], from_address, subject, content) + raise # Redirection diff --git a/readme.md b/readme.md index d12298e..6336143 100644 --- a/readme.md +++ b/readme.md @@ -33,7 +33,7 @@ You can choose how information sent with form will be displayed in the final mai Here is a template example : ``` subject: "[Contact] {{nom|anonyme}} — {{object|no object}}" -content: "{{message}}" +content: "Message de contact :%0D%0A{{message}}" ``` When the form will be submitted to the mailer, parts like `{{…}}` will be replaced by fields content of the same name! If the field holds no value, two possibilities: