I have searched for this error/question I have but the solutions were not related to my situation and/or didn't provide any further infiormation. That being said... Under Exchange 2007, following code was running properly:
ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack; ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1); service.Url = new Uri(ConfigurationManager.AppSettings["ExchangeWebService"]); service.Credentials = CredentialCache.DefaultNetworkCredentials; EmailMessage mail = new EmailMessage(service); mail.Subject = subject; mail.Body = message; mail.Attachments.AddFileAttachment(row.Path); mail.ToRecipients.Add(receiver); mail.Send();
Now, there has been a migration to Exchange 2010 and I get the following message from the `Microsoft.Exchange.WebServices.Data.ServiceResponseException` that is thrown:
When making a request as an account that does not have a mailbox, you must specify the mailbox primary SMTP address for any distinguished folder Ids.
I know that the enumeration for the ExchangeVersion can be changed but when I change this to `SharePoint2010` for example I get following error-message:
Exchange Server doesn't support the requested version.
Are there settings in Exchange that need to be set for which I have to contact the Exchange-administrator or is there something in the code that needs to be changed?