cleaned up logic

pull/1602/head
mdrush 2016-08-27 16:16:01 -07:00
parent 16a9de3b1b
commit 69a71b1a37
1 changed files with 18 additions and 20 deletions

View File

@ -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 );