Python 批量发送1000封电子邮件并测试速度

Python 批量发送1000封电子邮件并测试速度,python,email,smtp,Python,Email,Smtp,我想用Python构建一个脚本,可以向2000到3000人发送电子邮件。到目前为止,代码如下所示: import smtplib from email.mime.text import MIMEText #Send email server = smtplib.SMTP('smtp.gmail.com',587) server.starttls() server.login("myemail","password") msg = MIMEText("""body""") sender = 'm

我想用Python构建一个脚本,可以向2000到3000人发送电子邮件。到目前为止,代码如下所示:

import smtplib
from email.mime.text import MIMEText

#Send email
server = smtplib.SMTP('smtp.gmail.com',587)
server.starttls()
server.login("myemail","password")
msg = MIMEText("""body""")
sender = 'myemail'
recipients = ['testemail1', 'testemail2']*100
msg['Subject'] = "Subject example"
msg['From'] = sender
msg['To'] = ", ".join(recipients)
msg['Body'] = 'this is the body of the email'
server.sendmail(sender, recipients, msg.as_string())
预期结果是在
testemail1
中收到100封电子邮件,在
testemail2
中收到100封电子邮件。实际结果是,我每次只收到1封电子邮件

我想做的是看看发送这么多电子邮件需要多长时间——收件人大约在同一时间收到邮件是很重要的

所以,问题是:我如何才能在两个个人邮箱中发送100次相同的电子邮件给自己(并排除
,因为我在范围内(1100):sendmail
,因为我已经尝试过了,它需要1秒/电子邮件,速度很慢。是否有任何服务、域或电子邮件列表可以让我发送此电子邮件,以便查看发送速度?

SMTP服务器(通常)忽略邮件中重复的收件人(例如重复的
RCPT to:
)。
他们将单个副本发送给重复的消息接收者


如果你想被gmail阻止,请执行
server.sendmail
1000次。

你真的想在gmail上做一个群发邮件速度基准测试吗?谷歌会喜欢你的…他们会阻止你的。@KlausD。我现在只能访问这封邮件,但我会在私人邮件服务器上尝试。现在我需要让它工作惯性导航与制导。