1

以下のメールを使用して複数の受信者にメールを送信しようとしていますが、最初のメールにしか送信されません。複数の受信者に送信する理由と方法はありますか?

from email.mime.text import MIMEText
from smtplib import SMTP

def email (body,subject,SendToList):
    msg = MIMEText("%s" % body, 'html')
    msg['Content-Type'] = "text/html; charset=UTF8"
    msg['Subject'] = subject
    s = SMTP('localhost',25)
    s.sendmail('fromuserid@company.com', SendToList,msg=msg.as_string())

def main ():
    SendToList = 'userid1@company.com,userid2@company.com'
    with open('email.txt', 'r') as f:
        body = f.read()
    subject = "test email"
    email(body,subject,SendToList)
    print "Done"

if __name__ == '__main__':
    main()
4

1 に答える 1