Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Trevor Cappallo
OperationalLogging
Commits
3520f013
Commit
3520f013
authored
Aug 17, 2015
by
Trevor Cappallo
Browse files
add monospaced email option
parent
65e7bcd0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
lib/OperationalMail.py
lib/OperationalMail.py
+4
-2
No files found.
lib/OperationalMail.py
View file @
3520f013
...
...
@@ -9,8 +9,8 @@ from email.mime.multipart import MIMEMultipart
from
email.mime.text
import
MIMEText
def
send_status
(
subject
,
message
,
to_list
,
from_address
=
'no-reply@aer.com'
,
password
=
None
,
text_attachment
=
None
,
reply_to
=
'no-reply@aer.com'
,
smtp_server
=
'smtp.aer.com'
,
def
send_status
(
subject
,
message
,
to_list
,
from_address
=
'no-reply@aer.com'
,
reply_to
=
'no-reply@aer.com'
,
password
=
None
,
text_attachment
=
None
,
use_monospaced
=
True
,
smtp_server
=
'smtp.aer.com'
,
**
kwargs
):
"""Send an email message to a given recipient list."""
mail
=
MIMEMultipart
(
'mixed'
)
...
...
@@ -32,6 +32,8 @@ def send_status(subject, message, to_list, from_address='no-reply@aer.com',
logging
.
warning
(
'Unable to generate text version of email: {0}'
.
format
(
str
(
err
)))
final_text
=
'HTML ONLY'
if
use_monospaced
:
message
=
"<div style='font-family: monospace;'>{}</div>"
.
format
(
message
)
contentPart
=
MIMEMultipart
(
'alternative'
)
contentPart
.
attach
(
MIMEText
(
final_text
,
'plain'
))
contentPart
.
attach
(
MIMEText
(
message
,
'html'
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment