Exchange Web Services async email client

I need to send email to EWS asychronously from C#. I get that IAsyncEwsClient.SendAsync returns a Task and since I also send using SMTP synchronously I figure that’ll be similar, but to get the client you need to call the static method EWSClient.GetEwsClientAsync which returns a task and I haven’t been able to get its result. The task sits in status WaitingForActivation indefinitely. The GetAccessTokenAsync method on my token provider is getting called. I’m not passing a proxy or cancellation token. Marking the call with async would force my method to be declared asynchronously which I don’t want to do. I’m quite happy for it to wait. Is there any other sample code than the 21.9 release notes that shows how to do this?

Second thoughts: I’m getting an exception in GetEwsClientAsync. The system can’t find library Aspose.Email.XmlSerializers, Version=21.11.0.0. That didn’t appear in the NuGet package. Should it be there?

@cp60299

We have logged a ticket for your use case in our issue tracking system as EMAILNET-40535. We will inform you via this forum thread once there is an update available on it.

We apologize for your inconvenience.

Can you give me an idea where you’re going with this and the timeframe? If it’s something that you can supply straight away - like the missing library - or something simple that I can work around then I’ll expect to wrap it in a few days. If it’s entering a development cycle and you don’t expect a result for a couple of weeks or months, I’ll make other plans. Chris.

@cp60299

Currently, your issue is pending for analysis and is in the queue. Once we complete the analysis of your issue, we will then be able to provide you an estimate.

1 Like

Has there been any progress on this? I’ve seen no notifications. Still hoping for a quick answer on whether this is a quick fix (you supply the missing library or help me identify a coding error) or requires development work. We upgraded to Aspose.Email.dll 21.11.0.0 specifically to get asynchronous sending to Exchange and this is a blocker for us.

@cp60299

We try our best to deal with every customer request in a timely fashion, we unfortunately cannot guarantee a delivery date to every customer issue. We work on issues on a first come, first served basis. We feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers.

We are working over your issue. Once we complete the analysis of your issue, we will then be able to provide you the ETA. Thanks for your patience.

@cp60299

Please check the attached working project using IAsyncEwsClient.SendAsync. Hope this helps you. ConsoleAppIAsyncEwsClient.zip (26.1 KB)

Regarding the question about Aspose.Email.XmlSerializers, could you please create a simple visual studio test project to reproduce this issue at our end? We will investigate this issue and provide you more information on it.

Thanks for the sample code. Yes indeed, that helped me resolve my asynchronous coding issue. I also discovered that the exception does not block creation of the Exchange email client, and can be ignored. It occurs during execution of EWSClient.GetEwsClientAsync deep in mscorlib. It is exposed in your project if you open Exception Settings and turn on Break When Throws for Common Language Runtime / System.IO.FileNotFoundException. Let’s close this issue.

@cp60299

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Email, we will be happy to help you.