I'm trying to send a mail via the exchange web service. I looked into the msdn and find some help. Every time I try to run this code i'm getting the above error :( I try read almost everywhere...
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);
service.Credentials = new WebCredentials("My user name", "my pass");
System.Net.ServicePointManager.ServerCertificateValidationCallback =
((sender, certificate, chain, sslPolicyErrors) => true);
service.Url = new Uri("my web service url.WSDL");
EmailMessage appointment = new EmailMessage(service);
appointment.Subject = "Test by me";
appointment.Body = "DateTime.Now";
appointment.ToRecipients.Add("[email protected]");
appointment.SendAnd
SaveCopy();
The HyperText Transfer Protocol (HTTP) 405 Method Not Allowed response status code indicates that the server knows the request method, but the target resource doesn't support this method. The server must generate an Allow header field in a 405 status code response.
"405 - HTTP verb used to access this page is not allowed". 405 means that your Web Server is not recognizing the HTTP method(GET,POST,HEAD etc.) in the request.
When setting the url to the service, you should in fact use the asmx, and not the wsdl link.
service.Url = new Uri("https://server/EWS/Exchange.asmx");
That should make it work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With