Example #1
0
def send_mail():
    text_speech("Tell the name of person to whom you want to send E-mail")
    temp = speech_text().split(" ")
    flag = True
    count = 0
    for word in temp:
        try:
            if flag == True:
                mail_id = email_directory[word]
                count += 1
                flag = False
        except:
            pass
    if count == 1:
        print("mail id =", mail_id)
        to_email = mail_id  # raw_input('Recipient: ')
        servername = "smtp.gmail.com"
        username = get_userid()
        password = get_password()
        msg = MIMEText("checking mail")
        msg.set_unixfrom(get_username())
        msg["To"] = email.utils.formataddr(("Recipient", to_email))
        msg["From"] = email.utils.formataddr((get_name(), get_userid()))
        text_speech("Sir What I Write In Mail")
        msg["Subject"] = speech_text()
        server = smtplib.SMTP(servername)
        try:
            server.set_debuglevel(True)
            server.ehlo()
            if server.has_extn("STARTTLS"):
                server.starttls()
                server.ehlo()

            server.login(username, password)
            server.sendmail("*****@*****.**", [to_email], msg.as_string())
        except:
            text_speech("Server Problem to send email")
        finally:
            server.quit()
            continuos_loop()
    else:
        text_speech("sorry sir no record found for this name")
Example #2
0
def send_mail():
    text_speech("Tell the name of person to whom you want to send E-mail")
    temp = speech_text().split(" ")
    flag = True
    count = 0
    for word in temp:
        try:
            if flag == True:
                mail_id = email_directory[word]
                count += 1
                flag = False
        except:
            pass
    if count == 1:
        print("mail id =", mail_id)
        to_email = mail_id  #raw_input('Recipient: ')
        servername = "smtp.gmail.com"
        username = get_userid()
        password = get_password()
        msg = MIMEText('checking mail')
        msg.set_unixfrom(get_username())
        msg['To'] = email.utils.formataddr(('Recipient', to_email))
        msg['From'] = email.utils.formataddr((get_name(), get_userid()))
        text_speech("Sir What I Write In Mail")
        msg['Subject'] = speech_text()
        server = smtplib.SMTP(servername)
        try:
            server.set_debuglevel(True)
            server.ehlo()
            if server.has_extn('STARTTLS'):
                server.starttls()
                server.ehlo()

            server.login(username, password)
            server.sendmail('*****@*****.**', [to_email], msg.as_string())
        except:
            text_speech("Server Problem to send email")
        finally:
            server.quit()
            continuos_loop()
    else:
        text_speech("sorry sir no record found for this name")
Example #3
0
def continuos_loop():
    try:
        result = speech_text()
        #To track program status i am printing it.
        #you can delete this print line,no problem.
        print("looping..", result)
        if result.lower() == "jarvis":
            main()
        else:
            continuos_loop()

    except LookupError:
        continuos_loop()
def continuos_loop():
    try:
        result=speech_text()
        #To track program status i am printing it.
	#you can delete this print line,no problem.
        print("looping..",result)
        if result.lower()=="jarvis":
            main()
        else:
            continuos_loop()
           
    except LookupError:
        continuos_loop()