How to check if Azure Email Sending limit is reached?

Petmaya 0 Reputation points
2024-02-23T07:20:52.11+00:00

If you hit the sending limits (100 email in 1 hour) Azure EmailClient.Send(...) will not return until the send is available again. That means send might not return in an hour!

Here is the code for sending:

              log($"Before Sending Email [{message}] to {email} using {emailClient}");
              emailSendOperation = emailClient.Send(
                        WaitUntil.Started,
                        senderAddress: "DoNotReply@xxxxxxx",
                        recipientAddress: email,
                        subject: subject,
                        htmlContent: htmlMessage,
                        plainTextContent: plainMessage);
              log($"After sending Email [{message}] to {email}");

And the result log:

2/23/2024 7:12:16 AM: Before Sending Email [Test B Message Body 1] to xxxx@xxxx.com using Azure.Communication.Email.EmailClient
2/23/2024 8:14:01 AM: After sending Email [Test B Message Body 1] to xxxx@xxxx.com

Not returning any calls in a given timeframe, I don't think is acceptable. Throwing an exception or getting back an appropriate state could resolve the issue, but knowing the controller uses Azure Email services might not return in an hour is something makes the system unusable. Is there a way to determine, the limits are reached, so send is not available in a given moment?

Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
848 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Petmaya 0 Reputation points
    2024-02-23T21:11:48.0633333+00:00

Your answer

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