Skip to content

Commit

Permalink
bugfix - Office 365 include subject and body now (#1274)
Browse files Browse the repository at this point in the history
  • Loading branch information
caronc authored Jan 19, 2025
1 parent a2a2216 commit fcc4939
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
16 changes: 7 additions & 9 deletions apprise/plugins/office365.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,15 +366,13 @@ def send(self, body, title='', notify_type=NotifyType.INFO, attach=None,

if self.from_email:
# Apply from email if it is known
payload.update({
'message': {
'from': {
"emailAddress": {
"address": self.from_email,
"name": self.from_name or self.app_id,
}
},
}
payload['message'].update({
'from': {
"emailAddress": {
"address": self.from_email,
"name": self.from_name or self.app_id,
}
},
})

# Create a copy of the email list
Expand Down
14 changes: 13 additions & 1 deletion test/test_plugin_office365.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import pytest
import requests
from datetime import datetime
from json import dumps
from json import dumps, loads
from apprise import Apprise
from apprise import NotifyType
from apprise import AppriseAttachment
Expand Down Expand Up @@ -541,6 +541,18 @@ def test_plugin_office365_queries(mock_post, mock_get, mock_put):
'https://login.microsoftonline.com/{}/oauth2/v2.0/token'.format(tenant)
assert mock_post.call_args_list[1][0][0] == \
'https://graph.microsoft.com/v1.0/users/abc-1234-object-id/sendMail'
payload = loads(mock_post.call_args_list[1][1]['data'])
assert payload == {
'message': {
'subject': 'title',
'body': {
'contentType': 'HTML',
'content': 'body',
},
'toRecipients': [
{'emailAddress': {'address': 'target@example.ca'}}]},
'saveToSentItems': 'true',
}
mock_post.reset_mock()

# Now test a case where we just couldn't get any email details from the
Expand Down

0 comments on commit fcc4939

Please sign in to comment.