Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/329.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
有没有办法在Python SMTPlib中添加多个接收器?_Python_Smtplib - Fatal编程技术网

有没有办法在Python SMTPlib中添加多个接收器?

有没有办法在Python SMTPlib中添加多个接收器?,python,smtplib,Python,Smtplib,我在想。有没有办法在Python的默认SMTPlib上添加多个接收器 类似(主题和内容集已存在,smtp服务器gmail。): 感谢来自以下网站的: 发邮件。所需参数是RFC 822 from地址字符串, 地址字符串的RFC 822列表(裸字符串将被视为 包含1个地址的列表)和消息字符串 发帖前测试 import smtplib from email.mime.text import MIMEText s = smtplib.SMTP('smtp.uk.xensource.com') s.se

我在想。有没有办法在Python的默认SMTPlib上添加多个接收器

类似(主题和内容集已存在,smtp服务器gmail。):

感谢来自以下网站的

发邮件。所需参数是RFC 822 from地址字符串, 地址字符串的RFC 822列表(裸字符串将被视为 包含1个地址的列表)和消息字符串

发帖前测试

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())

当收件人字段中的字符总数超过255个时,可能的重复操作失败。最后一个电子邮件地址在发送的电子邮件中被删除。但邮件将被发送。
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())