Add url encoded email template variables

This commit is contained in:
2020-01-29 19:58:08 +01:00
parent b40e835215
commit f4399312b4
2 changed files with 8 additions and 1 deletions

View File

@@ -77,11 +77,15 @@ The following configuration options are optional in each quarantine section:
The following template variables are available:
* **{EMAIL_ENVELOPE_FROM}**
E-mail from-address received by the milter.
E-mail from address received by the milter.
* **{EMAIL_ENVELOPE_FROM_URL}**
Like EMAIL_ENVELOPE_FROM, but URL encoded
* **{EMAIL_FROM}**
Value of the from header of the original e-mail.
* **{EMAIL_TO}**
E-mail recipient address of this notification.
* **{EMAIL_TO_URL}**
Like EMAIL_TO, but URL encoded
* **{EMAIL_SUBJECT}**
Configured e-mail subject.
* **{EMAIL_QUARANTINE_ID}**

View File

@@ -23,6 +23,7 @@ from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from os.path import basename
from urllib.parse import quote
from pyquarantine import mailer
@@ -361,7 +362,9 @@ class EMailNotification(BaseNotification):
EMAIL_HTML_TEXT=sanitized_text,
EMAIL_FROM=escape(headers["from"]),
EMAIL_ENVELOPE_FROM=escape(mailfrom),
EMAIL_ENVELOPE_FROM_URL=escape(quote(mailfrom)),
EMAIL_TO=escape(recipient),
EMAIL_TO_URL=escape(quote(recipient)),
EMAIL_SUBJECT=escape(headers["subject"]),
EMAIL_QUARANTINE_ID=quarantine_id)