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.
Mailbox unavailable. The server response was: 5.7.51 TenantInboundAttribution; There is a partner connector configured that matched the message
john john
966
Reputation points
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