You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
"""
邮件配置模块
用于配置SMTP邮箱发送服务
"""
# 常用邮箱服务商SMTP配置
EMAIL_CONFIGS = {
" qq.com " : {
" smtp_server " : " smtp.qq.com " ,
" smtp_port " : 587 ,
" use_tls " : True
} ,
" 163.com " : {
" smtp_server " : " smtp.163.com " ,
" smtp_port " : 587 ,
" use_tls " : True
} ,
" 126.com " : {
" smtp_server " : " smtp.126.com " ,
" smtp_port " : 587 ,
" use_tls " : True
} ,
" gmail.com " : {
" smtp_server " : " smtp.gmail.com " ,
" smtp_port " : 587 ,
" use_tls " : True
} ,
" outlook.com " : {
" smtp_server " : " smtp-mail.outlook.com " ,
" smtp_port " : 587 ,
" use_tls " : True
} ,
" hotmail.com " : {
" smtp_server " : " smtp-mail.outlook.com " ,
" smtp_port " : 587 ,
" use_tls " : True
}
}
def get_smtp_config ( email : str ) - > dict :
""" 根据邮箱地址获取SMTP配置 """
domain = email . split ( ' @ ' ) [ - 1 ] . lower ( )
return EMAIL_CONFIGS . get ( domain , EMAIL_CONFIGS [ " qq.com " ] ) # 默认使用QQ邮箱配置
# 默认发送邮箱配置(需要用户修改)
DEFAULT_SENDER_CONFIG = {
" email " : " your_email@qq.com " , # 请修改为您的邮箱
" password " : " your_app_password " , # 请修改为您的邮箱授权码(不是登录密码)
" name " : " 数学学习软件 "
}
# 邮箱授权码获取说明
EMAIL_HELP_TEXT = """
邮箱授权码获取方法:
QQ邮箱:
1. 登录QQ邮箱网页版
2. 设置 -> 账户 -> POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务
3. 开启POP3/SMTP服务, 获取授权码
163/126邮箱:
1. 登录邮箱网页版
2. 设置 -> POP3/SMTP/IMAP -> 开启服务
3. 获取授权码
Gmail:
1. 开启两步验证
2. 生成应用专用密码
注意:授权码不是邮箱登录密码!
"""