File tree 1 file changed +6
-3
lines changed
src/aibs_informatics_aws_utils
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -121,15 +121,15 @@ def send_email_with_attachment(
121
121
source : Union [str , EmailAddress ],
122
122
to_addresses : Sequence [Union [str , EmailAddress ]],
123
123
subject : str ,
124
- body : str = "" ,
124
+ body : Union [ str , MIMEText ] = "" ,
125
125
attachments_paths : Optional [List [Path ]] = None ,
126
126
) -> SendRawEmailResponseTypeDef :
127
127
"""
128
128
Args:
129
129
source: Source email address
130
130
to_addresses: List of recipient email addresses
131
131
subject: Email subject
132
- body: Email body
132
+ body: Email body which can be either basic str or MIMEText (which can allow html with hyperlinks)
133
133
attachments_paths: List of optional paths to read contents from and attach to the email
134
134
Returns: `SendEmailResponseTypeDef`
135
135
"""
@@ -139,7 +139,10 @@ def send_email_with_attachment(
139
139
msg ["To" ] = ", " .join (to_addresses )
140
140
141
141
msg_body = MIMEMultipart ("alternative" )
142
- msg_body .attach (MIMEText (body ))
142
+ if isinstance (body , str ):
143
+ msg_body .attach (MIMEText (body ))
144
+ else :
145
+ msg_body .attach (body )
143
146
msg .attach (msg_body )
144
147
145
148
if attachments_paths is not None :
You can’t perform that action at this time.
0 commit comments