00001
00002
00003
00004
00005
00006
00007
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__ = "2004/03/09 00:00:00"
00014 __updated__ = "$Date: 2005/08/13 02:14:20 $"
00015 __version__ = "$Revision: 1.4 $"
00016 __release__ = "$Name: HEAD $"
00017 __credits__ = "SLAC"
00018
00019 import LICOS.copyright_SLAC
00020
00021 import sys, smtplib
00022 from email.MIMEText import MIMEText
00023
00024 class MailAlert(object):
00025 def __init__(self, smtpServer):
00026 self.__smtp = smtpServer
00027
00028 def sendMail(self, email):
00029 smtp = smtplib.SMTP( self.__smtp )
00030 smtp.sendmail( email.sender(), email.recipient(), email.body() )
00031 smtp.quit()
00032
00033 class SLACmail(MailAlert):
00034
00035 def __init__(self):
00036 MailAlert.__init__(self, 'mailgate01.slac.stanford.edu')
00037
00038 class Email(MIMEText):
00039 def __init__(self):
00040 MIMEText.__init__(self, '')
00041
00042 def sender(self, s=None):
00043 if s is not None:
00044 self['From'] = s
00045 return self['From']
00046
00047 def recipient(self, r=None):
00048 if r is not None:
00049 self['To'] = r
00050 return self['To']
00051
00052 def subject(self, s=None):
00053 if s is not None:
00054 self['Subject'] = s
00055 return self['Subject']
00056
00057 def body(self, b=None):
00058 if b is not None:
00059 self.set_payload(b)
00060 return self.get_payload()
00061
00062
00063
00064
00065
00066
00067
00068