Try to write a line just before the e-mail sending that checks if your bot is still logged in. Is it possible that sometimes it loses the logged-in status?-- Bináris