#NEWLINE# def notify( self , title , text , url = None ) : #NEWLINE# #INDENT# 'Send email notification using SMTP' #NEWLINE# msg = MIMEMultipart ( ) #NEWLINE# msg [ 'From' ] = self . fromaddr #NEWLINE# msg [ 'To' ] = self . toaddr #NEWLINE# msg [ 'Subject' ] = title #NEWLINE# body = ( text if url else ( ( text + '\nURL: ' ) + url ) ) #NEWLINE# msg . attach ( MIMEText ( body , 'plain' ) ) #NEWLINE# if self . use_ssl : #NEWLINE# #INDENT# server = smtplib . SMTP_SSL ( self . host , self . port ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# server = smtplib . SMTP ( self . host , self . port ) #NEWLINE# #UNINDENT# server . ehlo ( ) #NEWLINE# if self . use_starttls : #NEWLINE# #INDENT# server . starttls ( ) #NEWLINE# server . ehlo ( ) #NEWLINE# #UNINDENT# if self . login_required : #NEWLINE# #INDENT# server . login ( self . fromuser , self . frompwd ) #NEWLINE# #UNINDENT# text = msg . as_string ( ) #NEWLINE# server . sendmail ( self . fromaddr , self . toaddr , text )