To use this code, you need to install http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=c3342fb3-fbcc-4127-becf-872c746840e1 , this will create a dll, that you need to import to the project
//connection to ExchangeServer try { ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1); service.Credentials = new NetworkCredential(ssAuthentication.ssSTAuthentication.ssUsername, ssAuthentication.ssSTAuthentication.ssPassword, ssAuthentication.ssSTAuthentication.ssDomain); service.Url = new Uri(ssAuthentication.ssSTAuthentication.ssServiceUrl); // Create an e-mail message and identify the Exchange service. EmailMessage message = new EmailMessage(service); // Add properties to the e-mail message. message.From = ssSender; message.Subject = ssEmailSubject; message.Body = ssEmailDescription; for (int i = 0; i < ssRecipient.Length; i++) { message.ToRecipients.Add(ssRecipient[i].ssSTListOfEmails.ssEmail); } // Send the e-mail message and save a copy. message.Send(); } catch (Exception e) { ssErrors = "The error is: " + e.ToString(); }
0 comentários:
Enviar um comentário