使用阿里云企业邮箱发送邮件
import smtplib
import getpass
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import os
import time
import pandas as pd
class SendEmai:
def __init__(self):
self.pro_dir = os.getcwd()
self.title_content = self.read_containt()
if not self.title_content:
print('---无标题与内容文件:title_content.txt----')
return
def read_containt(self):
title_content = []
txt_path = os.path.join(self.pro_dir, 'title_content.txt')
if not os.path.exists(txt_path):
return title_content
with open(txt_path,encoding='utf-8') as f:
data = f.read()
data_list = data.split('\n',1)
title = data_list[0].strip()
content = data_list[-1].strip()
print('邮件标题:',title)
print('邮件内容:',content)
return [title,content]
def get_sender(self):
self.sender = ''
txt_path = os.path.join(self.pro_dir,'sender.txt')
if not os.path.exists(