diff --git a/README.rst b/README.rst index 010dcc4..6c9d88d 100644 --- a/README.rst +++ b/README.rst @@ -1,9 +1,9 @@ Inbox.py: SMTP Server for Humans ================================ -This is simplest SMTP server you'll ever see. It's asynchronous. +This is the simplest SMTP server you'll ever see. It's asynchronous. -One instance should handle over one thousand emails per second, thanks to Gevent. +One instance should handle over one thousand emails per second. Usage @@ -16,7 +16,7 @@ Give your app an inbox easily:: inbox = Inbox() @inbox.collate - def handle(to, sender, body): + def handle(to, sender, subject, body): ... # Bind directly. @@ -39,4 +39,4 @@ Installation Installing Inbox.py is simple:: - $ pip install inbox \ No newline at end of file + $ pip install inbox.py diff --git a/inbox.py b/inbox.py index f5eae47..0fecba7 100644 --- a/inbox.py +++ b/inbox.py @@ -1,17 +1,12 @@ # -*- coding: utf-8 -*- +import smtpd +import asyncore import argparse - -import gevent -import gevent.monkey +from email.parser import Parser from logbook import Logger -gevent.monkey.patch_select() - -import smtpd -import asyncore - log = Logger(__name__) @@ -25,8 +20,9 @@ def __init__(self, handler, *args, **kwargs): def process_message(self, peer, mailfrom, rcpttos, data): log.info('Collating message from {0}'.format(mailfrom)) - log.debug(dict(to=rcpttos, sender=mailfrom, body=data)) - return self._handler(to=rcpttos, sender=mailfrom, body=data) + subject = Parser().parsestr(data)['subject'] + log.debug(dict(to=rcpttos, sender=mailfrom, subject=subject, body=data)) + return self._handler(to=rcpttos, sender=mailfrom, subject=subject, body=data) class Inbox(object): diff --git a/requirements.txt b/requirements.txt index 1366d4f..36efcbc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -gevent -logbook \ No newline at end of file +logbook +argparse diff --git a/setup.py b/setup.py index 223aa2b..ea578e7 100644 --- a/setup.py +++ b/setup.py @@ -18,15 +18,15 @@ sys.exit() settings.update( - name='inbox', - version='0.0.5', + name='inbox.py', + version='0.0.6', description='SMTP for Humans.', long_description=open('README.rst').read(), author='Kenneth Reitz', author_email='me@kennethreitz.com', url='https://github.com/kennethreitz/inbox.py', py_modules= ['inbox',], - install_requires=['gevent', 'logbook'], + install_requires=['logbook', 'argparse'], license='BSD', classifiers=( # 'Development Status :: 5 - Production/Stable',