得到PyQt5.QtWidgets import QWidget, QLineEdit, QLabel, QPushButton, QGridLayout, QHBoxLayout, QGroupBox, QComboBox QMessageBox
smtplib import 泡菜,操作系统
得到email import 编码器
得到email.header import 头
得到email.utils import  parseaddr formataddr
得到email.mime.text import  MIMEText
#定义邮件窗口
class email_window (QWidget):
,,,def __init__(自我):
,,,,,,,超级(). __init__ ()
,,,,,,,self.email_stmp =, QLineEdit ()
,,,,,,,self.email_name =, QLineEdit ()
,,,,,,,self.email_user =, QLineEdit ()
,,,,,,,self.email_password =, QLineEdit ()
,,,,,,,self.email_password.setEchoMode (QLineEdit.Password)
,,,,,,,self.email_test =, QLineEdit ()
,,,,,,,self.dir_email =, {}
,,,,,,,self.list_users =, []
,,,,,,,self.email_users =, QLineEdit ()
,,,,,,,self.email_suers_combobox =, QComboBox ()
,,,,,,,self.initUI ()
,,,,,,,self.initEmail ()
,,,def initUI(自我):
,,,,,,,stmp_label =, QLabel (“SMTP服务器:')
,,,,,,,name_label =, QLabel(“地区/单位:')
,,,,,,,user_label =, QLabel(“邮箱账号:')
,,,,,,,password_label =, QLabel(“邮箱密码:')
,,,,,,,test_label =, QLabel(“测试收件人:')
,,,,,,,email_test_button =, QPushButton(“发送测试邮件”)
,,,,,,,email_test_button.clicked.connect (self.email_test_fun)
,,,,,,,email_input_button =, QPushButton(“保存邮箱配置”)
,,,,,,,email_input_button.clicked.connect (self.email_save)
,,,,,,,email_info_group =, QGroupBox(“邮箱配置”)
,,,,,,,email_info_grid =, QGridLayout ()
,,,,,,,email_info_grid.addWidget (stmp_label, 0, 0)
,,,,,,,email_info_grid.addWidget (self.email_stmp 0 1)
,,,,,,,email_info_grid.addWidget (name_label 1 0)
,,,,,,,email_info_grid.addWidget (self.email_name 1 1)
,,,,,,,email_info_grid.addWidget (user_label 2 0)
,,,,,,,email_info_grid.addWidget self.email_user 2 (1)
,,,,,,,email_info_grid.addWidget (password_label 3 0)
,,,,,,,email_info_grid.addWidget self.email_password 3 (1)
,,,,,,,email_info_grid.addWidget (test_label 4 0)
,,,,,,,email_info_grid.addWidget (self.email_test 4 1)
,,,,,,,email_info_grid.addWidget (email_test_button 5 0)
,,,,,,,email_info_grid.addWidget email_input_button 5 (1)
,,,,,,,email_info_group.setLayout (email_info_grid)
,,,,,,,email_users_group =, QGroupBox(“收件的人)
,,,,,,,email_users_label =, QLabel(“邮箱:')
,,,,,,,email_users_combobox_label =, QLabel(“邮箱列表:')
,,,,,,,email_users_input_button =, QPushButton(“添加的)
,,,,,,,email_users_delete_button =, QPushButton(“删除”)
,,,,,,,email_users_input_button.clicked.connect (self.email_users_save)
,,,,,,,email_users_delete_button.clicked.connect (self.email_users_delete)
,,,,,,,email_users_grid =, QGridLayout ()
,,,,,,,email_users_grid.addWidget (email_users_label, 0, 0)
,,,,,,,email_users_grid.addWidget (self.email_users 0 1)
,,,,,,,email_users_grid.addWidget (email_users_input_button 0 2)
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null