我在想.有没有办法在Python的默认SMTPlib上添加多个接收器?
喜欢(主题和内容已经设置,smtp服务器gmail.):
python sendmail.py receiver1@gmail.com receiver2@gmail.com receiver3@gmail.com ...
Run Code Online (Sandbox Code Playgroud)
谢谢
发布之前测试过!
import smtplib
from email.mime.text import MIMEText
s = smtplib.SMTP('smtp.uk.xensource.com')
s.set_debuglevel(1)
msg = MIMEText("""body""")
sender = 'me@example.com'
recipients = ['john.doe@example.com', 'john.smith@example.co.uk']
msg['Subject'] = "subject line"
msg['From'] = sender
msg['To'] = ", ".join(recipients)
s.sendmail(msg.get('From'), recipients, msg.as_string())
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8488 次 |
| 最近记录: |