Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Office 365 posts include subject and body now #1274

Merged
merged 1 commit into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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': '[email protected]'}}]},
'saveToSentItems': 'true',
}
mock_post.reset_mock()

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