I’m trying to send email using azure email communication Python SDK
poller = self.email_client.begin_send(
message=payload,
)
time_elapsed = 0
while not poller.done():
logger.info("Email send poller status: " + poller.status())
poller.wait(POLLER_WAIT_TIME)
time_elapsed += POLLER_WAIT_TIME
if time_elapsed > 18 * POLLER_WAIT_TIME:
raise RuntimeError("Polling timed out.")
result = poller.result()
Payload:
{
"content": {
"subject": "Sample Subject",
"html": "<!DOCTYPE html>n<html>n<head>nnn</head>n<body>nn<div style="padding-left: 5%; padding-right: 5%">n<p>Hello Team,</p></div>n</body>n</html>"
},
"recipients": {
"to": [
{
"address": "my_email.com",
"displayName": "My Name"
}
],
"cc": [],
"bcc": []
},
"senderAddress": "[email protected]",
"attachments": []
}
Result:
{
"id":"570e68e8-0418-4cde-bd5e-49d9a9bf3f49",
"status":"Succeeded",
"error":null
}
I need message_id for various purposes, but I’m not getting message_id here from azure api, am i missing anything ?
How to get the message_id of the email sent?
2
Answers
This code may be of interest to you
Retrieving Message ID from Azure Email Service
From your result example above the message id is 570e68e8-0418-4cde-bd5e-49d9a9bf3f49