Thanks.
Apologies if I wasn't clear in what the problem is.
That is the way all email clients work, take a look on mozila thunderbird for example, it does not block you from working but the "mail window" remains open for a few seconds after you press the send button. Why don't you install thunderbird and send an email with it for testing see how long it takes thunderbird to send it and compare that with your application.
It takes 5 seconds in Thunderbitd as well on my PC/Connection. BUT, in Thunderbird I can carry on doing other things, as was pointed out.
which makes it a system or network problem not a code problem.
In my project I can't. I have to wait for the email to send.
To solve this you need to use threads or non blocking sockets. I would recommend threads obviously but its your decision to make, both solutions require time and can't be applied pronto as you have put it.
I attach a project with your code, as well as a screenshot.
Got it I'll take a closer look when I find a bit of time but I doubt I'll see anything useful. I might find some problems in my network/system if I dig deep enough but I doubt that would be of any use to you.
As you can see, I have added a button to the form that does nothing but increment a counter an display that on a label.
As soon as I click the 'SEND' button, I cannot click on the ADD button anymore until the send completes or fails. So the app hasn't frozen, it's just waiting.
That's what I mend when I said "freeze while sending" the application stops responding for what ever reason for a period of time.
there are a couple of questions you need to answer.
1) Are the changes you are going to make helpful to your end users or not? If for example your end users use a different provider than google that has different requirements, would the changes in your code be as fast there or there is a chance that they will loose speed instead?
2) Are you responsible for their network and response times?
3) Do you plan on providing network services on top of the program?
4) Do you want to have to explain to each end user the reason why your application waits?
5) Do you want to have to prove that its not your application but their systems?
6) Who is going to pay for all that time spend? The end users or you?
overall its your decision to make I can only tell you what I would do in your position.
Am I correct in understanding (apart from the speed issue) that it is normal for the system to wait until the email has finished sending?
depends what do you mean by system? do you mean the OS, application or send process? Anyway the smtp protocol is well defined and it does not have any optional steps which means that the server is obliged to send a response that the communication ended correctly. It does not, how ever, define if you have to wait for the response or inform the end user about its status.
Hope that clears up a couple of things. fill free to ask more questions if it does not.