示例#1
0
    def send_html_mail(self):
        """
            * 当前发送邮件为html邮件(可带附件);
        """
        if len(self.from_user) > 0:
            self.mail_content = {
                'Subject': self.subject,  # 邮件标题
                'From': self.from_user,  # 来自XX
                'Content_html': self.mail_text,  # 邮件正文
                'Attachments': self.file_path  # 邮件附件
            }
        else:
            self.mail_content = {
                'Subject': self.subject,  # 邮件标题
                'From': self.send_user,  # 来自XX
                'Content_html': self.mail_text,  # 邮件正文
                'Attachments': self.file_path  # 邮件附件
            }

        if '@qimai.cn' in self.send_user:
            server = zmail.server(self.send_user,
                                  self.send_userpwd,
                                  smtp_host='smtp.exmail.qq.com',
                                  smtp_port=465)
        else:
            server = zmail.server(self.send_user, self.send_userpwd)

        if len(self.cc) > 0:
            server.send_mail(self.receivers, self.mail_content, cc=self.cc)
        else:
            server.send_mail(self.receivers, self.mail_content)
        return '%s-发送成功' % (self.subject)
示例#2
0
def testServer(mail, passwd, smtp, port):
    if port == "25":
        server = zmail.server(mail, passwd, smtp, port, smtp_ssl=False)
    elif port == "465":
        server = zmail.server(mail, passwd, smtp, port, smtp_ssl=True)
    if server.smtp_able():
        return server
    else:
        return False
def checkMailServer():
    try:
        global server
        # 自定义 邮件服务器对象
        server = zmail.server(username=sendEmail,
                              password=password,
                              smtp_host=smtp_host,
                              smtp_port=smtp_port,
                              smtp_ssl=smtp_ssl,
                              pop_host=pop_host,
                              pop_port=pop_port,
                              timeout=60,
                              debug=False,
                              log=None)

        if server.smtp_able() and server.pop_able():
            print("[Suc]邮箱模块运行正常!")
            sendTxtEmail(adminEmail, "ServerStatus|已启动监控服务,邮箱模块运行正常 ヽ(✿゚▽゚)ノ")
            return "Success"
        else:
            print("[Error]邮箱模块运行异常 smtp:{} pop:{}".format(
                server.smtp_able(), server.pop_able()))
            return "Error"
    except Exception as e:
        print("[Error]邮箱模块出现未知错误!请检查各参数 {}".format(e))
示例#4
0
def login():
    global server
    while (True):
        printfline()
        print("   在使用程序之前请确保你已经打开了邮箱的POP3和SMTP功能")
        print("         并且拥有用于POP3和SMTP客户端的授权密码\n")

        while (True):
            dict_account["USERNAME"] = input("\n请输入邮箱账号:")
            if (re.match(pattern, dict_account["USERNAME"]) == None):
                print("请注意邮箱格式")
            else:
                break
        print("\n请注意这里输入的并不为登录密码,而是用于POP3和SMTP客户端的授权密码")
        dict_account["PASSWORD"] = input("请输入授权密码:")
        server = zmail.server(dict_account["USERNAME"],
                              dict_account["PASSWORD"])
        if server.smtp_able():
            pass
        else:
            print("无法连接SMTP服务,请检查邮箱账号和授权密码")
        if server.pop_able():
            print("\n\t\t\t登录成功")
            printfline()
            break
        else:
            print("无法连接POP3服务,请检查邮箱账号和授权密码")
    showmenu()
示例#5
0
def send_email(message):
    """推送信息到微信"""
    server = zmail.server('*****@*****.**', 'VQZRGGTKUBCIUAVA')
    server.send_mail('*****@*****.**', {
        'subject': '京东抢购软件通知',
        'content_text': message
    })
示例#6
0
def config_server(sender_email: str,
                  sender_autorization_code: str,
                  smtp_host: Optional[str] = None,
                  smtp_port: Optional[int] = None,
                  timeout=10):
    """
    smtp server configuration

    :param sender_email: sender's email
    :param sender_autorization_code:  sender's smtp authorization code
    :param smtp_host: smtp host address
    :param smtp_port: smtp host port
    :param timeout: timeout
    :return: smtp server object
    """
    assert isinstance(sender_email,
                      str), "sender_email should be given a string"
    assert isinstance(
        sender_autorization_code,
        str), "sender_authorization_code should be given a string"

    s = server(sender_email,
               sender_autorization_code,
               smtp_host=smtp_host,
               smtp_port=smtp_port,
               timeout=timeout)
    if s.smtp_able():
        print("server config success")
        return s
    else:
        raise SMTPConfigException
