In MESSAGE_ADDRESS put in both numbers separated by a semi-colon:
8005551212@txt.att.net;9005551212@messaging.sprintpcs.com
These changes are all done in zmFilter.pl
function: checkFilter (just a portion)
Code: Select all
if ( $Config{ZM_OPT_MESSAGE} && $filter->{AutoMessage} )
{
if ( !$event->{Messaged} )
{
#$delete_ok = undef if ( !sendMessage( $filter, $event ) );
my $ma;
$ma = $Config{ZM_MESSAGE_ADDRESS};
if ( $ma )
{
my @fields = split /;/, $ma;
my ($ma1, $ma2) = @fields[0, 1];
$delete_ok = undef if ( !sendMessage( $filter, $event, $ma1 ) );
if ( $ma2 )
{
#$delete_ok = undef if ( !sendMessage( $filter, $event, $ma2 ) );
sendMessage( $filter, $event, $ma2 );
}
}
}
}
Code: Select all
sub sendMessage
{
my $filter = shift;
my $event = shift;
my $message_address = shift;
if ( ! $Config{ZM_FROM_EMAIL} )
{
Error( "No 'from' email address defined, not sending message" );
return( 0 );
}
#if ( ! $Config{ZM_MESSAGE_ADDRESS} )
if ( ! $message_address )
{
Error( "No message address defined, not sending message" );
return( 0 );
}
Info( "Creating notification message\n" );
my $subject = substituteTags( $Config{ZM_MESSAGE_SUBJECT}, $filter, $event );
return( 0 ) if ( !$subject );
my @attachments;
my $body = substituteTags( $Config{ZM_MESSAGE_BODY}, $filter, $event, \@attachments );
return( 0 ) if ( !$body );
Info( "Sending notification message '$subject'\n" );
eval
{
if ( $Config{ZM_NEW_MAIL_MODULES} )
{
### Create the multipart container
my $mail = MIME::Lite->new (
From => $Config{ZM_FROM_EMAIL},
#To => $Config{ZM_MESSAGE_ADDRESS},
To => $message_address,
Subject => $subject,
Type => "multipart/mixed"
);
### Add the text message part
$mail->attach (
Type => "TEXT",
Data => $body
);
### Add the attachments
foreach my $attachment ( @attachments )
{
Info( "Attaching '$attachment->{path}\n" );
$mail->attach(
Path => $attachment->{path},
Type => $attachment->{type},
Disposition => "attachment"
);
}
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} );
$mail->send( 'sendmail', $ssmtp_location, $message_address );
}else{
MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 );
$mail->send();
}
### Send the Message
#MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 );
#$mail->send();
}
else
{
my $mail = MIME::Entity->build(
From => $Config{ZM_FROM_EMAIL},
#To => $Config{ZM_MESSAGE_ADDRESS},
To => $message_address,
Subject => $subject,
Type => (($body=~/<html>/)?'text/html':'text/plain'),
Data => $body
);
foreach my $attachment ( @attachments )
{
Info( "Attaching '$attachment->{path}\n" );
$mail->attach(
Path => $attachment->{path},
Type => $attachment->{type},
Encoding => "base64"
);
}
$mail->smtpsend( Host => $Config{ZM_EMAIL_HOST},
MailFrom => $Config{ZM_FROM_EMAIL}
);
}
};
if ( $@ )
{
Error( "Can't send email: $@" );
return( 0 );
}
else
{
Info( "Notification message sent\n" );
}
my $sql = "update Events set Messaged = 1 where Id = ?";
my $sth = $dbh->prepare_cached( $sql )
or Fatal( "Can't prepare '$sql': ".$dbh->errstr() );
my $res = $sth->execute( $event->{Id} )
or Fatal( "Can't execute '$sql': ".$sth->errstr() );
return( 1 );
}