Skip to content

Commit

Permalink
Enabled send mails using voice
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhtyagi2306 committed Jul 30, 2020
1 parent f78aadc commit 0f80612
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
Binary file modified __pycache__/keys.cpython-36.pyc
Binary file not shown.
15 changes: 15 additions & 0 deletions intents.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,21 @@
"answers": ["Sure sir, looking wikipedia for information, please wait!"]
}
]
},
{
"tag": "send-mails",
"all_questions": ["Hey! can you send a mail", "Boss send a mail",
"send a mail", "please send a mail", "compose a mail", "please compose a mail",
"send an email", "Please send an email", "compose an email"],
"sub_tags": [
{
"sub": "mails-send",
"questions": ["Hey! can you send a mail", "Boss send a mail",
"send a mail", "please send a mail", "compose a mail", "please compose a mail",
"send an email", "Please send an email", "compose an email"],
"answers": ["Sure sir !"]
}
]
}
]
}
28 changes: 27 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import weather
import wikipedia
import webbrowser
import smtplib
import keys

try:
from googlesearch import search
Expand Down Expand Up @@ -169,6 +171,19 @@ def wish():
speak("I am Boss sir, How can I help you")


dict = {"Madhur": "[email protected]", "Rishabh": "[email protected]",
"Shivam": "[email protected]"}


def send_mails(to, body):
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
server.login('[email protected]', keys.gmail_password())
server.sendmail('[email protected]', to, body)
server.close()


prepare_tags_list()


Expand All @@ -187,7 +202,18 @@ def main():
sub_list = tags_dict.get(tag_word)
sub_tag_word = sub_list[sub]

if sub_tag_word == "wikipedia-open":
if sub_tag_word == "mails-send":
try:
speak("Who do you want to send this mail")
to = get_audio()
speak("what should I say to " + to)
body = get_audio()
send_mails(dict[to], body)
speak("Your mail has been sent successfully !")
except Exception as e:
print(e)
speak("Sorry, Could not send this E-mail")
elif sub_tag_word == "wikipedia-open":
ans = answers_dict.get(sub_tag_word)
a = random.choice(ans)
speak(a)
Expand Down

0 comments on commit 0f80612

Please sign in to comment.