-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
57 lines (50 loc) · 1.57 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import smtplib
import speech_recognition as sr
import pyttsx3
from email.message import EmailMessage
listener = sr.Recognizer()
engine = pyttsx3.init()
def talk(text):
engine.say(text)
engine.runAndWait()
def get_info():
with sr.Microphone() as source:
print("listening......")
voice = listener.listen(source)
info = listener.recognize_google(voice)
print(info)
return info.lower()
def sendemail(receiver,subject,message):
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login('[email protected]','Sharma@123')
email = EmailMessage()
email['From'] = "[email protected]"
email["To"] = receiver
email["Subject"] = subject
email.set_content(message)
server.send_message(email)
print("Email send Successfully....")
email_list = {
"kumar" : "[email protected]",
"sandeep" : "[email protected]",
"saurabh" : "[email protected]"
}
def get_email_info():
talk("To whom you want to send email ?")
name = get_info()
receiver = email_list[name]
print(receiver)
talk("What is the subject of your email ?")
subject = get_info()
talk("Tell me the text inyour email ?")
message = get_info()
sendemail(receiver,subject,message)
talk("Email send Successfully....")
talk("Do You want to send More Email..")
answer = get_info()
if "yes" in answer:
get_email_info()
talk("Thank You For this service.")
print("Start....")
get_email_info()