#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
===========================
# @Time : 2020/10/26 20:32
# @File : handle_email.py
# @Author: adeng
# @Date : 2020/10/26
============================
"""
from datetime import datetime
import os
import yaml
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.application import MIMEApplication
from scripts.handle_file import HandleFile
from Common.constants import ALLURE_REPORTS_DIR, EMAIL_CONF_FILE_PATH
class HandleEmail():
def __init__(self, host="smtp.qq.com", port=25, *args, **kwargs):
self.host = host
self.port = port
# 添加文本
def add_text(self, text):
return MIMEText(text, "plain", "utf-8")
# 添加html文本
def add_html_text(self, html):
return MIMEText(html, "html", "utf-8")<