mail_cmd.py: fix connect error recovery