user3600403
user3600403

Reputation: 339

Convert System.Net.Mail.Message to EWS Email?

Is there a simple Way to convert a System.Net.Mail.Message Object to Microsoft.Exchange.WebServices.Data.EmailMessage (EWS)? Or is the only way to build a new one? (i want to Add a new Feature sending Mails trough EWS to my app, currently it uses SMTP)

Upvotes: 0

Views: 1116

Answers (1)

Glen Scales
Glen Scales

Reputation: 22032

No you can't convert them because they are two completely different classes (from different assemblies) and they also use two different protocols eg one is using SMTP and one is using SOAP. So you would be better to just rewrite your Send function.

One thing you can do with EWS if you have MIMEContent is to send that MIME content eg

        EmailMessage Message = new EmailMessage(service);
        Message.MimeContent = new MimeContent("UTF-8", baByteArray);
        Message.SendAndSaveCopy();

but AFAIK System.Net.Mail.Message doesn't give you the ability to export to MIME like the old CDO classes used to.

Upvotes: 1

Related Questions