email - Autodiscover cannot process the given e-mail address. Only mailboxes and contacts are allowed -
while sending email using exchangeservice throwing exception message is: "the autodiscover service returned error." , "autodiscover cannot process given e-mail address. mailboxes , contacts allowed".
public void sendemail(string to, string cc, string subject, string body, string emailtype) { exchangeservice service = new exchangeservice(exchangeversion.exchange2010); service.credentials = new webcredentials("test@outlook.com", "test"); service.traceenabled = true; service.traceflags = traceflags.all; service.autodiscoverurl("test@outlook.com", redirectionurlvalidationcallback); emailmessage email = new emailmessage(service); email.torecipients.add(to); email.ccrecipients.add(cc); email.subject = subject; email.body = new messagebody(body); email.send(); } private static bool redirectionurlvalidationcallback(string redirectionurl) { bool result = false; uri redirectionuri = new uri(redirectionurl); if (redirectionuri.scheme == "https") { result = true; } return true; }
the above code working fine "...@microsoft.com" not working "...outlook.com"
Comments
Post a Comment