如何使用Mandrill在Scrapy Spidermon中发送电子邮件报告

问题描述 投票:1回答:1

目前,Scrapy Spidermon扩展仅显示使用Amazon Simple Email Service发送电子邮件的示例。是否可以使用Mandrill?如何?

python web-scraping scrapy mandrill spidermon
1个回答
1
投票

您必须编写自己的“Mandrill发送电子邮件”课程。

使用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)

(基于这个片段:https://mandrill.com/#script-python

希望它能帮到你。

© www.soinside.com 2019 - 2024. All rights reserved.