Skip to content

Commit

Permalink
Make attachments optional for email alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
bugy committed Oct 3, 2023
2 parents 0da869e + bc6071c commit a50c18e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/communications/destination_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def __init__(self, params_dict):
self.auth_enabled = read_bool_from_config('auth_enabled', params_dict)
self.login = params_dict.get('login')
self.tls = read_bool_from_config('tls', params_dict)
self.attach_files = read_bool_from_config('attach_files', params_dict, default=True)

self.password = self.read_password(params_dict)
self.to_addresses = split_addresses(self.to_addresses)
Expand Down Expand Up @@ -103,7 +104,7 @@ def send(self, title, body, files=None):
if self.auth_enabled:
server.login(self.login, self.password)

if files:
if self.attach_files and files:
for file in files:
filename = file.filename
part = MIMEApplication(file.content, Name=filename)
Expand Down

0 comments on commit a50c18e

Please sign in to comment.