import smtplib import string, sys import os HOST = "mymailhost" fi = open('build.err', 'r') BODY = string.join(fi.readlines() ) fi = open('build.out', 'r') BODY2 = string.join(fi.readlines() ) FROM = "Admin Name " TO = "All-Developers@thisproject" SUBJECT = "The test build could not compile!" body = string.join(( "From: %s" % FROM, "To: %s" % TO, "Subject: %s" % SUBJECT, "", BODY,BODY2), "\r\n") print body server = smtplib.SMTP(HOST) server.sendmail(FROM, [TO], body) server.quit()