To send E-Mail from Python script using SMTP protocol
import smtplib
#to send the email to concerned persons
def Send_Mail(TEXT):
sender = 'sender_mail_address in single quotes '
receivers = ['firstperson mailaddress in single quotes ','secondperson mail address in single quotes ']
# Prepare actual message
message = "Subject:ALERT!\n"
message=message+TEXT
try:
smtpObj = smtplib.SMTP(' SMTP MAIL SERVER in single quotes ',25)
smtpObj.sendmail(sender, receivers, message)
smtpObj.close()
except smtplib.SMTPConnectError:
print "Error: unable to send email by connect"
except smtplib.SMTPException:
print "Error: unable to send email"
#main
Send_Mail("enter you text here..")


