make config mandatory for the mailserver to start
This commit is contained in:
parent
4d1bf34e3c
commit
f84f30376d
|
@ -1,2 +1,9 @@
|
||||||
|
; RENAME THIS FILE TO config.ini FIRST
|
||||||
|
|
||||||
|
[GENERAL]
|
||||||
; Enter your domains here. Comma separated if multiple
|
; Enter your domains here. Comma separated if multiple
|
||||||
DOMAINS=yourdomain,sub.yourdomain
|
DOMAINS=yourdomain,sub.yourdomain
|
||||||
|
|
||||||
|
[MAILSERVER]
|
||||||
|
; Port that the Mailserver will run on (default 25 but that needs root)
|
||||||
|
MAILPORT=25
|
|
@ -5,6 +5,7 @@ import email
|
||||||
from email.header import decode_header
|
from email.header import decode_header
|
||||||
from email.Utils import parseaddr
|
from email.Utils import parseaddr
|
||||||
#import requests
|
#import requests
|
||||||
|
import ConfigParser
|
||||||
import time
|
import time
|
||||||
import os, sys
|
import os, sys
|
||||||
import json
|
import json
|
||||||
|
@ -117,5 +118,16 @@ if __name__ == '__main__':
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
logger.addHandler(ch)
|
logger.addHandler(ch)
|
||||||
|
|
||||||
server = CustomSMTPServer(('0.0.0.0', 2525), None) # use your public IP here
|
if not os.path.isfile("../config.ini"):
|
||||||
|
print "[ERR] Config.ini not found. Rename example.config.ini to config.ini before starting the server :)"
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
Config = ConfigParser.ConfigParser()
|
||||||
|
Config.read("../config.ini")
|
||||||
|
|
||||||
|
print "[i] Starting Mailserver on port",int(Config.get("MAILSERVER","PORT"))
|
||||||
|
|
||||||
|
server = CustomSMTPServer(('0.0.0.0', int(Config.get("MAILSERVER","PORT"))), None) # use your public IP here
|
||||||
|
print "[i] Ready to receive Emails"
|
||||||
|
print ""
|
||||||
asyncore.loop()
|
asyncore.loop()
|
Loading…
Reference in a new issue