Author |
Post |
|
#1 Wed Nov 06, 2013 11:34, 134 months ago.
|
Member
Registered: Nov 2013
Location: London, United Kingdom
|
Operating system name and version: Ubuntu Server 13.10 x64 Version of smsd: 3.1.15 Smsd installed from: sources Name and model of a modem: Huawei E173 Interface: USB
Hi,
I'm trying in the last few days to configure the smstools email2sms script to work with Postfix, but no luck...
sendsms works without any problem.
I've added these lines to main.cf: inet_interfaces = all mailbox_transport = smstools
And these lines to master.cf: smstools unix - n n - - pipe flags=DORhu user=smstools argv=/usr/local/bin/email2sms
This is /etc/aliases: smstools: | /usr/local/bin/email2sms
When I send an email (using telnet to port 25), I can see the following line in the Postfix log file: Nov 6 10:59:23 pappsmsgw01 postfix/local[2615]: 7C9A426077C: to=<smstools@pappsmsgw01>, orig_to=<44751xxxxxxx@pappsmsgw01>, relay=local, delay=0.09, delays=0.08/0/0/0, dsn=2.0.0, status=sent (delivered to command: /usr/local/bin/email2sms
But nothing coming through, and I can't see any activity in the smsd.log...
Please help... Thanks in advance!
|
|
#2 Mon Nov 11, 2013 09:20, 134 months ago.
|
Member
Registered: Nov 2013
Location: London, United Kingdom
Topic owner
|
Is no one here using smstools + postfix?!
Please help...
|
|
#3 Sun Nov 17, 2013 16:14, 134 months ago.
|
Member
Registered: Apr 2011
Location: Viseu / Viseu / Portugal, Portugal
|
I'm going to search for this tutorial or if you have an tutorial with this, please put it here.
I'm interested in this too! When you say script, my mind stops, because i dont' know quite well how to run the scripts.
But i'm an adventurous to this matter and i'm going to try!
Just put here some tutorial if you have!
|
|
#4 Mon Nov 25, 2013 14:37, 133 months ago.
|
Member
Registered: Nov 2013
Location: Stockholm, Sweden
|
Hi Batnun. First thing: What's the permissions on the script? (/usr/local/bin/email2sms) Second: What happends if you create an alias in postfix like: and then you try to send an e-mail to //Mattias
|
|
#5 Mon Nov 25, 2013 16:05, 133 months ago.
|
Member
Registered: Nov 2013
Location: London, United Kingdom
Topic owner
|
Hi Mattias,
a. The permissions on the file are 755, and everythig is running under root (include smstools).
b. I tried this already, I have entry on /etc/aliases:
<phone number>: smstools
Seding email to <Phone number>@pappsmsgw01, I can see the following lines in /var/log/mail.log:
Nov 25 15:57:27 pappsmsgw01 postfix/smtpd[18239]: connect from localhost[127.0.0.1] Nov 25 15:57:50 pappsmsgw01 postfix/smtpd[18239]: EFBFD26077C: client=localhost[127.0.0.1] Nov 25 15:58:18 pappsmsgw01 postfix/cleanup[18243]: EFBFD26077C: message-id=<20131125155750.EFBFD26077C@pappsmsgw01> Nov 25 15:58:19 pappsmsgw01 postfix/qmgr[18237]: EFBFD26077C: from=<me@nowhere>, size=376, nrcpt=1 (queue active) Nov 25 15:58:19 pappsmsgw01 postfix/local[18244]: EFBFD26077C: to=<smstools@pappsmsgw01>, orig_to=<447512345678@pappsmsgw01>, relay=local, delay=41, delays=41/0/0/0, dsn=2.0.0, status=sent (delivered to command: /usr/local/bin/email2sms) Nov 25 15:58:19 pappsmsgw01 postfix/qmgr[18237]: EFBFD26077C: removed Nov 25 16:01:29 pappsmsgw01 postfix/smtpd[18239]: disconnect from localhost[127.0.0.1]
But nothing in the smstools...
|
|
#6 Mon Nov 25, 2013 19:53, 133 months ago.
|
Member
Registered: Nov 2013
Location: Stockholm, Sweden
|
Sorry for the stupid questions/suggestions...
Can you post a copy of /usr/local/bin/email2sms here so we can compare it towards the example script delivered with SMSTools. (I assume this is the script you're using).
//Mattias
|
|
#7 Mon Nov 25, 2013 19:58, 133 months ago.
|
Member
Registered: Nov 2013
Location: Stockholm, Sweden
|
Wait. I found one thing that is strange and might cause the problem... You said you were running everything as root. But it the postfix config you specify "smstools" as the user for the script. Quote smstools unix - n n - - pipe flags=DORhu user=smstools argv=/usr/local/bin/email2sms
Try changing it to root or run smsd as smstools //Mattias
|
|
#8 Tue Nov 26, 2013 10:21, 133 months ago.
|
Member
Registered: Nov 2013
Location: London, United Kingdom
Topic owner
|
So, to run under root, do I need to change:
main.cf: inet_interfaces = all mailbox_transport = root
master.cf: root unix - n n - - pipe flags=DORhu user=root argv=/usr/local/bin/email2sms
aliases: root: | /usr/local/bin/email2sms 447512345678: root
So, changing smstools --> root in all the configuration files?...
Thanks in advance!
|
|
#9 Tue Nov 26, 2013 10:56, 133 months ago.
|
Member
Registered: Nov 2013
Location: Stockholm, Sweden
|
You only need to change in master.cf.
Change from: smstools unix - n n - - pipe flags=DORhu user=smstools argv=/usr/local/bin/email2sms
To: smstools unix - n n - - pipe flags=DORhu user=root argv=/usr/local/bin/email2sms
//Mattias
|
|
#10 Tue Nov 26, 2013 11:22, 133 months ago.
|
Member
Registered: Nov 2013
Location: London, United Kingdom
Topic owner
|
Ok, just tried that: root@pappsmsgw01:~# telnet localhost 25 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 pappsmsgw01 ESMTP Postfix (Ubuntu) helo g 250 pappsmsgw01 mail from: batnun@somewhere 250 2.1.0 Ok rcpt to: 447512345678@pappsmsgw01 250 2.1.5 Ok data 354 End data with <CR><LF>.<CR><LF> To: 447512345678 at least i have chicken . 250 2.0.0 Ok: queued as 6979B260780 quit 221 2.0.0 Bye root@pappsmsgw01:~# tail -f /var/log/mail.log
Nov 26 11:15:57 pappsmsgw01 postfix/smtpd[1511]: connect from localhost[127.0.0.1] Nov 26 11:16:20 pappsmsgw01 postfix/smtpd[1511]: 6979B260780: client=localhost[127.0.0.1] Nov 26 11:16:34 pappsmsgw01 postfix/cleanup[1515]: 6979B260780: message-id=<20131126111620.6979B260780@pappsmsgw01> Nov 26 11:16:34 pappsmsgw01 postfix/qmgr[1508]: 6979B260780: from=<batnun@somewhere>, size=377, nrcpt=1 (queue active) Nov 26 11:16:34 pappsmsgw01 postfix/local[1516]: 6979B260780: to=<smstools@pappsmsgw01>, orig_to=<447512345678@pappsmsgw01>, relay=local, delay=28, delays=28/0/0/0.03, dsn=2.0.0, status=sent (delivered to command: /usr/local/bin/email2sms) Nov 26 11:16:34 pappsmsgw01 postfix/qmgr[1508]: 6979B260780: removed Nov 26 11:16:37 pappsmsgw01 postfix/smtpd[1511]: disconnect from localhost[127.0.0.1] But I can see nothing in smsd.log (the service is running) Thanks!
|
|
#11 Fri Feb 28, 2014 07:30, 130 months ago.
|
Member
Registered: Feb 2014
Location: Singapore
|
the default email2sms script doesn't work for me. so i tried my hand on a python script.
u may try out my script. 1. replace your email2sms with script below and save as email2sms.py 2. change your postfix master.cf to point to email2sms.py instead.
=================================== #!/usr/bin/env python
import email.parser import sys import string import random import os import pwd import grp
full_msg = sys.stdin.readlines() msg = email.message_from_string(''.join(full_msg)); ranext = (''.join(random.choice(string.ascii_lowercase) for i in range(9)))
sms_file = open("/var/spool/sms/outgoing/sms."+ranext, 'w') print >> sms_file, "To:",msg['to'].split('@')[0][1:] print >> sms_file, "\nSubject:",msg['subject'] print >> sms_file, "Date:",msg['date'] """ Do not include msg.get_pyload for Zabbix """ print >> sms_file, "\n",msg.get_payload() sms_file.close()
path = "/var/spool/sms/outgoing" for root, dirs, files in os.walk(path): for file in files: fname = os.path.join(root, file) os.chown(fname, pwd.getpwnam("smsd").pw_uid, grp.getgrnam("smsd").gr_gid)
========================
cheers!
|