admin管理员组

文章数量:1133738

I am trying to connect to an exchange email server to use SendSmtpEmail when an error is happening in spidermon.

I have verified that in settings.py of the scrapy project are correct

SPIDERMON_ENABLED = True
SPIDERMON_MAX_ERRORS = 1
SPIDERMON_EMAIL_SENDER = 'myemail'
SPIDERMON_EMAIL_TO = 'myemail'
SPIDERMON_EMAIL_SUBJECT = 'subject'
SPIDERMON_SMTP_HOST = 'smtp.office365'
SPIDERMON_SMTP_PORT = 587
SPIDERMON_SMTP_USER = 'myemail'
SPIDERMON_SMTP_PASSWORD = 'mypass'
SPIDERMON_SMTP_ENFORCE_TLS = True
SPIDERMON_SMTP_ENFORCE_SSL = False

monitors.py

class MyMonitorSuite(MonitorSuite):

    monitors = [
        ErrorCountMonitor,
    ]

    monitors_failed_actions = [
        SendSmtpEmail
    ]
    

but I am still getting an error.

Failure: twisted.mail._except.SMTPConnectError: Unable to connect to server

How to troubleshoot and fix this? and i have tested connecting and sending an email with smtplib in the same machine, works fine

本文标签: pythonIssue with using SendSmtpEmail of spidermonStack Overflow