diff -ru nagios-plugins-1.4.15/plugins/check_smtp.c mine/plugins/check_smtp.c --- nagios-plugins-1.4.15/plugins/check_smtp.c 2010-07-27 21:47:16.000000000 +0100 +++ mine/plugins/check_smtp.c 2011-02-03 16:17:29.000000000 +0000 @@ -190,14 +190,19 @@ printf ("%s", buffer); /* strip the buffer of carriage returns */ strip (buffer); - /* make sure we find the response we are looking for */ - if (!strstr (buffer, server_expect)) { - if (server_port == SMTP_PORT) - printf (_("Invalid SMTP response received from host: %s\n"), buffer); - else - printf (_("Invalid SMTP response received from host on port %d: %s\n"), - server_port, buffer); - result = STATE_WARNING; + /* make sure we got a valid connect response */ + if (!strstr (buffer, "220")) { + /* make sure we find the response we are looking for */ + if (!strstr (buffer, server_expect)) { + if (server_port == SMTP_PORT) + printf (_("Invalid SMTP response received from host: %s\n"), buffer); + else + printf (_("Invalid SMTP response received from host on port %d: %s\n"), + server_port, buffer); + result = STATE_WARNING; + } + /* Failed to connect, so bail */ + return result; } }