Skip to content
Permalink
Browse files

Handle Pythin2.4.

  • Loading branch information...
cyrusdaboo committed Apr 5, 2007
1 parent 5180384 commit c886ef1dfcf3bfd0ee3acb88fbf047af5e5559b7
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/sendemail.py
@@ -20,7 +20,10 @@
Send an email message.
"""

import email.mime.text
try:
from email.mime.text import MIMEText
except:
from email.MIMEText import MIMEText
import smtplib

def sendemail(fromaddr=("", ""), toaddrs=[], subject="", body=""):
@@ -45,7 +48,7 @@ def fulladdr(addr):
if ord(c) > 0x7F:
charset = "utf-8"
break
msg = email.mime.text.MIMEText(body, "plain", charset)
msg = MIMEText(body, "plain", charset)
msg.add_header("From", fulladdr(fromaddr))
msg.add_header("To", ", ".join([fulladdr(a) for a in toaddrs]))
msg.add_header("Subject", subject)

0 comments on commit c886ef1

Please sign in to comment.
You can’t perform that action at this time.