python yagmail发送邮件
yagmail是 python的第三方库
安装:pip install yagmail
SMTP:(user=None, password=None, host='smtp.gmail.com', port=None,
smtp_starttls=None, smtp_ssl=True, smtp_set_debuglevel=0,
smtp_skip_login=False, encoding="utf-8", oauth2_file=None,
soft_email_validation=True, **kwargs)
user:发件人邮箱
password:发件人邮箱密码
host:发送邮箱的服务器
port:发送邮箱的端口
send(
to=None, subject=None, contents=None, attachments=None, cc=None, bcc=None,
preview_only=False, headers=None
)
to:收件人邮箱
subject:标题
contents:发送内容
attachments:附件
cc:抄送人
Domo:
import yagmail # 企业邮箱登陆 yag = yagmail.SMTP("aaa@bbb.com", "Lxy0405", "smtp.exmail.qq.com", 465) # 编辑正文 contents = '''' 新年快乐! ''' # 发送 yag.send(["ccccc@qq.com", "ddddd@qq.com"], "新年快乐", contents,[r"C:\Users\admin\Pictures\Saved Pictures\1.jpg",r"C:\admin\tianyu\Pictures\Saved Pictures\2.png"])