I want to add a test for a secure IMAP connection, authentication being part of it. 

That I would run using a cron job. If anything wrong happens I do want to get and email, so if it goes well it should have no output.

Does anyone have such a script, bash, python,...?