#=====================================================================================================
# send email message
#===================================================================================================== 
import smtplib                                                 #simple mail transfer protocol module

def send(fromAddr, toAddr, subject, message):
    if isinstance(toAddr,str):                                 #if a single string toAddr
        toAddr = toAddr.split()                                #make it a list (only 1 element)
    emailMsg  = 'Subject: ' + subject + '\n'                   #Subject: title \n 
    emailMsg +=  message                                       #message body
    emailServer = smtplib.SMTP('localhost')                    #create a SMTP object on localhost                    
#   emailServer.set_debuglevel(1)                              #set debug option to level 1 (low)
    emailServer.sendmail(fromAddr, toAddr, emailMsg)           #send the email
    emailServer.quit()                                         #close the object
#=====================================================================================================