You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When sending emails through the Office 365 notifier, the subject and body are not being included in the final payload, resulting in empty emails. This appears to be due to how the payload dictionary is being updated in the send() method of the NotifyOffice365 class.
Current Behavior
Emails are sent successfully (202 response).
The payload only includes from, toRecipients, and saveToSentItems.
Subject and body are missing from the final payload.
The issue occurs with both notify() and send() methods.
Expected Behavior
The subject and body should be included in the final payload sent to the Microsoft Graph API.
Emails should contain the specified subject and body content.
The issue occurs in the NotifyOffice365.send() method of the Office 365 plugin. The payload dictionary is being overwritten instead of merged when adding the 'from' information, causing loss of subject and body data.
Current Implementation:
defsend(self, body, title='', notify_type=NotifyType.INFO, attach=None, **kwargs):
""" Perform Office 365 Notification """# ... rest of the implementation remains the samepayload= {
'message': {
'subject': title,
'body': {
'contentType': content_type,
'content': body,
},
},
'saveToSentItems': 'true'
}
# This update overwrites the entire 'message' dictionarypayload.update({
'message': {
'from': {
"emailAddress": {
"address": self.from_email,
"name": self.from_nameorself.app_id,
}
},
}
})
# ... rest of the implementation remains the same
Suggested Fix
The issue can be resolved by properly merging the dictionaries instead of overwriting them. Here's the proposed fix for the send() method in NotifyOffice365:
defsend(self, body, title='', notify_type=NotifyType.INFO, attach=None, **kwargs):
""" Perform Office 365 Notification """# ... rest of the implementation remains the samepayload= {
'message': {
'subject': title,
'body': {
'contentType': content_type,
'content': body,
},
},
'saveToSentItems': 'true'
}
# ... rest of the implementation remains the samepayload['message'].update({
'from': {
"emailAddress": {
"address": self.from_email,
"name": self.from_nameorself.app_id,
}
}
})
# ... rest of the implementation remains the samepayload['message'].update({
'toRecipients': [{
'emailAddress': {
'address': self.source
}
}]
})
# ... rest of the implementation remains the same
The text was updated successfully, but these errors were encountered:
Description
When sending emails through the Office 365 notifier, the subject and body are not being included in the final payload, resulting in empty emails. This appears to be due to how the payload dictionary is being updated in the
send()
method of theNotifyOffice365
class.Current Behavior
from
,toRecipients
, andsaveToSentItems
.notify()
andsend()
methods.Expected Behavior
Debug Log Evidence
Root Cause
The issue occurs in the
NotifyOffice365.send()
method of the Office 365 plugin. The payload dictionary is being overwritten instead of merged when adding the 'from' information, causing loss of subject and body data.Current Implementation:
Suggested Fix
The issue can be resolved by properly merging the dictionaries instead of overwriting them. Here's the proposed fix for the
send()
method inNotifyOffice365
:The text was updated successfully, but these errors were encountered: