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. Tue Apr 23, 2024 06:09
SMSTools3 Community » Help and support Bottom

email2sms: Extract phone number from email address?

Login and Post Reply

Page:  1

Author Post
Member
Registered:
Feb 2011
Location: Switzerland
Ubuntu 10.04:
3.14:
Smsd installed from: sources
Teltonika G10 :
Interface: USB

Hi,
sorry, I'm not familiar with perl at all, so I don't really understand what the email2sms script is exactly doing.
I got it working so far, anyway.

My problem is: I have an application that is sending email alerts, and I want to convert this alerts to sms.
Unfortunately this application does not allow to enter email addresses in the format "SMS +1234567" mail@mail.com

So is it somehow possible to extract the mobile number from the email address if it is in the format 1234567@mail.com?

That would be very helpful.

Thanks in advance, best regards,
Matthias

Member
Registered:
Feb 2011
Location: Switzerland
Topic owner
Hi again,

okay, I found a code snippet that might do what I need:

PHONENUMBER=`formail -z -x"To:" | cut -d'@' -f1 | sed -e 's/[^0-9\+]//g'`

Is there anbody who has an idea where to place it in the email2sms script?

I tried it this way:

tmp=$(mktemp /tmp/smsgw.XXXXXX)
cat >$tmp
destinations=`formail -z -x"To:" | cut -d'@' -f1 | sed -e 's/[^0-9\+]//g' < $tmp`
#=`formail -zx "To:" < $tmp`
IFS=,
for destination in $destinations; do
destination=${destination## }
OUTFILE=$(mktemp /var/spool/sms/outgoing/smsgw.out.XXXXXX)
formail -f -I "To:" < $tmp > $OUTFILE
chmod 666 $OUTFILE
echo "SMS queued to $OUTFILE"
done
rm $tmp

But without success.
Is there anybody out there who could help me?
It also would be very helpful if someone could comment the original email2sms script:
if I could understand what it is doing, I think could manage it by my own...
Particularly what is the destination=${destination## } line doing?

Any help is very appreciated.

Thanks,
Matthias

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.