import smtplib

def interface_outage(): # Email if interface specific issue
    
    # Specifies email address and password for sign in purposes
    smtpUser = '<sender email address>'
    smtpPass = '<sender email password>'

    # Recipient of phone home message
    toAdd = '<recipient email address>'
    fromAdd = smtpUser

    subject = 'Python Test'
    header = 'To: ' + toAdd + '\n' + 'From: ' + fromAdd + '\n' + 'Subject: ' + subject
    body = 'Network outage detected on wireless interface (internet not reachable)'

    print (header + '\n' + body)

    s = smtplib.SMTP('smtp.gmail.com',587)

    s.ehlo()
    s.starttls()
    s.ehlo()

    s.login(smtpUser, smtpPass)
    s.sendmail(fromAdd, toAdd, header + '\n' + body)

    s.quit()
    
def network_outage(): # Email if outage applies to entire network
    
    smtpUser = '<sender email address>'
    smtpPass = '<sender email password>'

    toAdd = '<recipient email address>'
    fromAdd = smtpUser

    subject = 'Python Test'
    header = 'To: ' + toAdd + '\n' + 'From: ' + fromAdd + '\n' + 'Subject: ' + subject
    body = 'Network outage detected (default gateway unreachable)'

    print (header + '\n' + body)

    s = smtplib.SMTP('smtp.gmail.com',587)

    s.ehlo()
    s.starttls()
    s.ehlo()

    s.login(smtpUser, smtpPass)
    s.sendmail(fromAdd, toAdd, header + '\n' + body)

    s.quit()
    
interface_outage()