示例#7
0
def send_duan(typet='txt'):

    # 从yaml配置文件里获取邮箱配置
    conf = config.get_yaml_local()
    username = conf['conf']['username']
    password = conf['conf']['password']
    file_name = 'new_10.txt'

    # 获得当期时间,放在邮件标题,易于区分
    today_time = datetime.datetime.now()
    title_time = today_time.strftime('%Y-%m-%d %H:%M:%S')
    # 邮件标题,内容提示,附件位置
    subject = 'jandan每日新段 - ' + title_time
    content_tip = '热乎的段子又来啦!详情请见附件呦喂~~'
    package_dir = os.path.dirname(__file__)
    base = os.path.abspath(os.path.join(package_dir, '..'))
    if typet == 'txt':
        file_name = 'new_10.txt'
    elif typet == 'html':
        file_name = 'new_10.html'
    else:
        file_name = 'new_10.md'
    attach_path = os.path.join(base, file_name)
    # 构造邮件内容
    mail_content = {
        'subject': subject,
        'content': content_tip,
        'attachments': attach_path
    }

    zserver = zmail.server(user=username, password=password)
    # 状态zserver.smtp_able()
    # 发送
    zserver.send_mail(username, mail_content)
示例#8
0
def main():
    # 新建zmail邮件
    mail = dict()
    # 获取命令参数
    parser = get_argparse()
    mail_subject = parser.subject
    mail_conf = parser.conf
    mail_recipients = parser.recipients
    mail_attaches = parser.attaches
    if not os.path.exists(mail_conf):
        raise SystemExit("{0} is not found".format(mail_conf))
    else:
        meta = get_meta_from_config(mail_conf)
    if mail_attaches:
        mail['attachments'] = list()
        for i in mail_attaches:
            if not os.path.exists(i):
                raise SystemExit("{0} is not found".format(i))
            else:
                mail['attachments'].append(i)
    content = get_email_content()
    mail['subject'] = mail_subject
    mail['content_text'] = content
    server = zmail.server(meta['username'], meta['password'])
    server.send_mail(mail_recipients, mail)
示例#9
0
    def send_mail(self):
        #定义邮箱服务
        server = zmail.server(username=self.username, password=self.password)

        #定义邮件内容
        #以列表形式列出目录下所有测试报告文件
        lists = os.listdir(REPORT_PATH)
        #对测试报告文件以倒序排列,并且取最新的报告
        lists.sort(key=lambda fn: os.path.getctime(REPORT_PATH + "\\" + fn))
        newest_report = lists[-1]
        report = os.path.join(REPORT_PATH, newest_report)
        #构造邮件内容
        with open(report, 'r', encoding='UTF-8') as f:
            content_html = f.read()
        mail = {
            'subject': 'selenium测试框架报告',
            'content_text': '测试框架终于搭建完成,并且测试结果OK!!',
            'content_html': content_html,
            'attachments': [
                'C:\\Users\chenx\Desktop\IMG_5565.JPG',
            ],
            'from': 'cowcow<*****@*****.**>'
        }

        #发送邮件
        server.send_mail([
            ('陈晓辉', '*****@*****.**'),
        ], mail)
示例#10
0
 def word_get(self):
     pattern = re.compile(
         r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)")
     TheSendMailWindow.send_dict_account["USERNAME"] = self.lineEdit.text()
     TheSendMailWindow.send_dict_account["PASSWORD"] = self.lineEdit_2.text(
     )
     if re.match(pattern,
                 TheSendMailWindow.send_dict_account["USERNAME"]) == None:
         QMessageBox.warning(self, "警告", "请检查邮箱账号格式!", QMessageBox.Yes)
         self.lineEdit.setFocus()
     else:
         server = zmail.server(
             TheSendMailWindow.send_dict_account["USERNAME"],
             TheSendMailWindow.send_dict_account["PASSWORD"])
         if server.smtp_able():
             if server.pop_able():
                 ui_first.show()
                 MainWindow.close()
             else:
                 QMessageBox.warning(self, "警告", "无法连接POP3服务,请检查邮箱账号和授权密码",
                                     QMessageBox.Yes)
                 self.lineEdit.setFocus()
         else:
             QMessageBox.warning(self, "警告", "无法连接SMTP服务,请检查邮箱账号和授权密码",
                                 QMessageBox.Yes)
             self.lineEdit.setFocus()
示例#11
0
def init_mail_stmp(server):
    mail = zmail.server(server["user"],
                        server["password"],
                        smtp_host=server["smtp_server"],
                        smtp_port=server["smtp_port"],
                        smtp_ssl=False)
    return mail
示例#12
0
def init_mail_pop(server):
    mail = zmail.server(server["user"],
                        server["password"],
                        pop_host=server["pop_server"],
                        pop_port=server["pop_port"],
                        pop_tls=False)
    return mail
