## 发送邮件
import yagmail
import pandas as pd
from myconfig import mail_user, mail_password
yag = yagmail.SMTP(user=mail_user, password= mail_password, host='smtp.163.com')
# 发送邮件
# 创建示例数据
data = {'Name': ['John', 'Mike', 'Sarah'],
'Age': [25, 30, 28],
'City': ['New York', 'London', 'Paris']}
df = pd.DataFrame(data)
# 将DataFrame转换为HTML格式字符串
html_content = df.to_html()
# 多个邮箱地址
recipient_list = ['hulinhui@live.cn', 'hulihuihong@163.com']
yag.send(to=recipient_list,
subject='提醒:茂名市人民医院有新的临床试验注册,需确认项目负责人有无及时备案',
contents = html_content)
# 关闭SMTP连接
yag.close()