Home Directory

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com


Remember Me

Directory Tree



byjtlatuvm, November 3, 2017
We've used this package to make sure our email environment is delivering messages in a timely fashion. It's a great tool. However, it hasn't been updated in some time.

check_smtp_send depends on Net::SMTP::TLS which is no longer maintained and breaks with new IO::Socket::SSL. That's when you'll see:

invalid SSL_version specified

The fix is to change check_smtp_send to use Net::SMTP which now directly supports STARTTLS.


diff --git a/check_smtp_send b/check_smtp_send
index ade0fe3..9be3869 100755
--- a/check_smtp_send
+++ b/check_smtp_send
@@ -85,7 +85,6 @@ if( $smtp_server eq "" && scalar(@mailto) == 1 ) {
my @required_module = ();
push @required_module, 'Net::SMTP::SSL' if $ssl;
push @required_module, ('MIME::Base64','Authen::SASL') if $ssl && $username;
-push @required_module, 'Net::SMTP::TLS' if $tls;
push @required_module, 'Net::SMTP_auth' if $auth_method and not $tls; # whereas if auth_method and tls we use TLS_auth, which is included in this script!
push @required_module, 'Text::Template' if $template;
push @required_module, 'Net::DNS' if $mx_lookup;
@@ -141,7 +140,7 @@ if( $mx_lookup ) {

# connect to SMTP server
-# create the smtp handle using Net::SMTP, Net::SMTP::SSL, Net::SMTP::TLS, or an authentication variant
+# create the smtp handle using Net::SMTP, Net::SMTP::SSL, or an authentication variant
my $smtp;
eval {
if( $tls and $auth_method ) {
@@ -154,7 +153,7 @@ eval {
elsif( $tls ) {
$smtp_port = $default_smtp_tls_port unless $smtp_port;
- $smtp = Net::SMTP::TLS->new($smtp_server, Timeout=>$timeout, Port=>$smtp_port, User=>$username, Password=>$password);
+ $smtp = Net::SMTP->new($smtp_server, Timeout=>$timeout, Port=>$smtp_port, User=>$username, Password=>$password, starttls=>1);
if( $smtp ) {
my $message = oneline($smtp->message());
die "cannot connect with TLS: $message" if $smtp->code() =~ m/53\d/;