SMS Server Tools 3
This site is hosted by Kekekasvi.com
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. Please login or register. Thu Mar 28, 2024 22:20
SMSTools3 Community » Help and support Bottom

sms2mail script error

Login and Post Reply

Page:  1

Author Post
Member
Registered:
Jul 2014
Location: Lithuania
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?

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Your system does not have formail command. Install the procmail package:

# sudo apt-get install procmail

Member
Registered:
Jul 2014
Location: Lithuania
Topic owner
Thanks,

I have one more question:

how to add subject text to mail?

when i used : echo -n "$message" | /usr/sbin/sendmail "$EMAIL" in email shows that mail recieved from my email (from config), but subject field is empty.

when i use : echo -n "$message" | mail -s "subject" "$EMAIL" , in email shows that mail recieved from root, and subject is good, but i don't show recieved sms text.

Member
Registered:
Mar 2016
Location: Russian Federation
micka wrote
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


« Last edit by Vix on Wed Mar 09, 2016 00:06, 98 months ago. »
Member
Registered:
Mar 2016
Location: Russian Federation
Attention! this option removes your SMS, if you configure script, comment out this command.
...
## delete all sms
##rm -f $PATHSMS/*


« Last edit by Vix on Wed Mar 09, 2016 04:48, 98 months ago. »

Login and Post Reply

Page:  1

SMSTools3 Community » Help and support Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.