Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure communication service email sending error

I created a communication service in azure to send mail. Then I added a verified custom domain. However, when I send an email, I get an error like this;

RestError: The specified sender domain has not been linked.

I am able to send successfully with azure managed domain mail.

Here is my code:

 const connectionString = `endpoint=https://*******`;
    const client = new EmailClient(connectionString);

    const emailMessage = {
        sender: "noreply@****.com",
        content: {
            subject: "This is the subject",
            plainText: "This is the body",
        },
        recipients: {
            to: [
                {
                    email: "*****",
                    displayName: "Test test",
                },
            ],
        },
    };

    const message = await client.send(emailMessage);

How can I solve this problem ?

like image 851
ömer şahin Avatar asked Oct 23 '25 14:10

ömer şahin


2 Answers

You need to create an Email Communication Services (ECS) resource and connect it to your Azure Communication Services (ACS) resource before start sending emails. Please have a look at below documentations:

  • Create ECS Resource
  • Create managed domain
  • Connect domain to ACS resource
like image 84
Ebraheem Avatar answered Oct 26 '25 04:10

Ebraheem


The problem has been resolved with Custome domain creation from Azure Active Directory. https://learn.microsoft.com/en-us/azure/active-directory/fundamentals/add-custom-domain

Note: Add custome domain through Azure Communication Service is not providing MX record. Where we can get TXT and MX record which need to be add records on our DNS service provider setting. Reference https://learn.microsoft.com/en-us/answers/questions/1183905/azure-communication-service-give-error-the-specifi?page=1&orderby=helpful

like image 37
Alexzander Patra Avatar answered Oct 26 '25 06:10

Alexzander Patra