Log fewer errors when failing to connect to the SMTP server

Instead of logging an error for every failed attempt, log one for every
fifth failed attempt.  This means short intermittent connection failures
aren't reported to the system administrator at all, and long outages
produce less noise in the logs as well.