[CentOS 6] mod to use ssmtp for text messaging

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
zmguy
Posts: 2
Joined: Thu Dec 15, 2016 5:04 pm

[CentOS 6] mod to use ssmtp for text messaging

Post by zmguy »

I'm using CentOS 6/ZoneMinder1.3 and had problems getting the messaging working with the normal SMTP. I did have to anable SSMTP_MAIL option to get the email for events working but messaging was still not sending. In checking the code in zmfilter.pl it was apparent that the
messaging code was not using the SSMTP_MAIL option.

I modified the sendMessage around line 916 (just before mail is sent at the line "### Send the Message") as follows:

Code: Select all

#start of mod            
            if ( $Config{ZM_SSMTP_MAIL} ){
                my $ssmtp_location = $Config{ZM_SSMTP_PATH};
                if( ! $ssmtp_location ){
                   $ssmtp_location = qx('which ssmtp');
                   if ( logDebugging() )
                   {
                      Debug( "which ssmtp: $ssmtp_location - set ssmtp path in options to suppress this message\n" );
                   }
                }
                $mail->send( 'sendmail', $ssmtp_location, $Config{ZM_MESSAGE_ADDRESS} );
            }else{
                MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 );
                $mail->send();
            }
# end of mod
# comment out:
            ### Send the Message
            #MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 );
            #$mail->send();
Text messages now use the SSMTP functions and the text's are sent successfully. Hope this helps somebody.
alabamatoy
Posts: 349
Joined: Sun Jun 05, 2016 2:53 pm

Re: [CentOS 6] mod to use ssmtp for text messaging

Post by alabamatoy »

Most of the cellphone vendors support an SMTP to text address. Verizon's, for example, is phone_num@vtext.com There is a huge big list here and elsewhere: http://mfitzp.io/list-of-email-to-sms-gateways/ You shouldn't have to change anything in the SSMTP to use these, just choose the correct recipient addresses.
Post Reply