Compare commits

..

1 commit

Author SHA1 Message Date
Benjamin Renard
12e06ba2dd First release for SMS Gateway Ultimate Android App 2017-11-14 17:34:28 +01:00

View file

@ -3,7 +3,7 @@
#
# Mail2SMS
#
# Postfix transport to sending SMS by using SMS Gateway Android App
# Postfix transport to sending SMS by using SMS Gateway Ultimate Android App
#
# SMS recipients are detected in call arguments and To, CC and BCC
# mail headers. The phone number detection mechamism look for a suite
@ -20,7 +20,7 @@
# in master.cf :
#
# sms unix - n n - 1 pipe
# flags=Rq user=nobody:nogroup argv=/usr/local/sbin/mail2sms ${user}
# flags=Rq user=nobody:nogroup argv=/usr/local/sbin/mail2sms -H [SMS Host] -p [SMS Port] -s ${user}
#
# in transport :
#
@ -32,13 +32,10 @@
#
# Android App :
# * Install this app :
# https://play.google.com/store/apps/details?id=eu.apksoft.android.smsgateway
# https://play.google.com/store/apps/details?id=com.icecoldapps.smsgatewayultimate
# * In App
# * In Settings screen :
# * check "Listen for HTTP send SMS commands"
# * check "Prevent CPU sleep mode" (adviced)
# * check "Start gateway automatically after phone boot" (adviced)
# * Start server in main screen
# * Add SMS Gateway and keep attention on port
# * Start SMS gateway in main screen
#
# Usage :
#
@ -144,8 +141,9 @@ def send_sms(recipient, text):
start=stop
return True
url_params={
'phone': recipient,
'text': text.encode('utf8')
'smstype': 'sms',
'smsto': recipient,
'smsbody': text.encode('utf8')
}
if options.smspwd:
url_params['password']=options.smspwd
@ -153,7 +151,7 @@ def send_sms(recipient, text):
url_parts=[
'http',
'%s:%s' % (options.smshost, options.smsport),
'/sendsms',
'/send.html',
'',
urlencode(url_params),
''
@ -167,7 +165,7 @@ def send_sms(recipient, text):
logging.fatal('Fail to open URL %s : %s' % (url,e))
return False
logging.debug(u'SMS gateway return : "%s"' % data)
if re.search('Mess?age SENT!', data):
if re.search('The SMS has been sent', data):
return True
logging.error('Fail to send SMS. Gateway return : "%s"' % data)
return False
@ -181,7 +179,7 @@ def check_gateway_status():
logging.fatal('Fail to open URL %s : %s' % (url,e))
return False
logging.debug(u'SMS gateway return : "%s"' % data)
if re.search('Welcome to SMS Gateway', data):
if re.search('Text:', data):
return True
return False