From 089507c0ac7ca08c6a2a2096990e871e27b989d3 Mon Sep 17 00:00:00 2001 From: balki <3070606-balki@users.noreply.gitlab.com> Date: Thu, 6 Aug 2020 19:52:05 -0400 Subject: [PATCH] fix running just pop server --- README.md | 4 ++++ mail4one/pop3.py | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0952c4e..4f225f4 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,10 @@ Mail server for single user #asyncio #python pipenv install sudo $(pipenv --venv)/bin/python ./run.py --certfile /etc/letsencrypt/live/your.domain.com/fullchain.pem --keyfile /etc/letsencrypt/live/your.domain.com/privkey.pem /var/mails --password_hash +## Just pop server for debugging + + pipenv run python -m mail4one.pop3 /path/to/mails 9995 your_password + ## Nextups * Support sending emails - Also support for popular services like mailgun/sendgrid diff --git a/mail4one/pop3.py b/mail4one/pop3.py index b6340fd..7f10db2 100644 --- a/mail4one/pop3.py +++ b/mail4one/pop3.py @@ -288,5 +288,20 @@ async def a_main(*args, **kwargs): await server.serve_forever() +def debug_main(): + logging.basicConfig(level=logging.DEBUG) + + import sys + + _, mails_path, port, password = sys.argv + + mails_path = Path(mails_path) + port = int(port) + password_hash = add_season(password.encode(), Session.SALT).hex() + + asyncio.run(a_main(mails_path, port, password_hash=password_hash)) + + if __name__ == "__main__": - asyncio.run(a_main(Path("/tmp/mails"), 9995, password_hash=add_season(b"dummy", Session.SALT).hexdigest())) + debug_main() +