-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
66 lines (54 loc) · 1.66 KB
/
Copy pathmain.py
File metadata and controls
66 lines (54 loc) · 1.66 KB
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
58
59
60
61
62
63
64
65
from email.message import EmailMessage
import pyttsx3
import smtplib
import speech_recognition as sr
from encryptMessage import encrypt_message
listner = sr.Recognizer()
def get_info():
try:
with sr.Microphone() as source:
print('Listening...')
voice = listner.listen(source)
info = listner.recognize_google(voice)
return info.lower()
except:
pass
engine = pyttsx3.init()
def talk(text):
voices = engine.getProperty('voices')
engine.setProperty('voice',voices[1].id)
engine.setProperty('rate',150)
engine.say(text)
engine.runAndWait()
emailList = {'name1':'example1@gmail.com',
'name2':'example4@gmail.com',
'name3':'example3@gmail.com',
'name4':'example4@gmail.com'}
def send_email(receiver,subject,body):
server = smtplib.SMTP("smtp.gmail.com",587)
server.starttls()
server.login('sender@gmail.com','password')
email = EmailMessage()
email['From'] = 'sender@gmail.com'
email['To'] = receiver
email['Subject'] = encrypt_message(subject)
body = encrypt_message(body)
email.set_content(body)
server.send_message(email)
def get_email_info():
talk('To whom you want to send the mail')
name = get_info()
receiver = emailList[name]
print(receiver)
talk('what do you want the subject to be')
subject = get_info()
print(subject)
talk('please tell the content of the mail')
body = get_info()
print(body)
send_email(receiver,subject,body)
talk('Do you want to send another mail')
ans = get_info()
if ans == 'yes' or ans == 'yeah':
get_email_info()
get_email_info()