I created the namespace using the wsdl tool via the command line, pointing it to https://exchange-server/EWS/Services.wsdl .
I can successfully send emails using the following code:
const string EWS_USERNAME = "user"; const string EWS_PASSWORD = "pass"; const string EWS_DOMAIN = "domain"; const string EWS_URL = "https://exchange-server/EWS/Exchange.asmx"; var ews = new ExchangeServiceBinding(); ews.Credentials = new NetworkCredential(EWS_USERNAME, EWS_PASSWORD, EWS_DOMAIN); ews.Url = EWS_URL; var email = new MessageType(); email.IsFromMe = false; email.From = new SingleRecipientType(); email.From.Item = new EmailAddressType(); email.From.Item.EmailAddress = " from@example.com "; email.ToRecipients = new EmailAddressType[1] { new EmailAddressType { EmailAddress = " recipient@example.com " } }; email.Subject = "Subject"; email.Body = new BodyType(); email.Body.BodyType1 = BodyTypeType.HTML; email.Body.Value = "<strong>Test</strong>"; var emailToSave = new CreateItemType(); emailToSave.Items = new NonEmptyArrayOfAllItemsType(); emailToSave.Items.Items = new ItemType[1] { email }; emailToSave.MessageDisposition = MessageDispositionType.SendAndSaveCopy; emailToSave.MessageDispositionSpecified = true; ews.CreateItemCompleted += new CreateItemCompletedEventHandler(ExchangeWebServices_CreateItemCompleted); ews.CreateItemAsync(emailToSave, callbackState);
My question is how to send a multi-page email containing both HTML and the body of plain text?
source share