跳转到主要内容

Mock SMTP服务器,将收到的消息以JSON格式记录到stdout,便于hitch框架进行解析和测试。

项目描述

HitchSMTP

Mock SMTP服务器,将所有收到的消息以JSON格式记录到stdout,以便HitchServe轻松解析。

HitchSMTP包含用于Hitch的服务定义,但也可以单独使用。

与Hitch一起使用

安装如下

$ hitch install hitchsmtp
# Service definition in your test execution engine's setUp
self.services['HitchSMTP'] = hitchsmtp.HitchSMTPService(
    port=10025                                                 # Optional (default: 10025)
)

# Wait for email during test...
containing = "Registration email"

email = self.services['HitchSMTP'].logs.out.tail.until_json(
    lambda email: containing in email['payload'] or containing in email['Subject'],
    timeout=5,
    lines_back=1,
)

DjangoRemindMe项目中查看此服务的实际应用。

差的SMTP服务器

您可以向特定的电子邮件地址发送邮件来模拟大多数SMTP错误。

例如,向451-please-try-again-later@smtperrors.com发送邮件将导致“451 Please try again later” SMTP错误。

有关这些错误的完整列表以及会触发它们的邮箱地址 @ smtperrors.com,请参阅

https://github.com/hitchtest/hitchsmtp/blob/master/hitchsmtp/smtperrors.py

功能

  • 以易于解析的 JSON 格式记录 SMTP 服务器接收到的电子邮件的所有详细信息。

  • 自动解析您电子邮件中的链接,以便您可以仅检查电子邮件中的链接并在上面“点击”。

  • 还可以模拟 SMTP 错误。

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。

源代码分发

hitchsmtp-0.2.1.tar.gz (5.5 kB 查看哈希值)

上传时间 源代码

支持