#!/usr/bin/python
# -*- coding: utf-8 -*-
import boto3
__author__ = 'naren'

ec2 = boto3.resource('ec2')
instances = ec2.instances.filter(
    Filters=[{'Name': 'tag:team', 'Values': ['backend']}, {'Name': 'instance-state-name', 'Values': ['running']}])

@@ -42,21 +42,103 @@
 %0Aimport 
-boto3
+smtplib%0Aimport traceback%0Afrom ConfigParser import ConfigParser%0Aimport boto3%0Aimport ast%0A
 %0A__autho
@@ -151,17 +151,16 @@
 'naren'%0A
-%0A
 ec2 = bo
@@ -183,153 +183,1171 @@
 2')%0A
-instances = ec2.instances.filter(%0A    Filters=%5B%7B'Name': 'tag:team', 'Values': %5B'backend'%5D%7D, %7B'Name': 'instance-state-name', 'Values': %5B'running'%5D%7D%5D)
+config = ConfigParser()%0Aconfig.read('ec2notify_personal.cfg')%0A%0A%0Adef send_email(sender, pwd, recipient, subject, body):%0A    %22%22%22Send an email to a user or list of users%0A%0A    :param sender: A string which is the email of sender%0A    :param pwd: A string which is the pass phrase of the sender email%0A    :param recipient: A string or list of strings which is the recipient(s) email id(s)%0A    :param subject: A string which is the subject for email%0A    :param body: A string or docstring which is the body of the email%0A    %22%22%22%0A    gmail_user = sender%0A    gmail_pwd = pwd%0A    from_ = sender%0A    to = recipient if type(recipient) is list else %5Brecipient%5D%0A    subject = subject%0A    text = body%0A    # Prepare actual message%0A    message = %22%22%22%5CFrom: %25s%5CnTo: %25s%5CnSubject: %25s%5Cn%5Cn%25s%0A    %22%22%22 %25 (from_, %22, %22.join(to), subject, text)%0A    try:%0A        server = smtplib.SMTP(%22smtp.gmail.com%22, 587)%0A        server.ehlo()%0A        server.starttls()%0A        server.login(gmail_user, gmail_pwd)%0A        server.sendmail(from_, to, message)%0A        server.close()%0A        print 'successfully sent the mail'%0A    except:%0A        print traceback.format_exc()%0A        print %22failed to send mail%22%0A%0A
 %0A

Add send_email function