Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

MailAlert.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009 
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT alert email tool"
00012 __author__   = "Jim Panetta <panetta@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "09/03/2004"
00014 __version__  = "$Revision: 1.2 $"
00015 __credits__  = "SLAC"
00016 
00017 # import LATTE.copyright_SLAC
00018 
00019 
00020 import sys, smtplib
00021 from email.MIMEText import MIMEText
00022 
00023 class MailAlert(object):
00024   def __init__(self, smtpServer):
00025     self.__smtp = smtpServer
00026     
00027   def sendMail(self, email):
00028     smtp = smtplib.SMTP( self.__smtp )
00029     smtp.sendmail( email.sender(), email.recipient(), email.body() )
00030     smtp.quit()
00031   
00032 class SLACmail(MailAlert):
00033   # Define the SLAC mail server
00034   def __init__(self):
00035     MailAlert.__init__(self, 'mailgate01.slac.stanford.edu')
00036     
00037 class Email(MIMEText):
00038   def __init__(self):
00039     MIMEText.__init__(self, '')
00040     
00041   def sender(self, s=None):
00042     if s is not None:
00043       self['From'] = s
00044     return self['From']
00045     
00046   def recipient(self, r=None):
00047     if r is not None:
00048       self['To'] = r
00049     return self['To']
00050     
00051   def subject(self, s=None):
00052     if s is not None:
00053       self['Subject'] = s
00054     return self['Subject']
00055       
00056   def body(self, b=None):
00057     if b is not None:
00058       self.set_payload(b)
00059     return self.get_payload()
00060     
00061   
00062   
00063 
00064   
00065 
00066 
00067 

Generated on Fri Jul 21 13:26:30 2006 for LATTE R04-12-00 by doxygen 1.4.3