模拟的smtp服务器,将传入的消息作为json记录到stdout中,以便通过hitch框架进行解析和测试。
hitchsmtp的Python项目详细描述
与悬挂装置一起使用
按如下方式安装:
$ hitch install hitchsmtp
# Service definition in your test execution engine's setUpself.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(lambdaemail:containinginemail['payload']orcontaininginemail['Subject'],timeout=5,lines_back=1,)
请在DjangoRemindMe项目中查看此服务的运行情况。
错误的SMTP服务器
您可以发送到特定的电子邮件地址来模拟大多数SMTP错误。
例如,向451-please-try-again-later@smtperrors.com发送电子邮件将导致“451请稍后再试”SMTP错误。
有关这些错误的完整列表以及触发这些错误的电子邮件地址@smtperrors.com,请参见:
https://github.com/hitchtest/hitchsmtp/blob/master/hitchsmtp/smtperrors.py
功能
- 将SMTP服务器接收到的电子邮件的所有详细信息记录为易于解析的JSON。
- 自动解析电子邮件中的链接,以便您可以只检查电子邮件中的链接并“单击”它们。
- 也可以模拟SMTP错误。