Re: email libraries in python?

I still don't have  MIMEText:
    from email.MIMEText import MIMEText
ImportError: No module named MIMEText 
is there a way to get this?

  ----- Original Message ----- 
  From: Rodney Haynie 
  To: programmingblind@xxxxxxxxxxxxx 
  Sent: Tuesday, December 30, 2008 12:11 PM
  Subject: RE: email libraries in python?


  Tyler,

  Ok, I had this example on my box.  I quickly renamed the hardcoded email 
addresses, but you can get the idea.  I also had this setup with a timer, so it 
would send an email every so often.  I was having some fun with my coworkers. 
(smile).

   

  Works with Python 2.5.

   

  Good luck.

  -Rodney

   

   

  from threading import *

  import smtplib

  from email.MIMEText import MIMEText

   

  def tm():

   

                  # Set up a MIMEText object (it's a dictionary)

                  

                  msg = MIMEText("This is very important...")

                  

                  # You can use add_header or set headers directly ...

                  msg['Subject'] = 'Note from my computer'

                  # Following headers are useful to show the email correctly

                  # in your recipient's email box, and to avoid being marked

                  # as spam. They are NOT essential to the snemail call later

                  msg['From'] = "FName LName"

                  msg['Reply-to'] = "somename@xxxxxxxxxxxxx"

                  msg['To'] = "somebody@xxxxxxxxxxxxx"

                  

                  server = smtplib.SMTP('exchsrv07.ad.somewhere.com')

                  # server.set_debuglevel(1)

                  From = "somebody@xxxxxxxxxxxxx"

                  

                  To = "somebody@xxxxxxxxxxxxx"

                  server.sendmail(From, To, msg.as_string())

                  

                  To = "somebody@xxxxxxxxxxxxx"

                  server.sendmail(From, To, msg.as_string())

                  

                  # To = "joem@xxxxxxxxxxxxx"

                  # server.sendmail(From, To, msg.as_string())

                  

                  To = "somebody@xxxxxxxxxxxxx"

                  server.sendmail(From, To, msg.as_string())

                  

                  

                  

                  server.quit()

   

   

  t = Timer(1.0 * 2, tm)

  t.start()

Other related posts: