GithubHelp home page GithubHelp logo

邮箱通知不支持 SSL about py12306 HOT 6 CLOSED

pjialin avatar pjialin commented on August 16, 2024
邮箱通知不支持 SSL

from py12306.

Comments (6)

zhshuixian avatar zhshuixian commented on August 16, 2024 1

@pjialin

server = smtplib.SMTP(Config().EMAIL_SERVER_HOST)
server.login(Config().EMAIL_SERVER_USER, Config().EMAIL_SERVER_PASSWORD)
server.ehlo() # 添加这个
server.starttls() # 添加这个 ./py12306/helpers/notification.py
server.send_message(message)
server.quit()
CommonLog.add_quick_log(CommonLog.MESSAGE_SEND_EMAIL_SUCCESS).flush()```

from py12306.

zhshuixian avatar zhshuixian commented on August 16, 2024 1

我添加了行代码。邮件配置这样子

# 邮箱配置
EMAIL_ENABLED = 1  # 是否开启邮件通知
EMAIL_SENDER = '[email protected]'  # 邮件发送者
# 邮件接受者 # 可以多个 [[email protected], [email protected]]
EMAIL_RECEIVER = '[email protected]'
EMAIL_SERVER_HOST = 'smtp.163.com'  # 邮件服务 host
EMAIL_SERVER_USER = '[email protected]'
EMAIL_SERVER_PASSWORD = '你的授权码 qq或者网易邮箱等的'

from py12306.

pjialin avatar pjialin commented on August 16, 2024

邮箱配置中 host 支持带端口,如 smtp.qq.com:465,再试试

from py12306.

sunrishe avatar sunrishe commented on August 16, 2024

邮件发送使用ssl会失败,建议增加一个参数,判断是否使用ssl
我改了下源码,./py12306/helpers/notification.py:91行,使用smtplib.SMTP_SSL调用ssl进行邮件发送

from py12306.

pjialin avatar pjialin commented on August 16, 2024

好的,感谢

from py12306.

Dong-Ni avatar Dong-Ni commented on August 16, 2024

授权码是登录发送邮箱的密码?

from py12306.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.