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

    return(0) unless($password);

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