"Philippe C. Martin" <[EMAIL PROTECTED]> wrote: >Hi, > >I am testing the smtp module and have the following question: > >in the code below (taken from net sample) prior to adding the "Subject:" >field, the email client found the "From" and the "To". Without the >"Subject:" field on I get this: > >Email client = Evolution: the "From" field is blank >Email client = KMail: the "To" field is blank > >Any clue ?
Absolutely. >server = smtplib.SMTP('smtp.sbcglobal.yahoo.com') >server.set_debuglevel(1) >server.login ('xxxxx','yyyyyyy') >server.sendmail(fromaddr, toaddrs, 'Subject:from python\n\n'+msg) >server.quit() You have two newlines following the Subject: line. That inserts a blank line, which terminates the headers. Everything else, including the From: and To: lines, will be taken as part of the message body. I assume you meant to use \r\n, but \n will work just as well and is less error prone. >print "Message length is " + repr(len(msg)) Easier is: print "Message length is", len(msg) More efficient is: print "Message length is %d" % len(msg) -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list