sub imap_login {
    use Mail::IMAPClient;
    my($host, $port, $account, $password) = @_;

    if ($imap = Mail::IMAPClient->new(
	Server		=> $host, 
	Port		=> $port,
	User		=> $account,
	Password	=> $password
    )) {
	$imap->logout();
	return(1);
    } else {
	return(0);
    }
}
