Azure / azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
MIT License
2.07k stars 1.19k forks source link

[Communication - Email] Email was dropped because all recipients were suppressed #25353

Open karthick-in opened 1 year ago

karthick-in commented 1 year ago

Unable to send email to XXXX@qudol.net using Azure Email Communication Service Issue exists only for emails to this domain (qudol.net) We have no problem sending email to this address from any other client.

Package version @azure/communication-email": "^1.0.0-beta.2

Error from beginSend() function RestError: Requested message could not be located. Couldn't find a record with the messageID: XXXX

Communication service diagnostic log RecipientId: XXXX@qudol.net DeliveryStatus: Failed

After digging into the sdk code, we found the below error,

error.code: 'EmailDroppedAllRecipientsSuppressed' error.message: 'Email was dropped because all recipients were suppressed. You will get a dropped event for each suppresssed recipient through event grid or Azure monitoring.'

Reproduce the issue by, Using sample code from the below nodejs script. Just supply the recipient as any XXXX@qudol.net https://github.com/azure-samples/communication-services-javascript-quickstarts/tree/main/send-email

karthick-in commented 1 year ago

Update

I accidentally found that the email goes out fine, as long as there is one uppercase letter in the email string (xxxx@Qudol.net or Xxxx@qudol.net)

When its all lowercase, issue still exists! Issue happens with this domain only!

karthick-in commented 1 year ago

Following the above comment, as a work around, we decided to make the recipient email all uppercase. This is working fine. But this issue needs to be resolved.

jasony4 commented 1 year ago

Also having the same issue with this. Getting the same error and setting the recipients address to capital letters allowed the code to execute without any errors however we still aren't receiving the messages to the recipients email address.

Package version "@azure/communication-email": "1.0.0" Error received "message": "Requested message could not be located. Couldn't find a record with the messageID:...." "error": { "code": "MessageNotFound", "message": "Requested message could not be located. Couldn't find a record with the messageID:...", "target": null, "details": null, "innererror": null } We suspect it's because the recipient domain is the same as the custom domain set for the email service in Azure but we're unsure.

karthick-in commented 1 year ago

@jasony4 Hope the spam control from the recipient side is not an issue in your case. In my case, when capital letters are used, email is sending out fine and recipient receives it.

Same domain for the email service and recipient shouldn't be an issue.

jasony4 commented 1 year ago

@karthick-in thank you for the information, I'll have a look and see if this works in our case. If anything I'll respond here 🙏

kagbakpem commented 1 year ago

Hello there,

Apologies for the delay in responding here. Can you please provide a message-id for these requests or attempt to reproduce the issue and share the new message-ids?

Thnanks

Zacch commented 11 months ago

Hi @kagbakpem, Thank you for looking into this! I am getting the same error (although in my case changing the email address to uppercase did not help). Here is the message-id and exception stack trace from my latest attempt:

`Azure.RequestFailedException: Message dropped because all recipients were suppressed Status: 200 (OK) ErrorCode: EmailDroppedAllRecipientsSuppressed

Content: {"id":"6f281879-88bc-49c1-9661-507d2813ea4d","status":"Failed","error":{"code":"EmailDroppedAllRecipientsSuppressed","message":"Message dropped because all recipients were suppressed","target":null,"details":null,"innererror":null}}

Headers: mise-correlation-id: REDACTED api-supported-versions: REDACTED X-Cache: REDACTED X-Azure-Ref: REDACTED Date: Wed, 01 Nov 2023 07:11:01 GMT Content-Length: 232 Content-Type: application/json; charset=utf-8

at Azure.Core.OperationInternal1.GetResponseFromState(OperationState1 state) at Azure.Core.OperationInternal1.UpdateStatusAsync(Boolean async, CancellationToken cancellationToken) at Azure.Core.OperationInternalBase.UpdateStatusAsync(CancellationToken cancellationToken) at Azure.Core.OperationPoller.WaitForCompletionAsync(Boolean async, OperationInternalBase operation, Nullable1 delayHint, CancellationToken cancellationToken) at Azure.Core.OperationInternalBase.WaitForCompletionResponseAsync(Boolean async, Nullable1 pollingInterval, String scopeName, CancellationToken cancellationToken) at Azure.Core.OperationInternal1.WaitForCompletionAsync(Boolean async, Nullable1 pollingInterval, CancellationToken cancellationToken) at Azure.Core.OperationInternal1.WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) at Azure.Communication.Email.EmailSendOperation.WaitForCompletionAsync(CancellationToken cancellationToken) at Azure.Communication.Email.EmailClient.SendEmailInternalAsync(WaitUntil wait, EmailMessage message, CancellationToken cancellationToken) at Azure.Communication.Email.EmailClient.SendAsync(WaitUntil wait, String senderAddress, String recipientAddress, String subject, String htmlContent, String plainTextContent, CancellationToken cancellationToken) at Web.Services.EmailService.SendEmailAsync(String recipient, String subject, String htmlContent)`

This is the relevant code in my EmailService:

var emailClient = new EmailClient(connectionString); var emailSendOperation = await emailClient.SendAsync(WaitUntil.Completed, sender, recipient, subject, htmlContent);

Let me know if I can help!

/Rolf

Zacch commented 10 months ago

I solved my problem by switching to Mailgun... It means one more bill to pay every month, but on the plus side it actually works.

I think the reason for the Azure SDK error was caused by a missing certificate in my case – if you have the same problem, it may be worth looking into the certificates of the receiving mail servers.