How does the parser extract the email subject, sender, and recipients from the XML file?
The parser uses Python's standard library `xml.dom.minidom` to navigate the SOAP XML structure. For fields like subject and body which appear as direct text between tags, it accesses the `firstChild.data` of the corresponding node (e.g., `t:Subject`). For the sender, which is nested under `t:Sender` > `t:Mailbox` > `t:Name`, it retrieves the element by tag name and then gets the child node's data. Recipients and CC are handled via loop extraction over multiple `t:Mailbox` child nodes under `t:ToRecipients` or `t:CcRecipients`. These techniques build on the SOAP message structure introduced in the [Exchange Web Service (EWS) Development Guide 2 – SOAP XML Message](/news/exchange-web-service-ews-development-guide-2-soap-xml-message).
Related article:
Exchange Web Service (EWS) Development Guide 3 – SOAP XML Parser