initial test
This commit is contained in:
parent
4f61600a95
commit
0428ecad50
|
@ -1,2 +1,7 @@
|
|||
# opentrashmail
|
||||
# Open Trashmail
|
||||
Open source / selfhostable trashmail solution
|
||||
|
||||
# Features
|
||||
- Python powered mail server that works out of the box for any domain
|
||||
- Web interface to manage mails and credentials
|
||||
- 100% file based, no database needed
|
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
|
@ -0,0 +1,24 @@
|
|||
import smtpd
|
||||
import asyncore
|
||||
import uuid
|
||||
import time
|
||||
import os, sys
|
||||
import json
|
||||
|
||||
class CustomSMTPServer(smtpd.SMTPServer):
|
||||
def process_message(self, peer, mailfrom, rcpttos, data):
|
||||
print 'Receiving message from:', peer
|
||||
print 'Message addressed from:', mailfrom
|
||||
print 'Message addressed to :', rcpttos
|
||||
print 'Message length :', len(data)
|
||||
print "----------"
|
||||
for email in rcpttos:
|
||||
if not os.path.exists("../data/"+email):
|
||||
os.mkdir( "../data/"+email, 0755 )
|
||||
with open("../data/"+email+"/"+str(int(round(time.time() * 1000)))+".json", "w") as outfile:
|
||||
json.dump({'sender_ip':peer[0],'from':mailfrom,'rcpts':rcpttos,'data':data}, outfile)
|
||||
|
||||
return
|
||||
server = CustomSMTPServer(('0.0.0.0', 25), None)
|
||||
|
||||
asyncore.loop()
|
Loading…
Reference in New Issue