PARA TODXS TODO

Email Log en Python

Filed under: Software Libre


#!/usr/bin/python

### This script send the content of the logfile

import smtplib
import os
import sys
from email.MIMEText import MIMEText
def sendTextMail(text):
fromaddr = “Moi
liste_destinataires=[’monchef@mondedomaine.com’]
mail = MIMEText(text)
mail[’From’] = fromaddr
mail[’Subject’] = “BUILDAUTO”
smtp = smtplib.SMTP()
smtp.connect()
for d in liste_destinataires:
smtp.sendmail(fromaddr,d,mail.as_string())
smtp.close()

def main():
logfile = sys.argv[1]
f=open(logfile, “r”)
corps = “”"\
Hello,

That is the result of the engine compilation

“”"
for i in f:
corps+=i

corps+=”"”\

PS : Please do not respond
“”"

f.close()
sendTextMail(corps)

if __name__ == ‘__main__’:
main()

Comments »

The URI to TrackBack this entry is: http://rastaman.blogsome.com/2006/07/10/email-en-python/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>


Get free blog up and running in minutes with Blogsome
Theme designed by Gary Rogers