Tim Williams (gmail) wrote: > On 21 Oct 2005 02:34:40 -0700, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> > >>def email(HOST,FROM,TO,CC,SUBJECT,BODY): >> import smtplib >> import string, sys > > >> body = string.join(( >> "From: %s" % FROM, >> "To: %s" % TO, >> "CC: %s % CC, >> "Subject: %s" % SUBJECT, >> "", >> BODY), "\r\n") >> >> print body >> >> server = smtplib.SMTP(HOST) >> server.sendmail(FROM, [TO]+[CC],body) >> server.quit()
Assuming that TO and CC are single addresses it would be saner to use: server.sendmail(FROM, [TO, CC], body) - in other words, use a two-element list rather than creating it by concatenating two one-element lists! Note that as far as the SMTP protocol is concerned it's the list of recipients that gets actions, not the headers in the message. stating-the-obvious-ly y'rs - steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.python.org/pycon/ -- http://mail.python.org/mailman/listinfo/python-list