Aryan from It's Name to Email mapping identifies the receiver email from the provided receiver name and confirms to the Human
1
PrintText(aifriend,"Okay will send email to "+ receiver_name +" For the email id "+ receiver_email )
2
SpeakText(aifriend,"Okay will send email to "+ receiver_name +" For the email id "+ receiver_email)
Copied!
Get and Confirm the Email Subject
Once Aryan knows the receiver name and email, Next step is get the Subject of the Email.
For Subject, Aryan requests Human for the Subjects identifies it from Raw speech and thereafter request Human to confirm the Email Subject, Until it is confirmed it keep asking the subject using a infinite while loop
1
MessageSubjectConfirmation ="no"
2
while MessageSubjectConfirmation =="no":
3
4
PrintText(aifriend,"Subject will be?")
5
SpeakText(aifriend,"Subject will be?")
6
7
MessageSubject = RawSpeechRecognization(aifriend)
8
9
PrintText(aifriend,"Email Subject will be: "+ MessageSubject +", Confirm Yes to Proceed and No to Say Subject Again")
10
SpeakText(aifriend,"Email Subject will be: "+ MessageSubject +", Confirm Yes to Proceed and No to Say Subject Again")
if subStrCheck(MessageSubjectConfirmation,"yes")or subStrCheck(MessageSubjectConfirmation,"okay"):
15
break
Copied!
Get and Confirm the Email Body
Once Aryan has the confirmation on the Subject of the Email, Next step is to identify the Message body, Aryan requests Human for the Email Message, identifies it from Raw speech and thereafter request Human to confirm the Email Message, Until it is confirmed it keep asking the message using a infinite while loop
1
MessageBodyConfirmation ="no"
2
while MessageBodyConfirmation =="no":
3
4
PrintText(aifriend,"Email Message will be?")
5
SpeakText(aifriend,"Email Message will be?")
6
7
MessageBody = RawSpeechRecognization(aifriend)
8
9
PrintText(aifriend,"Email Message will be: "+ MessageBody +", Confirm Yes to Proceed and No to Say Message Again")
10
SpeakText(aifriend,"Email Message will be: "+ MessageBody +", Confirm Yes to Proceed and No to Say Message Again")
Below snippet demonstrates the SSL Port used to connect to the gmail smtp server and thereafter login and send the email.
Prerequisite is Aryan should have access to sender email box on Gmail, with Email ID, Email Password. This information is used to Login to Gmail SMTP server to send the email.
1
# Port For SSL
2
port =465
3
4
# Create a secure SSL context
5
context = ssl.create_default_context()
6
7
message ="""Subject: {MessageSubject}
8
9
{MessageBody}"""
10
11
# Send email here
12
13
with smtplib.SMTP_SSL("smtp.gmail.com", port, context=context)as server: