Miniproject
Miniproject
Miniproject
On
Voice Based Email is a program which helps people to send the email
without actually typing it. This program also has a feature which will read
the top most email in the inbox of a user. It will also tell the user about
how many unread email you have not seen. This program may be
beneficial for the people who are visually impaired. It may also benefit
people who are suffering from spinal cord related problems and are
unable to move. This project has been designed using python
Programming Language and implements Google text to speech
services.
NOTE: TO MAKE THE PROJECT RUN USER MUST ALLOW THE PERMISSION
TO SEND MAILS FROM LESS- SECURE PLATFORMS. THIS OPTION IS
AVAILABLE SETTINGS OF YOUR ACCOUNT
EmailMessage:
This library is used to send email from the program. It import the
structure from email message
speech _Recognition:
This package is used for speech recognition. Thus user will say
something. It will Record that audio and convert the recorded text into a
text and then the program will continue accordingly.
Imaplib:
It is a library which is used to receive email from the program. We have
to provide username and password in the variables and these library
methods will log into the account and receive email.
server.login(username, password):
login with the username and password provided earlier of the email
whose message we want to receive.
Smtplib:
This library is used to send email. Various functions of this library
perform different steps to send an email to the desired person. First we
set the host as “smtp.gmail.com”. Then we assign our username to
from_adrr variable, and senders email address to to_adrrs variable.
Similarly we assign message subject to the variables.
SMPT_SSL (host, port):
used to connect to the host services.
Eg- s.smtp(‘smtp.gmail.com’,587)
server.startttls():
It informs to start the transport layer security. Several protocols use a
command named STARTTTLS for this purpose. It is primarily intended
as a countermeasure to passive monitoring. The example sends an
email to a Mailtrap account with opportunistic TLS. The starttls() puts
the connection to the SMTP server into TLS mode.
server.send_message(email):
used to send email from the address to sender in to the address in
receiver .The message is stored is message. It is first converted to
string and then sent.
win32com.client:
This package contains a number of modules to provide access to
automation objects. This package supports both late and early
bindings, as we will discuss. Dispatch method when passed with the
argument of SAPI.SpVoice It interacts with the Microsoft Speech SDK
to speak what you type in from the keyboard.
get_info():
Function to get information from user end through microphone.it
records the speech from the microphone and returns the text in lower
order.
login():
Function to get information from user end about his email id and
password and stores it in global variables.
unseen_email():
Function which counts the total number of emails in inbox .and also
reads out the total number of unseen emails.
receive_email():
Function which reads out the latest unseen email from outlook
Microsoft.
Messages are sorted according to time.
Working:
To send an email the user will be asked to speak send. The voice will be
recorded and converted to text with the help of audio(“string”) function defined in
input audio library
If he does so then he will be asked to speak the username of the person to whom
he wish to send the email. A dictionary named email_list has been used which
contains username as key and their email addresses as value. As user speaks
the username. The function get_info() in input audio library will convert audio to
text and will assign it to receiver variable the program will search the username in
the dictionary and will give the corresponding email address. Then the email will
be assigned to mail variable of smtplib library. The user then will be asked to
speak the subject. The function get_info() will convert audio to text and will
assign it to Subject variable of smtplib library. In the end the user will be asked to
speak message. The function get_info() will convert audio to text and will assign
it to message variable of smtplib library.
NOTE:
server will depend from account to account.If your email address is of Gmail the
server variable will be: Server= smtplib.gmail.com If your account is in outlook
the server will be: Server= smtp-mail.outlook.com
To read the latest email from inbox the user will be asked to speak
check. inputaudio library get_info() function will take input . The program logins
to the server by server.login(username, password) then it selects inbox by
server.select(“mail”). It then stores list of all mail in a list data by using
server.search() method. Then we iterate over the list and separate all the mail ids
in a list mail_ids []. The last element of our list is our recent mail. We extract that
and pass it to the fetch() function which extract all the details like senders mail,
subject of mail and message and assign them to variable. After this the program
speaks the details and it terminates. After taking input we used imaplib to read
the latest email. The program first reads the senders email address then the
subject of the mail and at last the message of the mail. After this the program
terminates. If user speaks exit then the program terminates without doing
anything. If user says something else the program gives appropriate message.
REFERENCE:
Pyttsx3 library documentation
Stack overflow
Geeksforgeeks
Google