示例#13
0
def sendmail(sender,password,receiver,mail_subject,file_path,):
    '''
    :param sender:  是发送邮箱
    :param password: 注意,不是登录密码,这是邮件系统的授权码
    :param receiver:  接收邮箱
    :param mail_subject: 邮件标题
    :param file_path:
    :return:
    '''
    sender = sender
    password = password
    time.sleep(2)
    mail_content = {
        "subject": mail_subject,
        # "content_html":content_html,
        "content_html": zmail.read_html(file_path),
        "attachments": file_path  # 附件
    }

    try:
        # 发件人邮箱和密码
        server = zmail.server(sender, password)
        # 发送邮件--(收件人,邮件内容)
        server.send_mail(receiver, mail_content)
        print('邮件发送成功')
    except smtplib.SMTPException:
        print('Error:无法发送邮件')
示例#14
0
def main():
    verse = get_verse()
    server = zmail.server("*****@*****.**", "gkyommydyiozbbec")
    subject = {
        "subject": "金句",
        "content": verse
    }
    server.send_mail("*****@*****.**", subject)
def send_email(subject, content, zip_path, boss):
    mail_content = {
        'subject': subject,
        'content': content,
        'attachments': zip_path
    }
    server = zmail.server('*****@*****.**', 'zhangzenan520')
    server.send_mail(boss, mail_content)
示例#16
0
 def sender(self, titel, content):
     server = zmail.server('1***[email protected]', '***')
     mail = {
         'from': '微公众号推送',
         'subject': titel,
         'content_text': content,
     }
     server.send_mail(self.to_addrlist, mail)
def writeReport():
	mail_content = {
		'subject': report_subject,
		'attachments': report_path
	}

	server = zmail.server(emailName, password)
	server.send_mail(emailName, mail_content)
示例#18
0
def run():
    while 1:
        message_txt = open("conf/email_message.txt","r",encoding="utf-8")
        message_txt_result =message_txt.readlines()
        if not os.path.exists("conf/message_end.txt"):
            return ""
        f=open("conf/message_end.txt","r",encoding="utf-8")
        result = f.readlines()
        if len(result)==0:
            time.sleep(1)
            return ""
        for res in result:
            message_mails =  res.strip().split(";")
            for mtr in message_txt_result:
                if message_mails[1] in mtr.strip():
                    conf = configparser.ConfigParser()
                    conf.read("conf/mail.conf")
                    smtpserver =  conf.get('message','sendaddress')
                    #EMAIL_PORT = 465
                    fromaddr =conf.get('message','mailaddress') # 管理员的邮箱
                    password = conf.get('message','password') # 管理员的邮箱密码
                    end_message = mtr.strip().split(";")

                    if "," in end_message[2]:
                        to_list =  end_message[2].split(",")
                    else:
                        to_list=[]
                        to_list.append(end_message[2])

                    mail_subject = u"%s" % end_message[0]# 邮件的标题
                    adjunct = end_message[1]
                    fujian =[]
                    if "-----" in adjunct: #这里判断是否有多个附件需要发送
                        adjuncts = adjunct.split("-----")
                        for ad in adjuncts:
                            ad_new =  re.search("(.*?)\.",ad).groups()[0]+".zip"
                            fujian.append(ad_new)
                    else:
                        ad_new = re.search("(.*?)\.", adjunct).groups()[0] + ".zip"
                        fujian.append(ad_new)


                    mail_content ={
                                'subject': mail_subject,  # 邮件标题写在这
                                'content': '',  # 邮件正文写在这
                                'attachments':fujian
                            }

                    try:
                        server = zmail.server(fromaddr,password)
                        server.send_mail(to_list,mail_content)
                        print('success')
                        for fj in fujian:
                            os.remove(fj)
                    except Exception as e:
                        print('error:', e)
        break
    os.remove("conf/mail_name.txt")
