Wed Mar 09, 2016 04:45
|
Vix: Attention! this option removes your SMS, if you configure script, comment out this command.
...
## delete all sms
##rm -f $PATHSMS/*
|
Wed Mar 09, 2016 00:01
|
Vix:
Operating system name and version: Ubuntu 12.04 LTS
Version of smsd: 3-3.1.15
Smsd installed from: from web
Name and model of a modem / phone: teltonika CM1100 modem
Interface:USB
Hi,
when i using this script:
smstools3.kekekasvi.com/topic.php?id=505
i have recieved this error /usr/local/bin/smsd_eventhandler.sh: line 8: formail: command not found
FROM=`formail -zx From: < $2`
when i change FROM=`formail -zx From: < $2` to FROM='formail -zx From: < $2' or FROM="formail -zx From: < $2" it's send info to mail, but text is distorted.
example:
subject: New SMS received from formail -zx From: < $2
body: cat $2
I need that all the sms content to be ported to mail a letter body , and in subject will show phone number.
can someone help?
I'm sorry if it's not what you asked, I did not use the script package, and
wrote his own, simpler and more versatile. I do not pretend that either the
script freeware, most importantly what would have helped you. Debian System
Jessie, mail agents: mail or mutt.
#!/bin/bash
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
MAIL_FROM=smstools@myhost.ru
MAIL_TO=admin@myhost.ru
PATHSMS="/var/spool/sms/incoming";
LISTSMS=( `ls -x -c $PATHSMS` );
TEXT=;
MESSAGE=;
## default agent mail, else mutt
SENDER_AGENT="mail";
## make messages
function makeMessage() {
if sed -e '/^$/ q' < "$MESSAGE" | grep -q "^Alphabet: UCS2";
then
TEXT="$(sed -e '/^$/ q' < "$MESSAGE" | sed -e 's/Alphabet: UCS2/Alphabet: UTF-8/g')";
TEXT="$(echo -e $TEXT"\n"$(sed -e '1,/^$/ d' < "$MESSAGE" | iconv -f UNICODEBIG -t UTF-8))";
else
TEXT="$(sed -e '1,/^$/ d' < "$MESSAGE")";
fi
NUM="$(echo $TEXT|grep -E '^From:'|sed -r 's/.*From_SMSC: //; s/S.*//')";
sendMessage
}
## send messages
function sendMessage() {
if [ "$SENDER_AGENT" = "mail" ]
then
SUBJECT='Incoming SMS message with numbers:'$NUM
TEXTBODY=$TEXT
echo -e $TEXTBODY|mailx -a "Content-Type: text/plain; charset=UTF-8" -s "$SUBJECT" $MAIL_TO
fi
if [ "$SENDER_AGENT" = "mutt" ]
then
SUBJECT='Incoming SMS message with numbers:'$NUM
TEXTBODY=$TEXT
echo -e $TEXTBODY|mutt -s "$SUBJECT" $MAIL_TO
fi
}
## test enable sms mesages
if [ ! "$(ls -x $PATHSMS)" ]
then
exit 0
fi
## executor
ex_index=$((${#LISTSMS[@]}-1));
while [ $ex_index -gt -1 ]
do
MESSAGE="$PATHSMS"/"${LISTSMS[$ex_index]}";
makeMessage
ex_index=$(($ex_index-1));
done
## delete all sms
rm -f $PATHSMS/*
Good luck
|