File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 6161from email .mime .multipart import MIMEMultipart
6262from email .mime .application import MIMEApplication
6363from email .mime .text import MIMEText
64+ import mimetypes
6465import logging
6566import os .path
6667import re
@@ -146,10 +147,12 @@ def send(self, msg):
146147 # Get list of recipients for this message, from the mask that matched the filename/path
147148 recipients = self .o .masks [msg ['_mask_index' ]][- 1 ]
148149
150+ file_type = mimetypes .guess_type (ipath )
151+
149152 # Prepare the email message
150153 try :
151- if self . o . email_attachment :
152- # Build a non-text email message for the attachment.
154+ # Build a non-text email message for the attachment if specified or if the file type can be deemed to be an image.
155+ if self . o . email_attachment or 'image' in file_type [ 0 ]:
153156 emsg = MIMEMultipart ()
154157 emsg_text = MIMEText (f"{ self .o .email_attachment_text } " )
155158 # Add the attachment text that will be paired with the attachment data
You can’t perform that action at this time.
0 commit comments