开发者社区> 问答> 正文

Python mysql.connector和smtplib

我已经集成了以下库:

import mysql.connector import random import requests from requests.auth import HTTPBasicAuth import smtplib, ssl from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart 每次我想通过smtplib发送电子邮件时,都会收到以下错误消息

Traceback (most recent call last): File "plesk.py", line 236, in sendConfirmationEmail() File "plesk.py", line 148, in sendConfirmationEmail with smtplib.SMTP_SSL("******************", 465, context=context) as server: File "/usr/lib/python3.5/smtplib.py", line 1021, in init source_address) File "/usr/lib/python3.5/smtplib.py", line 251, in init (code, msg) = self.connect(host, port) File "/usr/lib/python3.5/smtplib.py", line 335, in connect self.sock = self._get_socket(host, port, self.timeout) File "/usr/lib/python3.5/smtplib.py", line 1029, in _get_socket server_hostname=self._host) File "/usr/lib/python3.5/ssl.py", line 385, in wrap_socket _context=self) File "/usr/lib/python3.5/ssl.py", line 760, in init self.do_handshake() File "/usr/lib/python3.5/ssl.py", line 996, in do_handshake self._sslobj.do_handshake() File "/usr/lib/python3.5/ssl.py", line 641, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:720) 如果我现在注释掉mysql.connector,则再次发送电子邮件

展开
收起
保持可爱mmm 2019-11-15 14:01:45 509 0
1 条回答
写回答
取消 提交回答
  • 这是25端口限制

    请使用SMTP_SSL

    465端口。

    2019-11-20 10:05:30
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
From Python Scikit-Learn to Sc 立即下载
Data Pre-Processing in Python: 立即下载
双剑合璧-Python和大数据计算平台的结合 立即下载