Hi Julien,
I'm afraid this is not exactly what I meant. Please try the following:
1. Sending your mails has to happen in its own
Thread.
2. In case your mail sending thread has successfully send the mail, you set a variable back in your main thread.
3. In your main thread you set a timer or something that realizes how many time has been spent.
4. After your time limit has been reached, you could check whether the mail sending thread set that variable yet (see 2.). If not, stop that thread and you could go on in your main thread.
BTW: Are you sure, that the mail connection you use to send that email, has no timeout parameter that can be set?
Cheers,
Ramon