您好。我一直在考虑使用smtplib从我的网站运行邮件列表。 s = smtplib.SMTP(" server") s。 sendmail(fromaddress,toaddresess,msg) 我知道在这个例子中,toaddresses变量可以是类型列表的变量 。 假设该列表包含超过100封电子邮件。这会在邮件服务器上造成一些消耗吗?我会用其他方式更好地做一些吗? - www.wintergreen.in
解决方案On 20 / 09/05,Chris Dewin< no ************ @ all>写道: s = smtplib.SMTP(" server") s.sendmail(fromaddress,toaddresess,msg) 我知道在这个例子中,toaddresses变量可以是类型列表的变量。 假设该列表包含超过100封电子邮件。这会在邮件服务器上造成一些消耗吗?我会以其他方式做得更好吗? 假设该列表包含超过100封电子邮件 您的意思是收件人列表(toaddresses)? 两行示例代码将* single * email发送给server。与 len(toaddresses)收件人。然后,服务器将电子邮件分成较小(或个人)的电子邮件组发送(取决于使用的服务器及其用于中继电子邮件的机制) 你可以为每个收件人发送一封电子邮件给服务器 s = smtplib.SMTP(服务器) for addr inaddresses: s.sendmail(fromaddress,[addr],msg)
#在以后的版本中,[addr]可以是一个列表,也可以是一个地址的字符串 但这会给您的机器和服务器带来更多负担 HTH :)
Chris Dewin写道:嗨。我一直在考虑使用smtplib从我的网站运行邮件列表。 s = smtplib.SMTP(" server") s.sendmail(fromaddress,toaddresess,msg ) 我知道在这个例子中,toaddresses变量可以是类型列表的变量。 假设该列表包含超过100封电子邮件。这会在邮件服务器上造成一些消耗吗?我会以其他方式做得更好吗?
不是你的问题的答案,但它可能被认为是不好的/> 样式,通过地址 列表发布收件人的电子邮件地址。使用中性的地址(最好:邮件列表地址)并通过密件抄送:标题添加 收件人。 您可能还想查看邮递员 www.gnu/software/mailman/ ,这是一个完整的邮件列表 用Python编写的解决方案。 Daniel
2005年9月20日,Daniel Dittmar< da ************ @ sap.corp>写道:
Chris Dewin写道:嗨。我一直在考虑使用smtplib从我的网站运行邮件列表。 s = smtplib.SMTP(" server") s.sendmail(fromaddress,toaddresess,msg )不是你的问题的答案,但是通过地址发布收件人的电子邮件地址可能被认为是不好的风格列表。使用中性的地址(最好:邮件列表地址)并通过密件抄送:添加收件人。
为清晰起见 toaddreses不会在电子邮件中显示,它们是信封TO: addreses。电子邮件TO:标题中的地址显示给 收件人,这些是应该伪装的。最佳 邮件列表练习。 电子邮件模块的replace_header('''''''''new-text)将执行为你工作。
Hi. I''ve been thinking about using smtplib to run a mailing list from my website. s = smtplib.SMTP("server") s.sendmail(fromaddress, toaddresess, msg) I know that in this instance, the toaddresses variable can be a variable of type list. Suppose the list contains well over 100 emails. Would that create some sort of drain on the mail server? Would I be better off doing it in some other way? -- www.wintergreen.in
解决方案 On 20/09/05, Chris Dewin <no************@all> wrote: s = smtplib.SMTP("server") s.sendmail(fromaddress, toaddresess, msg) I know that in this instance, the toaddresses variable can be a variable of type list. Suppose the list contains well over 100 emails. Would that create some sort of drain on the mail server? Would I be better off doing it in some other way? Suppose the list contains well over 100 emails You mean the list of recipients (toaddresses) ? The 2 lines of example code send a *single* email to "server" with len(toaddresses) recipients. The server will then split the email into smaller (or individual) email groups to send (depending on the server in use and the mechanisms it uses to relay the email) You could send a single email for each recipient to "server" s = smtplib.SMTP("server")for addr in toaddresses: s.sendmail(fromaddress,[addr], msg)# in later revisions, [addr] can be a list, or a string of one address but that would create much more load on your machine AND server HTH :)
Chris Dewin wrote: Hi. I''ve been thinking about using smtplib to run a mailing list from my website. s = smtplib.SMTP("server") s.sendmail(fromaddress, toaddresess, msg) I know that in this instance, the toaddresses variable can be a variable of type list. Suppose the list contains well over 100 emails. Would that create some sort of drain on the mail server? Would I be better off doing it in some other way?Not really an answer to your question, but it''s probably considered bad style to publish the email addresses of the recipients via the address list. Use a neutral To-address (best: the mailing list address) and add the recipients via bcc: headers. You might also want to look at mailman www.gnu/software/mailman/, which is a complete mailing list solution written in Python. Daniel
On 20/09/05, Daniel Dittmar <da************@sap.corp> wrote: Chris Dewin wrote: Hi. I''ve been thinking about using smtplib to run a mailing list from my website. s = smtplib.SMTP("server") s.sendmail(fromaddress, toaddresess, msg)Not really an answer to your question, but it''s probably considered bad style to publish the email addresses of the recipients via the address list. Use a neutral To-address (best: the mailing list address) and add the recipients via bcc: headers.
For clarity The toaddreses don''t show in the email, they are the envelope TO: addreses. The addresses in the email''s TO: Headers are shown to the recipient and these are the ones that should be "disguised" as best practice for mailing lists. The email module''s replace_header(''to'', ''new-text) will do the job for you.
更多推荐
有关smtplib和邮件服务器的问题。
发布评论