SMS Server Tools 3
 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. The forum is currently read-only, but will open soon. Fri Nov 22, 2024 02:21
SMSTools3 Community » Help and support Bottom

[answered] auto responder + sms2email

  This topic is locked

Page:  1

Author Post
Member
Registered:
Jul 2010
Location: Gauteng, South Africa
Operating system name and version: Ubuntu 10.04 64bit
Version of smsd: 3
Smsd installed from: sources
Name and model of a modem / phone: m1306b Wavecom Fasttrack
Interface: serial


Hi

This is the first time I am using smstools it looks great.

I have managed to setup my modem to send and receive sms's, I see that you have an auto responder function, please will someone explain how to get it to work and how to forward the new sms to email address.

I am not sure how to get the event handler function to work.
Also is there a list of the options you can use un the smsd.conf file?

The goal is.

1. If someone sends an sms to my number, it must automatically reply back to the sender saying "Thank you for the sms bla bla bkla"

2. Then I want that sms the guy sended to be forwarded to my email address.

Thank you

Member
Registered:
Jul 2010
Location: Gauteng, South Africa
Topic owner
Hi,

I managed to get the sms2mail working does anyone know how to get the auto responder to work?

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Some sample eventhandlers are available here in the forum, but they do not do exactly what you need.

Here is a new sample. The idea is that respond is only sent to the ordinary numbers, not to short numbers or alphabetic numbers which are messages from the operator (and/or may cause more than usual costs).

#!/bin/bash

EMAIL="username@localhost"

if [ "$1" == "RECEIVED" ]; then

  #[ -n "$EMAIL" ] && /usr/sbin/sendmail $EMAIL <$2
  if [ -n "$EMAIL" ]; then
    sms=`cat $2`
    message="From: sms@localhost
To: $EMAIL
Subject: New SMS received

${sms}"


    echo -n "$message" | /usr/sbin/sendmail "$EMAIL"
  fi

  FROM_TOA=`formail -zx From_TOA: < $2`

  if [[ "$FROM_TOA" == *$'international'* ]]; then

    FROM=`formail -zx From: < $2`

    FILE=`mktemp /tmp/send_XXXXXX`
    echo "To: $FROM" > $FILE
    echo "" >> $FILE
    echo -n "Thank you for the sms bla bla bkla" >> $FILE

    FILE2=`mktemp /var/spool/sms/outgoing/send_XXXXXX`
    mv $FILE $FILE2

  fi
fi
 
 
'bash' Syntax Highlight powered by GeSHi


spazman wrote
Also is there a list of the options you can use un the smsd.conf file?

This is the only list of options: How to configure. Sample smsd.conf with all possible options is not kept up to date, because it's not very useful.


« Last edit by keke on Fri Jul 16, 2010 11:04, 174 months ago. »
Member
Registered:
Jul 2010
Location: Gauteng, South Africa
Topic owner
Thank you so much that script worked out of the box

Just one more thing now the email stopped working I can only have event handler at a time?

Is there a way past it will it work if I combine the 2 scripts into one?

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Only one eventhandler can be defined, but the script can call any "sub-eventhandlers" if necessary. For example:

/usr/local/bin/smsd_eventhandler.sh:

#!/bin/bash

/usr/local/bin/smsd_eventhandler_forward.sh "$1" "$2" "$3"
/usr/local/bin/smsd_eventhandler_mail.sh "$1" "$2" "$3"
 
'bash' Syntax Highlight powered by GeSHi


Also, scripts can be included in the "master" eventhandler:

#!/bin/bash

. /usr/local/bin/smsd_eventhandler_forward.sh
. /usr/local/bin/smsd_eventhandler_mail.sh
 
'bash' Syntax Highlight powered by GeSHi


And, which is the most used way, the script can contain all actions which are required. In this case just add your email code to the end of a script, or after the test "if [ "$1" == "RECEIVED" ]; then". I edited the example in this way.

Member
Registered:
Jul 2010
Location: Gauteng, South Africa
Topic owner
Hi

Thank you for the reply the sms tools are working like a charm...

Just one question is there a way to redefine the E-mail being send.

The current Layout is

from : root@localhost
to : 27xxxxxxx@localhost
Subject : GSM1
Body
the message I send

Can we change it to something like

from : sms@localhost
to : assignedemailadress@localhost
Subject : New SMS received
and the body of the message?

Regards

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
I edited the script to include this kind of a change.

There are all headers from SMS file included in the body of e-mail, because I think that those header are important, for example who sent the SMS and when it was sent and received.

  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.