<s> """<STR_LIT>""" <EOL> import smtplib <EOL> import logger <EOL> from email . MIMEMultipart import MIMEMultipart <EOL> from email . MIMEText import MIMEText <EOL> class Smtp ( object ) : <EOL> def __init__ ( self , config , debug , silent ) : <EOL> self . server = config [ '<STR_LIT>' ] <EOL> self . username = config [ '<STR_LIT>' ] <EOL> self . password = config [ '<STR_LIT>' ] <EOL> self . port = config [ '<STR_LIT>' ] <EOL> self . to_address = config [ '<STR_LIT>' ] <EOL> self . from_address = config [ '<STR_LIT>' ] <EOL> self . log = logger . Logger ( "<STR_LIT>" , debug , silent ) <EOL> def send_notification ( self , notification_message ) : <EOL> if self . from_address == '<STR_LIT>' : <EOL> self . logging . error ( <EOL> '<STR_LIT>' . format ( self . from_address ) ) <EOL> return <EOL> msg = MIMEMultipart ( ) <EOL> msg [ '<STR_LIT>' ] = self . from_address <EOL> msg [ '<STR_LIT>' ] = self . to_address <EOL> msg [ '<STR_LIT>' ] = "<STR_LIT>" <EOL> msg . attach ( MIMEText ( notification_message , '<STR_LIT>' ) ) <EOL> server = smtplib . SMTP ( self . server , self . port ) <EOL> server . starttls ( ) <EOL> server . login ( self . from_address , self . password ) <EOL> text = msg . as_string ( ) <EOL> server . sendmail ( self . from_address , self . to_address , text ) <EOL> server . quit ( ) </s>
