fixed larger size mails handling

pull/4/head
CIRCL 2017-06-02 11:13:28 +02:00
parent e36e50971c
commit 98d0145af3
1 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/python3 #!/usr/bin/python3
import os import os
import sys import sys
import tempfile
try: try:
configfile = os.path.basename(sys.argv[0]).split(".py")[0] + "_config" configfile = os.path.basename(sys.argv[0]).split(".py")[0] + "_config"
except Exception as e: except Exception as e:
@ -28,7 +29,11 @@ class CustomSMTPServer(smtpd.SMTPServer):
print('Message addressed from: {0}'.format(mailfrom)) print('Message addressed from: {0}'.format(mailfrom))
print('Message addressed to : {0}'.format(rcpttos)) print('Message addressed to : {0}'.format(rcpttos))
print('Message length : {0}'.format(len(data))) print('Message length : {0}'.format(len(data)))
subprocess.call([binpath, data]) tf = tempfile.NamedTemporaryFile(mode='w', delete=False)
tf.write(data)
tf.close()
subprocess.call([binpath, "-r", tf.name])
os.unlink(tf.name)
return return
server = CustomSMTPServer((smtp_addr, smtp_port), None) server = CustomSMTPServer((smtp_addr, smtp_port), None)