Mailbox unavailable. The server response was: 5.7.51 TenantInboundAttribution; There is a partner connector configured that matched the message

john john 946 Reputation points
2021-04-08T17:23:15.253+00:00

I have the following code to send email inside our sharepoint remote event receiver which is hosted inside Azure:-

using (MailMessage mail = new MailMessage())
                {
                    mail.From = new MailAddress("sharepoint@****.net");

                    string[] emailaddresses = to.Split(';');

                    foreach (var s in emailaddresses)
                    {
                        if (!string.IsNullOrEmpty(s))
                            mail.To.Add(s);
                    }


                    if (!string.IsNullOrEmpty(cc))
                    {

                        mail.CC.Add(cc);
                    }



                    mail.Body = emailbody;
                    mail.Subject = title;
                    mail.IsBodyHtml = true;


                    try
                    {
                        SmtpClient smtp = new SmtpClient();
                        smtp.Host = "*****-net.mail.protection.outlook.com";
                        smtp.EnableSsl = true;
                        smtp.Port = 25;


                        smtp.Send(mail);
                        ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
                        ListItem listItem = xlogs.AddItem(itemCreateInfo);
                        listItem["Title"] = "Email sent to= " + to;
                        listItem.Update();
                        context.ExecuteQuery();



                        if (!string.IsNullOrEmpty(cc))
                        {
                            ListItemCreationInformation itemCreateInfo2 = new ListItemCreationInformation();
                            ListItem listItem2 = xlogs.AddItem(itemCreateInfo2);
                            listItem2["Title"] = "Email sent cc = " + cc;
                            listItem2.Update();
                            context.ExecuteQuery();
                        }
                        context.ExecuteQuery();
                    }
                    catch (Exception e)
                    {

                        ListItemCreationInformation itemCreateInfo2 = new ListItemCreationInformation();
                        ListItem listItem2 = xlogs.AddItem(itemCreateInfo2);
                        listItem2["Title"] = "Sending email = " + e.Message.Substring(0,100);
                        listItem2.Update();
                        context.ExecuteQuery();


                        //
                    }



                }

The code use to work well, but starting from Tuesday 6 March the above code will raise this error when i call the smtp.Send(mail);:-

Mailbox unavailable. The server response was: 5.7.51 TenantInboundAttribution; There is a partner connector configured that matched the message's recipient domain. The connector had either the RestrictDomainsToIPAddresses or RestrictDomainsToCertificate set [*****.eop-gbr01.prod.protection.outlook.com]

any advice please? i checked with our system engineers and nothing were changed on office 365 neither inside exchange nor inside sharepoint

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,141 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,340 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Jerryzy 10,566 Reputation points
    2021-04-09T01:55:22.63+00:00

    Can you send to the same email address using the Office 365 Outlook online ? From the code snippet, I can't find out the missing points for sending email.