Keywords: Mode: All keywords (AND) |
Wed Jan 18, 2012 15:16
|
sms-dude: 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
|
Tue Jan 17, 2012 16:20
|
sms-dude: 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
|
Thu Feb 17, 2011 13:50
|
sms-dude: Operating system name and version: Ubuntu 10.04
Version of smsd: 3.1.11
Smsd installed from: sources
Name and model of a modem / phone: Teltonika G10
Interface: USB
Hi,
I have a problem with the email2sms script from this page.
SMSD is working, I receive sms when I put a sms file to /var/spool/sms/outgoing
Now I to send a mail to "+49176XXXXXXXXX" <sms@mydomain.com>
This is the result in procmail.log :
----------------------
From my@email.com Thu Feb 17 14:38:55 2011
Subject: Halali
Folder: /usr/local/bin/email2sms 5567
mktemp: failed to create file via template `/var/spool/sms/outgoing/smsgw.out.XXXXXX': Permission denied
/usr/local/bin/email2sms: 43: cannot create : Directory nonexistent
chmod: missing operand after `666'
Try `chmod --help' for more information.
-------------
This is the content of the email2sms script I have stored under /usr/local/bin/email2sms:
tmp=$(mktemp /tmp/smsgw.XXXXXX)
cat >$tmp
destinations=`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: $destination" < $tmp > $OUTFILE
chmod 666 $OUTFILE
echo "SMS queued to $OUTFILE"
done
rm $tmp
----------------
So apparently something with folder permissions.
Could anyone with better Linux/Unix understanding than I have explain what I have to change to make it work?
Thanks and best regards,
Matthias
|