示例#19
0
class TestGetMail(unittest.TestCase):
    mail_with_attachments_and_chinese = {
        'subject': 'Zmail test mail with attachments.测试邮件',
        'content': 'Nothing here.这里什么都没有。',
        'attachments': 'favicon.ico'
    }
    mail_with_attachments_and_chinese_result = {
        'subject':
        'Zmail test mail with attachments.测试邮件',
        'content': ['Nothing here.这里什么都没有。'],
        'from':
        '*****@*****.**',
        'to':
        'zmailserver<*****@*****.**>',
        'attachments': [[
            'favicon.ico;',
            b'\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00 \x00h\x04\x00\x00\x16\x00\x00\x00(\x00\x00\x00\x10\x00\x00\x00 \x00\x00\x00\x01\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
            b'\x00\x00\x00\x00\x00\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff',
            b'\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00',
            b'\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00',
            b'\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00',
            b'\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff',
            b'\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff',
            b'\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00',
            b'\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00',
            b'\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff',
            b'\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00',
            b'\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00',
            b'\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\xff\xff\xff',
            b'\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff',
            b'\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00',
            b'\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00',
            b'\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00',
            b'\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff',
            b'\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00',
            b'\x00\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
            b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
        ]]
    }

    test_server = [
        zmail.server(i[0], i[1]) for i in config
        if i[0] == '*****@*****.**'
    ][0]

    def test_get_mail(self):
        # Send mail to itself.
        if TEST_ALL_CASE:
            self.test_server.send_mail('*****@*****.**',
                                       self.mail_with_attachments_and_chinese)
            from time import sleep
            sleep(5)
        receive_mail = self.test_server.get_latest()
        for k, v in self.mail_with_attachments_and_chinese_result.items():
            self.assertEqual(receive_mail[k], v, msg=k)

    def test_get_mails(self):
        self.test_server.get_mails('github')
示例#20
0
def sendmail(conent):
    mail = {
        'subject': '小可爱更新微博了',
        'content': conent,
    }
    # 使用你的邮件账户名和密码登录服务器
    server = zmail.server(mail_user, mail_pass)
    # 发送邮件
    server.send_mail(mailto_list, mail)
示例#21
0
def sendCsv(csv_path, jpg_path):
    mail_content = {
        'subject': "{0:%Y-%m-%d %H:%M:%S} 指数温度的csv文件".format(datetime.now()),
        'content_text': "Allen,下午好!\n\t这是最新的指数温度csv文件,请查收!",
        'attachments': [csv_path, jpg_path],
    }

    server = zmail.server(emailName, password)
    a = server.send_mail(send_mail, mail_content)
示例#22
0
def sendImg(pic_time,pic_name,emailName,password):
	mail_content = {
		'subject': pic_time,
		'headers':'screen capture',
		'attachments': pic_name
	}

	server = zmail.server(emailName,password)
	server.send_mail(emailName, mail_content)
def sendReport():
	mail_content = {
		'subject': report_subject,
		'content_text': report_contents,
		'attachments': report_path
	}

	server = zmail.server(emailName, password)
	server.send_mail(report_mail, mail_content, cc=report_cc_mail)
示例#24
0
        def mail(url, title):
            server = zmail.server('*****@*****.**', 'pass')

            mail = {
                'subject': '教务处有新公告:%s' %(title),
                'content_html': url,
            }
            server.send_mail('*****@*****.**', mail)
            pass
示例#25
0
    def __init__(self):
        # 邮箱账号
        self.username = '******'

        # 邮箱授权码
        self.authorization_code = '授权码'

        # 构建一个邮箱服务对象
        self.server = zmail.server(self.username, self.authorization_code)
示例#26
0
 def __init__(self, username, password, event_engine):
     """初始化事件引擎"""
     # 事件队列
     #self.smtp_addr = smtp
     #self.pop_addr = pop
     self.username = username
     self.password = password
     self.server = zmail.server(self.username, self.password)
     self.event_engine = event_engine
示例#27
0
class TestLoginAble(unittest.TestCase):
    server_list = [zmail.server(i[0], i[1]) for i in config]

    def test_smtp_able(self):
        for server in self.server_list:
            self.assertTrue(server.smtp_able(), server.user)

    def test_pop_able(self):
        for server in self.server_list:
            self.assertTrue(server.pop_able(), server.user)
示例#28
0
def sendInformation(ip,systemVersion,emailName,password):
	info = 'ip:' + ip + "  " + 'system version:' + systemVersion
	print(info)
	mail_content = {
		'subject': 'information',
		'content_text': info
	}

	server = zmail.server(emailName,password)
	server.send_mail(emailName, mail_content)
示例#29
0
 def process2(self):
     global mainServer
     list = []
     mainServer = zmail.server(TheSendMailWindow.send_dict_account["USERNAME"], TheSendMailWindow.send_dict_account["PASSWORD"])
     getmail_list = mainServer.get_mails(start_index=1, end_index=mainServer.stat()[0])
     for i in range(len(getmail_list)):
         list.append(getmail_list[i]["subject"])
     listModel = QStringListModel()
     listModel.setStringList(list)
     self.listView.setModel(listModel)
示例#30
0
 def sendmail(self, subject, message):
     # 你的邮件内容
     mail_content = {
         'subject': subject,  # 邮件标题写在这
         'content_text': message,  # 邮件正文写在这
     }
     # 使用你的邮件账户名和密码登录服务器
     server = zmail.server(self.mail_user, self.mail_pwd)
     # 发送邮件指令
     server.send_mail([self.receiver], mail_content)