From 69a71b1a375c5c405ab9f8732a7c466e51041e07 Mon Sep 17 00:00:00 2001
From: mdrush <mrusheen@gmail.com>
Date: Sat, 27 Aug 2016 16:16:01 -0700
Subject: [PATCH] cleaned up logic

---
 scripts/zmfilter.pl.in | 38 ++++++++++++++++++--------------------
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/scripts/zmfilter.pl.in b/scripts/zmfilter.pl.in
index 33b4ab1a2..e2ee7597f 100755
--- a/scripts/zmfilter.pl.in
+++ b/scripts/zmfilter.pl.in
@@ -798,20 +798,19 @@ sub sendEmail
             ### Send the Message
             if ( $Config{ZM_SSMTP_MAIL} ) {
                 my $ssmtp_location = $Config{ZM_SSMTP_PATH};
-                if( !$ssmtp_location ) {
+                if ( !$ssmtp_location ) {
                     if ( logDebugging() ) {
                         Debug( "which ssmtp: $ssmtp_location - set ssmtp path in options to suppress this message\n" );
                     }
-                    
                     $ssmtp_location = qx('which ssmtp');
-                    if ( !$ssmtp_location ) {
-                        Debug( "Can't find ssmtp, trying MIME::Lite->send" );
-                        MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 );
-                        $mail->send();
-                    } else {
-                        ### Send using SSMTP
-                        $mail->send( 'sendmail', $ssmtp_location, $Config{ZM_EMAIL_ADDRESS} );
-                    }
+                }
+                if ( !$ssmtp_location ) {
+                    Debug( "Can't find ssmtp, trying MIME::Lite->send" );
+                    MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 );
+                    $mail->send();
+                } else {
+                    ### Send using SSMTP
+                    $mail->send( 'sendmail', $ssmtp_location, $Config{ZM_EMAIL_ADDRESS} );
                 }
             } else {
                 MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 );
@@ -913,20 +912,19 @@ sub sendMessage
             ### Send the Message
             if ( $Config{ZM_SSMTP_MAIL} ) {
                 my $ssmtp_location = $Config{ZM_SSMTP_PATH};
-                if( !$ssmtp_location ) {
+                if ( !$ssmtp_location ) {
                     if ( logDebugging() ) {
                         Debug( "which ssmtp: $ssmtp_location - set ssmtp path in options to suppress this message\n" );
                     }
-                    
                     $ssmtp_location = qx('which ssmtp');
-                    if ( !$ssmtp_location ) {
-                        Debug( "Can't find ssmtp, trying MIME::Lite->send" );
-                        MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 );
-                        $mail->send();
-                    } else {
-                        ### Send using SSMTP
-                        $mail->send( 'sendmail', $ssmtp_location, $Config{ZM_MESSAGE_ADDRESS} );
-                    }
+                }
+                if ( !$ssmtp_location ) {
+                    Debug( "Can't find ssmtp, trying MIME::Lite->send" );
+                    MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 );
+                    $mail->send();
+                } else {
+                    ### Send using SSMTP
+                    $mail->send( 'sendmail', $ssmtp_location, $Config{ZM_MESSAGE_ADDRESS} );
                 }
             } else {
                 MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 );