Error upon wake-up from sleep.

I have an ‘stay open background only’ applescript that checks for new mail upon wake-up from sleep. Sometimes it works and sometimes it comes up with an error message 'Unable to connect to port 110…" I’m using a broadband cable modem. Here’s the code:

Is there anything I can change in the code to make this app more consistent. I thought ‘delay’ might work to give everything a chance to connect; but sometimes it connects and sometimes it doesn’t.

My first thought was a delay also. A 5 second, or so, delay wouldn’t do any harm, I say give it a try.

I tried delay. Still is inconsistent in connecting. When I press the ‘Get Mail’ button (in mail) after my script tries to work, Mail will retrieve mail OK. I’m wondering if it’s just the nature of the beast so to speak; something I’ll have to get used to. :?