我正在編寫一個程序,該程序通過電子郵件發送多個人,並從配置文件中獲取地址。問題是每次運行它只需要首先尋址並將其發送到該地址。順便說一句,這是在Python中使用configparser模塊。從配置文件向多個人發送電子郵件
繼承人我的代碼:
reporter_email = '%s' %config.get("email", "reporter_email")
notification_emails = ['%s' %(config.get("email", "notification_emails"))]
to = '%s' %config.get("email", "to")
subject = '%s' %config.get("email", "subject")
body = ('''%s\n
%s
%s''' %(config.get("email", "intro_body"), str(fileNames), config.get("email", "con_body")))
to = "To: %s\n" %(to)
subject = "Subject: %s\n\n" %(subject)
smtpObj = smtplib.SMTP('%s' %config.get("email", "portal"), 25)
smtpObj.sendmail(reporter_email, notification_emails, to + subject + body)
smtpObj.quit()
謝謝,我知道了對運行中的for循環和它的工作的偉大,現在 – nlee 2010-11-02 17:16:50
你的歡迎,BCC至 – Efazati 2010-11-03 07:26:31