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

Need help with email2sms / Postfix...

Login and Post Reply

Page:  1

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

Member
Registered:
Nov 2013
Location: London, United Kingdom
Topic owner
Is no one here using smstools + postfix?!

Please help...

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!

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

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

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

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

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!

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

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!

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!

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.