sendasync

.NET SMTP SendAsync with AlternateViews throws disposed exception

I am trying to send E-mails asynchronously and it works fine as long as there isn't an AlternateView attached to the e-mail. When there is an alternate view, I get the following error: Cannot access a disposed object. Object name: 'System.Net.Mail.AlternateView' System.Net.Mail.SmtpException: Failure sending mail. ---> System.ObjectDis...

ASP.NET MVC: Send email using SendAsync (System.Net.Mail)

Hello, is there any way in MVC to get the System.Net.Mail SendAsync to work, instead of the blocking Send method? I tried using it but hit the "Page starting an asynchronous operation has to have the Async attribute" error, which I obviously can't resolve (or can I?) because there is no ASPX page with an @Page directive where I could a...

When will SendAsync complete?

I'm writing a server and need to be able to send a message to all connected clients. I'm trying to decide if I should create SocketAsyncEventArgs for each connected socket and send all the packets at once. Another approach would be to use a single SocketAsyncEventArgs and send the packets one after another. Then it would be tempting t...

Ping Class SendAsync Help

I am new to programing and can not find or know what to search for to debug the thread that is started with the SendAsync Method. The code works good using the Send Method but when using SendAsync it goes to waiter.WaitOne() but i never get the callback (I think thats what its called) to myPing_PingCompleted. So two questions how do I de...

Unable to detect client disconnect on SendAsync

Hi, I have Server that needs to echo back data from client continously with a delay of 1 second. Following is the code. private void ProcessSend(SocketAsyncEventArgs e){ if (e.BytesTransferred > 0 && e.SocketError == SocketError.Success) { System.Threading.Thread.Sleep(1000); // Done echoing data back to the client....

SmtpClient.SendAsync - How to ensure my application doesn't finish before callback?

Hi, I need to send emails asychronously through a console application. I need to do some DB updates on the callback but my application is exiting before the callback code gets run! How can I stop this from happening in a nice manner rather than simply guessing how long to wait before exiting. I would imagine the Async calls get placed ...

Why can't you send multiple emails asynchronously using the same SmtpClient instance?

What it says on the tin. ...

Checking whether SendAsync has finished sending

As in the simplified code below, is checking that SendAsync() has finished transmitting all intended bytes in the buffer the correct thing to do? Or is that redundant? This is for a TCP connection socket. I am particularly concerned with having to issue a second sub-call to SendAsync() inside ProcessSend(). For example, if I had multip...

SmtpClient.SendAsync(); Not working on my new (64bit) computer.

Hi All, Okay, Only a couple weeks ago I had an old 32bit computer, but had to buy a new computer, which happens to be 64bit. I've rewritten the method that sends e-mails asynchonously and it just does not work. And does NOT throw any exceptions either. What gives? I have also tried the Async method code found iin MSDN, and the BlackW...

SmtpClient.SendAsync() does not work anymore

Hi All, I have recently purchased a new computer, and now my e-mails never get sent, and there are NEVER any exceptions thrown or anything. Can somebody please provide some samples that work using the SmtpClient class? Any help at all will be greatly appreciated. Thank you Updates Ok - I have added credentials now. And can SUCCESSFUL...