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"

can resolve issue.enter image description here


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -