title: Outlook 2010 and Python email smtplib - info in proper fields
body: <p>When trying to send mail through Outlook 2010 with <strong>smtplib</strong> in Python 2.6.5, I at least encounter success sending the message, but <em>s.sendmail(FROM, TO, message)</em> is not putting the information in the From:, To:, and Subject: lines for me.</p>
  
  <p>I need to know how to send email using smtplib in Outlook 2010 properly so that the email is received with the From:, To:, and Subject: fields on the message filled in.</p>
  
  <p>Here is my code. I googled to find this framework:</p>
  
  <pre><code>import smtplib
  
  SERVER = 'mail.company.com'
  FROM = 'jdoe@company.com'
  TO = ['receiver1@company.com']
  SUBJECT = "Test Subject SMTP"
  TEXT = "If this is in the body of the email, test is a success!"
  
  message = """From: %s\r\nTo: %s\r\nSubject: %s\r\n
  %s
  """ % (FROM, ", ".join(TO), SUBJECT, TEXT)
  
  
  
  try:
      s = smtplib.SMTP(SERVER)
      s.sendmail(FROM, TO, message) # this line is not correctly putting info in proper fields for Outlook 2010
      s.quit()
      print "Successfully sent email."
  
  except:
  
      import sys, traceback
  
      tb = sys.exc_info()[2]
      print "An error occurred on line " + str(tb.tb_lineno)
      print "Error: unable to send email"
  </code></pre>
  
  <p>Output is that the email is successfully sent. And it is. Just not quite right.</p>