summaryrefslogtreecommitdiff
path: root/smtp.py
diff options
context:
space:
mode:
authoryvesf <yvesf@aurora.xapek.org>2010-02-20 22:50:36 +0100
committeryvesf <yvesf@aurora.xapek.org>2010-02-20 22:50:36 +0100
commit6e33a67a8cb5011081e4dfb78b3082dd86ce8886 (patch)
tree093775fedf0c5da0d58972c96cc08f9d30af6539 /smtp.py
parent1c3d3d11bcc9fa4e9ec006d95bbe1d04f7bf5a1a (diff)
downloadfakesmtp-6e33a67a8cb5011081e4dfb78b3082dd86ce8886.tar.gz
fakesmtp-6e33a67a8cb5011081e4dfb78b3082dd86ce8886.zip
mhonarc, maildir 2 rss
Diffstat (limited to 'smtp.py')
-rw-r--r--smtp.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/smtp.py b/smtp.py
index 96fd830..c23917b 100644
--- a/smtp.py
+++ b/smtp.py
@@ -24,10 +24,20 @@ class SMTPChannel(asynchat.async_chat):
self.server.logger.debug("Write: " + data)
asynchat.async_chat.push(self,data)
+ def handle_close(self):
+ asynchat.async_chat.handle_close(self)
+ if self.read_data and len(self.data) > 10:
+ #QUIT oder "." wurde nicht erkannt
+ mail = email.message_from_string(self.data)
+ key=self.server.maildir.add(mail)
+ self.server.logger.info("New Mail: %s" % key)
+ self.server.maildir.flush()
+
+
def found_terminator(self):
try:
if self.read_data:
- if self.data.endswith(".") or self.data.endswith(".\r"):
+ if self.data.endswith("\n.") or self.data.endswith("\n.\r"):
self.read_data = False
self.push("250 Ok: queued as 12345\n")
mail = email.message_from_string(self.data)