Skip to content

Updated virtual.py #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion venv/virtual.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import wolframalpha
import json
import requests
import smtplib


print('Loading your AI personal assistant - G One')
Expand All @@ -18,6 +19,13 @@
voices=engine.getProperty('voices')
engine.setProperty('voice','voices[0].id')

def sendEmail(to, content):
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
server.login('User Emil address', 'Password')
server.sendmail('User email address', to, content)
server.close()

def speak(text):
engine.say(text)
Expand Down Expand Up @@ -166,7 +174,17 @@ def takeCommand():
speak(answer)
print(answer)


elif 'email' and 'send email' in query:
try:
speak("What should I say?")
content = takeCommand()
to = "Enter Receiver email address"
sendEmail(to, content)
speak("Email has been sent!")
except Exception as e:
print(e)
speak("Sorry.I am not able to send this email")

elif "log off" in statement or "sign out" in statement:
speak("Ok , your pc will log off in 10 sec make sure you exit from all applications")
subprocess.call(["shutdown", "/l"])
Expand Down