【问题标题】:How to use Mandrill to send email report in Scrapy Spidermon如何在 Scrapy Spidermon 中使用 Mandrill 发送电子邮件报告
【发布时间】:2019-08-10 02:12:42
【问题描述】:

目前,Scrapy Spidermon 扩展仅显示使用 Amazon Simple Email Service 发送电子邮件的示例。可以用 Mandrill 代替吗?怎么做?

【问题讨论】:

  • 如果对您有帮助,请考虑将答案标记为“已接受”:)

标签: python web-scraping scrapy mandrill spidermon


【解决方案1】:

您必须编写自己的“Mandril Send Email”类。

使用 SendSESEmail 作为起点,但您无需处理 AWS 密钥,而是使用 Mandrill 的凭证。

send_message 应该看起来像这样:

def send_message(self, message):
    s = smtplib.SMTP('smtp.mandrillapp.com', 587)
    s.login(MANDRILL_USERNAME, MANDRILL_PASSWORD)
    s.send_message(message)

(基于此 sn-p:https://mandrill.com/#script-python

希望对你有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-07-11
    • 2013-11-26
    • 2016-02-28
    • 2023-03-28
    • 2014-05-04
    • 2012-09-08
    • 2016-07-04
    相关资源
    最近更新 更多