用于开发的简单调试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日

  • 初次发行 [弗斯丘尔泽(弗洛里安·舒尔泽)]

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java IntelliJ找不到依赖项选项卡   java向字符串数组string[]添加元素并在Junit中测试结果   如何在eclipse中获取活动java项目的名称   如何使用java在mysql中插入时间   java ArrayList更新了插入一行,但Jtable仍然没有刷新   如何在JavaSwing中命名坐标(点)   java Matcher/模式不打印   java错误地设置了arraylist   使用UsernamePasswordCredential提供程序的java列表Azure AD   java在HTTP请求中设置UTC时间   未加载事件:jquery完整日历Java集成   java Maven插件依赖项无法从内部repo解析依赖项   Maven更新重置Java版本   java如何向中添加图片。带有Apache POI XWPF的docx,但不指定其大小   Java最大函数递归