Author |
Post |
|
#1 Fri Dec 24, 2010 11:46, 172 months ago.
|
Member
Registered: Nov 2010
Location: Sindh, Pakistan
|
Hello, I m using SMSTOOLS3 on SUSE10 with Postfix as MTA.
Now i want if some one send a SMS to my Number, then it will send a sms as a email on my email address.
|
|
#2 Fri Dec 24, 2010 11:59, 172 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
In the global part of smsd.conf define an eventhandler: eventhandler = /usr/local/bin/smsd_eventhandler.shCreate this script and make it executable for smsd: chmod 755 ... The script with following content will do the job: #!/bin/bash EMAIL="username@localhost" if [ "$1" == "RECEIVED" ]; then if [ -n "$EMAIL" ]; then FROM=`formail -zx From: < $2` sms=`cat $2` message="From: sms@localhost To: $EMAIL Subject: New SMS received from ${FROM} ${sms}" echo -n "$message" | /usr/sbin/sendmail "$EMAIL" fi fi 'bash' Syntax Highlight powered by GeSHi « Last edit by keke on Mon Dec 27, 2010 11:25, 172 months ago. »
|
|
#3 Mon Dec 27, 2010 06:24, 172 months ago.
|
Member
Registered: Nov 2010
Location: Sindh, Pakistan
Topic owner
|
Thanks keke,
I need an one more favour, how can i grep the sender mobile number from the SMS and attached with Subject line
|
|
#4 Mon Dec 27, 2010 11:24, 172 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
mfaisal wrote I need an one more favour, how can i grep the sender mobile number from the SMS and attached with Subject line
The script is now updated to include that.
|
|
#5 Tue Dec 28, 2010 06:53, 172 months ago.
|
Member
Registered: Nov 2010
Location: Sindh, Pakistan
Topic owner
|
Hi Keke, According to you my script is: But Sender mobile number is not attached with subject yet.
|
|
#6 Tue Dec 28, 2010 10:59, 172 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Your modified script is using FROM variable before it is set. Try to change "$SUBJECT" to "${SUBJECT}${FROM}".
|