如何使用Python发送超过400个文件的电子邮件

时间:2019-04-23 11:48:39

标签: python-2.7 smtp mime

我想在邮件中附加400多个图像 这些图像将进入x * x表。 如果x超过15,则无法发送邮件

for img in imgs:
    attach_part = MIMEBase('application', 'octet-stream')
    attach_part.set_payload(open(img, 'rb').read())
    Encoders.encode_base64(attach_part)
    attach_part.add_header('Content-Disposition',
                           'attachment; filename="%s"' % (Header(os.path.basename(img), 'utf-8').encode()))
    msg.attach(attach_part)

我想知道我可以附加到邮件中的文件数量是否受到限制

0 个答案:

没有答案