催收分案数据,邮箱开启smtp服务
import pandas as pd import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.image import MIMEImage from email.header import Header from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.application import MIMEApplication import os from email import encoders import time ttt=''' fagdfa ''' def sendmail(receiverlist,cclist,subject,content,filename): sender = 'zichanguanlizhongxin@carcredit.com.cn' smtpserver = 'smtp.exmail.qq.com' username ='zichanguanlizhongxin@carcredit.com.cn' password='' h = Header('资产管理中心', 'utf-8') h.append('<zichanguanlizhongxin@carcredit.com.cn>', 'ascii') msg = MIMEMultipart('mixed') msg['Subject'] = Header(subject, 'utf-8') msg['From'] =h msg['To'] = ','.join(receiverlist) msg['Cc'] = ','.join(cclist) msg.attach(MIMEText(content, 'html', 'utf-8')) for i in range(len(filename)): attfile = filename[i] basename = os.path.basename(attfile) fp = open(attfile, 'rb') att = MIMEText(fp.read(), 'base64', 'utf-8') att["Content-Type"] = 'application/octet-stream' att.add_header('Content-Disposition', 'attachment',filename=('gbk', '', basename)) msg.attach(att) smtp = smtplib.SMTP() # smtp.set_debuglevel(1) smtp.connect(host=smtpserver,port=25) smtp.login(username, password) smtp.sendmail(sender, receiverlist+cclist, msg.as_string()) smtp.quit() sendmail(receiverlist=["zhangtianlong@carcredit.com.cn"],cclist=[],subject="ff",content=ttt,filename=[])