How to retrieve programmatically Email Communication Service delivery status

Anonymous
2025-07-02T20:06:02.75+00:00

Hello

I was asked to find a way to get the delivery status of the email communication service

If O go to my Communication services | insights | Email Performance and choose the Mail From address, I can see it as shown:

User's image

Can someone tell me how to get the info programmatically ?

My goal is to have this run every day to retrieve the infos of the las 24 hours ans save it either in csv or JSON

Where do I start ?

Azure Communication Services

Answer accepted by question author
Bhargavi Naragani 7,940 Reputation points Moderator
2025-07-03T08:10:56.5266667+00:00

Hi Nguyen, Tien Lam,

You must stream email logs from your Communication Services resource into a Log Analytics workspace: https://learn.microsoft.com/en-us/azure/communication-services/concepts/analytics/logs/email-logs

The table ACSEmailStatusUpdateOperational contains per‑recipient delivery statuses: Includes fields like Timestamp, Recipient, Sender, DeliveryStatus (Delivered, Failed, etc.), and CorrelationId. https://learn.microsoft.com/en-us/azure/azure-monitor/reference/tables/acsemailstatusupdateoperational

Use the Logs section in Log Analytics or Azure Monitor REST API. Sample KQL to get last 24 hours’ delivery statuses:

ACSEmailStatusUpdateOperational
| where Timestamp > ago(24h)
| project Timestamp, Sender, Recipient, DeliveryStatus, CorrelationId

You can easily extend this query for filtering, grouping, or suppression reasons.

Automate Data Retrieval:

  1. Azure Logic Apps / Power Automate
    • Create a scheduled workflow to run the KQL query.
    • Export results directly to CSV/JSON or storage.
  2. Script with REST or SDK: Use Azure Monitor Logs REST API Or use the Azure SDK (Python, .NET, Node, etc.) to query programmatically and export data. https://learn.microsoft.com/en-us/rest/api/loganalytics/query?view=rest-loganalytics-2022-10-27-preview

Alternatively Subscribe to Real-time Events via Event Grid, if you prefer push notifications rather than polling:

  • Enable Event Grid event source on your Communication Services resource.
  • Subscribe to events like Microsoft.Communication.EmailDeliveryReportReceived.
  • Set up an Event Grid subscription to an endpoint (Webhook, Azure Function, Logic App)
  • The payload includes messageId, recipient, and final delivery status.

This pushes status updates in near real-time and can also write JSON files to your system.
https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/email/handle-email-events
https://learn.microsoft.com/en-us/azure/event-grid/communication-services-email-events

Hope this helps, if you have any further concerns or queries, please feel free to reach out to us.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.