I need a python smtp server to receive multiple dvr alarm mail,store it and process. I looked around and found this simple code:
from datetime import datetime
import asyncore
from smtpd import SMTPServer
class EmlServer(SMTPServer):
no = 0
def process_message(self,peer, mailfrom, rcpttos, data, **kwargs):
adesso=datetime.now().strftime('%Y%m%d%H%M%S')
print(adesso)
print(data)
return
filename=alarm.eml
with open(filename, 'w') as f:
f.write(data)
self.no += 1
return None
def run():
foo = EmlServer(('0.0.0.0', 1025), None,decode_data=True)
print(repr(foo))
try:
asyncore.loop()
except KeyboardInterrupt:
pass
except Exception as e:
print(repr(e))
if __name__ == '__main__':
run()
from the same machine it is ok, mail are received and read , from other pc in same LAN I cannot connect. What's wrong? Thanks all.