K
Kun
i have the following code:
----------------------------------
import smtplib
from email.MIMEText import MIMEText
fp = open('confirmation.txt', 'rb')
msg = MIMEText(fp.read())
From = '(e-mail address removed)'
msg['Subject'] = 'Purchase Confirmation'
msg ['From'] = From
msg['To'] = emails
s = smtplib.SMTP('xxxx.xxx.xxx.edu')
s.login('xxxxx','xxxx')
s.sendmail(msg['From'], msg['To'], msg.as_string())
s.close()
----------------------------------
it works if msg['To'] = '(e-mail address removed)'
however, i'm trying to attach a list of emails named 'emails' to msg['To']
emails is in the following format: ['(e-mail address removed)', '(e-mail address removed)',
'(e-mail address removed)']
anyone have an idea how i can modify this script to work with sending a
list? note this is a snippet of a larger code, 'emails' is as a string
defined earlier.
----------------------------------
import smtplib
from email.MIMEText import MIMEText
fp = open('confirmation.txt', 'rb')
msg = MIMEText(fp.read())
From = '(e-mail address removed)'
msg['Subject'] = 'Purchase Confirmation'
msg ['From'] = From
msg['To'] = emails
s = smtplib.SMTP('xxxx.xxx.xxx.edu')
s.login('xxxxx','xxxx')
s.sendmail(msg['From'], msg['To'], msg.as_string())
s.close()
----------------------------------
it works if msg['To'] = '(e-mail address removed)'
however, i'm trying to attach a list of emails named 'emails' to msg['To']
emails is in the following format: ['(e-mail address removed)', '(e-mail address removed)',
'(e-mail address removed)']
anyone have an idea how i can modify this script to work with sending a
list? note this is a snippet of a larger code, 'emails' is as a string
defined earlier.