【问题标题】:Error when trying to send email via scrapy spider: Connection was refused by other side: 10061尝试通过scrapy spider发送电子邮件时出错:连接被对方​​拒绝:10061
【发布时间】:2019-07-20 14:27:01
【问题描述】:

我无法弄清楚我在这里做错了什么,我收到以下错误:

[scrapy.mail] 错误:无法发送邮件:To=['reg2@mydomain.com'] Cc=['reg3@mydomain.com'] Subject="test" Attachs=0- 连接被拒绝 对方:10061:无法建立连接,因为目标 机器主动拒绝了..

这是我最基本的蜘蛛

import scrapy

from scrapy.mail import MailSender
mailer = MailSender()


class FanaticsSpider(scrapy.Spider):
    name = 'fanatics'

    start_urls = ['https://www.fanaticsoutlet.com/nfl/new-england-patriots/new-england-patriots-majestic-showtime-logo-cool-base-t-shirt-navy/o-9172+t-70152507+p-1483408147+z-8-1114341320',
                 ]

    def parse(self, response):

        yield {

            'sale-price': response.xpath('//span[@data-talos="pdpProductPrice"]/span[@class="sale-price"]/text()').re('[$]\d+\.\d+'),

             }

mailer.send(to=["reg2@mydomain.com"], subject="test", body="test", cc=["reg3@mydomain.com"])

在我的 settings.py 中,我有以下内容:

MAIL_HOST = 'mail.mydomain.com'
MAIL_FROM = 'pricealerts@mydomain.com'
MAIL_PORT = 465
MAIL_USER = 'pricealerts@mydomain.com'
MAIL_PASS = 'passwordxx'
MAIL_SSL = True

似乎这些服务器详细信息没有正确提取?我已经尝试修改所有可能的选项,包括尝试填充蜘蛛中的设置,但这给了我另一个问题。 mailer=MailSender(smtpuser="pricealerts@mydomain.com", mailfrom="pricealerts@mydomain.com", smtphost="mail.mydomain.com", smtppass="password", smtpport=465) 这没有给我任何错误,但蜘蛛似乎在 [scrapy.core.engine] 信息:蜘蛛关闭(完成)之后挂起,我必须关闭 anaconda 命令提示符。此外,不会发送任何电子邮件。

我也尝试了这里找到的替代方法,没有收到错误,但没有发送电子邮件What did I forget in order to correctly send an email using Scrapy

【问题讨论】:

标签: scrapy


【解决方案1】:

我有同样的错误尝试使用它为我工作的一些代理

【讨论】:

    猜你喜欢
    • 2014-09-20
    • 2021-02-07
    • 2017-07-16
    • 1970-01-01
    • 2022-07-13
    • 2011-12-16
    • 2017-04-06
    • 2019-07-31
    • 1970-01-01
    相关资源
    最近更新 更多