当前位置:   article > 正文

python拆分Excel数据,自动发邮箱

python拆分Excel数据,自动发邮箱

import pandas as pd
import poplib  
import email  
from email.header import decode_header 
from email.parser import Parser
df = pd.read_excel("年假明细表.xlsx")
depts = df["部门"].unique()
for dept in depts:
    department_df = df[df["部门"] == dept]
    filename = f"{dept}_年假情况.xlsx"
    department_df.to_excel(filename, index=False)
 
def send_email_with_attachment(
        sender_email, recipient_email, subject, body, attachment_path, userName_AuthCode, attach_name):
    # 邮箱服务端
 
    message = MIMEMultipart()
    # email = MIMEText(content, 'plain', 'utf-8')
    message['Subject'] = subject  # 定义邮件主题
    message['From'] = "AI通知机器人"  # 发件人
    message['To'] = ",".join(recipient_email)  # 收件人(可以添加多个,若只有一个收件人,可直接写邮箱号&#x

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/在线问答5/article/detail/805653
推荐阅读
相关标签
  

闽ICP备14008679号