用于开发的简单调试SMTP服务器。
mr.hermes的Python项目详细描述
Introduction
mr.hermes是来自python的smtpd.debuggingserver的扩展。 标准库。它将接收到的所有邮件转储到标准输出,并 可以选择在可配置目录中的文件。
Usage
有几种方法可以使用这个包。最常见的两种可能是 下面。
命令行
使用首选的python打包工具(setuptools,distribute, PIP或其他)。在命令行中使用 python -m smtpd -n-c mr.hermes.DebuggingServer localhost:8025。
如果要将输出转储到目录,请设置 debug_smtp_output_path环境变量。例如 DEBUG_SMTP_OUTPUT_PATH=mails python -m smtpd -n-c mr.hermes.DebuggingServer localhost:8025。
建筑
在配置中添加一个部件,如下所示:
[debugsmtp] # Run a simple smtp server on 8025 that echos incoming email recipe = zc.recipe.egg eggs = mr.hermes entry-points = debugsmtp=runpy:run_module scripts = debugsmtp host = localhost port = 8025 path = ${buildout:directory}/var/mails initialization = import os os.environ.setdefault('DEBUG_SMTP_OUTPUT_PATH', '${:path}') sys.argv[1:] = ['-n', '-c', 'mr.hermes.DebuggingServer', '${:host}:${:port}'] arguments = 'smtpd', run_name='__main__', alter_sys=True
然后可以将此脚本添加到supervisord之类的内容中,并使用 mr.laforge在需要时自动启动。
Changelog
1.4.0-2017年11月08日
- 修复了Python3.6。 [多凯(kai lautaportti),弗斯丘尔泽]
1.3.0-2016年12月6日
- 在mr.hermes.DebugginServer.__init__中添加了*args和**kwargs到 接受python 3.3和3.4中引入的新(即使未使用)参数 在从cli运行smtp模块时使用。 [Duploduplo(Lorenzo Berni)]
1.2-2013年7月22日
- 当文件名冲突时,确保邮件正确排序。 [多凯(kai lautaportti),弗斯丘尔泽]
1.1-2011年8月4日
- 修正了基本上使1.0成为brownbag版本的打包问题。 [fschulze]
1.0-2011年8月4日
- 初次发行 [弗斯丘尔泽(弗洛里安·舒尔泽)]