Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
Handle Pythin2.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrusdaboo committed Apr 5, 2007
1 parent 5180384 commit c886ef1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/sendemail.py
Expand Up @@ -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=""):
Expand All @@ -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)
Expand Down

0 comments on commit c886ef1

Please sign in to comment.