User Tools

Site Tools


send_sms_to_multiple_recipients_gt2_lx800

How to send SMS to multiple recipients on GT2 and LX800 series

Multi to fields and multi numbers in to field separated by space.

Using this script you will be able send SMS to multiple recipients on GT2, GT-S, and LX800 series.

#0: Example format

To: 39XXXXXX 39XXXXXX 39XXXXXX
To: 39XXXXXX
To: Etc.

Text body

:id1: Note: the numbers of “To:” headers is not limited, use them if necessary.

#1: Create and save the script

Save the script below into the path: /etc/sms/scripts/mailmultito

#!/bin/bash

# Sample script to allow multiple recipients in one message file.
# Define this script as a checkhandler.

outgoing="/var/spool/sms/outgoing"

recipients=`formail -zx "To:" < "$1"`

#count=`echo "$recipients" | wc -l`
count=`echo "$recipients" | wc -w`
if [ $count -gt 1 ]; then

  # Will need echo which accepts -n argument:
  ECHO=echo
  case `uname` in
    SunOS)
      ECHO=/usr/ucb/echo
      ;;
  esac

  messagebody=`sed -e '1,/^$/ d' < "$1"`
  headers=`formail -X "" -I "To:" -f < "$1"`

  for recipient in $recipients
  do
    file=`mktemp $outgoing/send_XXXXXX`
    $ECHO "To: $recipient" > $file
    if [ "x$headers" != "x" ]; then
      $ECHO "$headers" >> $file
    fi
    $ECHO "" >> $file
    $ECHO -n "$messagebody" >> $file
  done

  # Remove processed file:
  rm $1

  # Tell to smsd that checkhandler has spooled this message:
  exit 2
fi

exit 0

#2: Execute a permission change to allow execution

Use the command:

chmod 0777 /etc/sms/scripts/mailmultito

#3: Edit SMSD configuration file

Open the file /etc/smsd.conf and in the “global section” add this check handler:

checkhandler=/etc/sms/scripts/mailmulito
send_sms_to_multiple_recipients_gt2_lx800.txt · Last modified: 2017/03/28 13:09 by admin