Fix replacement image and change to header
This commit is contained in:
@@ -100,9 +100,9 @@ The following configuration options are optional in each quarantine section:
|
||||
* **notification_email_envelope_from**
|
||||
Notification e-mail envelope from-address.
|
||||
* **notification_email_from**
|
||||
Value of the notification e-mail from header. Every e-mail template variable described above is usable.
|
||||
Value of the notification e-mail from header. Optionally, you may use the EMAIL_FROM template variable described above.
|
||||
* **notification_email_subject**
|
||||
Notification e-mail subject. All e-mail template variable described above is usable.
|
||||
Notification e-mail subject. Optionally, you may use the EMAIL_SUBJECT template variable described above.
|
||||
* **notification_email_template**
|
||||
Path to the notification e-mail template. It is hold in memory during runtime.
|
||||
* **notification_email_embedded_imgs**
|
||||
|
||||
@@ -188,7 +188,7 @@ class EMailNotification(BaseNotification):
|
||||
|
||||
# read email replacement image if specified
|
||||
replacement_img = self.config["notification_email_replacement_img"].strip()
|
||||
if not strip_images and replacement_img:
|
||||
if not self.strip_images and replacement_img:
|
||||
try:
|
||||
self.replacement_img = MIMEImage(
|
||||
open(replacement_img, "rb").read())
|
||||
@@ -391,9 +391,11 @@ class EMailNotification(BaseNotification):
|
||||
htmltext = self.template.format_map(variables)
|
||||
|
||||
msg = MIMEMultipart('related')
|
||||
msg["Subject"] = self.subject.format_map(variables)
|
||||
msg["From"] = "{}".format(self.from_header.format_map(variables))
|
||||
msg["To"] = "<{}>".format(recipient)
|
||||
msg["From"] = self.from_header.format_map(
|
||||
defaultdict(str, EMAIL_FROM=headers["from"]))
|
||||
msg["To"] = headers["to"]
|
||||
msg["Subject"] = self.subject.format_map(
|
||||
defaultdict(str, EMAIL_SUBJECT=headers["subject"]))
|
||||
msg["Date"] = email.utils.formatdate()
|
||||
msg.attach(MIMEText(htmltext, "html", 'UTF-8'))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user