Skip to content

Commit

Permalink
EWSO365 fix send-mail with inline images (#38385)
Browse files Browse the repository at this point in the history
* Fixed case where "new_attachment" is used without being initialized
  • Loading branch information
itssapir authored Feb 2, 2025
1 parent 3779a8e commit 2cc5e7f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
10 changes: 5 additions & 5 deletions Packs/MicrosoftExchangeOnline/Integrations/EWSO365/EWSO365.py
Original file line number Diff line number Diff line change
Expand Up @@ -1588,7 +1588,7 @@ def handle_template_params(template_params): # pragma: no cover
elif params[p].get('key'):
actual_params[p] = demisto.dt(demisto.context(), params[p]['key'])
except ValueError as e:
return_error('Unable to parse template_params: %s' % (str(e)))
return_error(f'Unable to parse template_params: {str(e)}')

return actual_params

Expand Down Expand Up @@ -1659,12 +1659,12 @@ def create_message(to, subject='', body='', bcc=None, cc=None, html_body=None, a
for attachment in attachments:
if not isinstance(attachment, FileAttachment):
if not attachment.get('cid'):
new_attachment = FileAttachment(name=attachment.get('name'), content=attachment.get('data'))
attachment = FileAttachment(name=attachment.get('name'), content=attachment.get('data'))
else:
new_attachment = FileAttachment(name=attachment.get('name'), content=attachment.get('data'),
is_inline=True, content_id=attachment.get('cid'))
attachment = FileAttachment(name=attachment.get('name'), content=attachment.get('data'),
is_inline=True, content_id=attachment.get('cid'))

message.attach(new_attachment)
message.attach(attachment)

return message

Expand Down
6 changes: 6 additions & 0 deletions Packs/MicrosoftExchangeOnline/ReleaseNotes/1_6_1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#### Integrations

##### EWS O365

- Fixed an issue where the ***send-mail*** command would fail when providing an *html_body* argument with inline images.
2 changes: 1 addition & 1 deletion Packs/MicrosoftExchangeOnline/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Microsoft Exchange Online",
"description": "Exchange Online and Office 365 (mail)",
"support": "xsoar",
"currentVersion": "1.6.0",
"currentVersion": "1.6.1",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down

0 comments on commit 2cc5e7f

Please sign in to comment.