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 09:58
SMSTools3 Community » Help and support Bottom

[answered] SMS 2 EMAIL

  This topic is locked

Page:  1

Author Post
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.

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
In the global part of smsd.conf define an eventhandler:
eventhandler = /usr/local/bin/smsd_eventhandler.sh

Create 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, 161 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

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.

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.

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}".

  This topic is locked

Page:  1

SMSTools3 Community » Help and support Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.