Fixed segfault at POP3 connection error.
Added test for SMTP connection error.