Aryan And Arya AI
Search…
⌃K

Email Process Flow

Get the Email Receiver Details

Once sendEmail flow is triggered, First step is to get the receiver details i.e. receiver name and email address.
Aryan requests Human "Whom do you want to send email?", Thereafter receiver name is identified from the Human raw speech after text transformation.
PrintText(aifriend, "Sure, Whom do you want to send email?")
SpeakText(aifriend, "Sure, Whom do you want to send email?")
receiver_name = TextTransformation(RawSpeechRecognization(aifriend)).lower().lstrip().rstrip()
Aryan from It's Name to Email mapping identifies the receiver email from the provided receiver name and confirms to the Human
PrintText(aifriend, "Okay will send email to " + receiver_name + " For the email id " + receiver_email )
SpeakText(aifriend, "Okay will send email to " + receiver_name + " For the email id " + receiver_email)

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
MessageSubjectConfirmation = "no"
while MessageSubjectConfirmation == "no" :
PrintText(aifriend, "Subject will be?")
SpeakText(aifriend, "Subject will be?")
MessageSubject = RawSpeechRecognization(aifriend)
PrintText(aifriend,"Email Subject will be: " + MessageSubject + ", Confirm Yes to Proceed and No to Say Subject Again" )
SpeakText(aifriend, "Email Subject will be: " + MessageSubject + ", Confirm Yes to Proceed and No to Say Subject Again" )
MessageSubjectConfirmation = TextTransformation(RawSpeechRecognization(aifriend)).lower().lstrip().rstrip()
if subStrCheck(MessageSubjectConfirmation,"yes") or subStrCheck(MessageSubjectConfirmation,"okay"):
break

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
MessageBodyConfirmation = "no"
while MessageBodyConfirmation == "no" :
PrintText(aifriend, "Email Message will be?")
SpeakText(aifriend,"Email Message will be?")
MessageBody = RawSpeechRecognization(aifriend)
PrintText(aifriend,"Email Message will be: " + MessageBody + ", Confirm Yes to Proceed and No to Say Message Again" )
SpeakText(aifriend,"Email Message will be: " + MessageBody + ", Confirm Yes to Proceed and No to Say Message Again" )
MessageBodyConfirmation = TextTransformation(RawSpeechRecognization(aifriend)).lower().lstrip().rstrip()
if subStrCheck(MessageBodyConfirmation,"yes") or subStrCheck(MessageBodyConfirmation,"okay"):
break

Send Email

Once Aryan has the receiver email, Email Subject and the Message, sendEmailExecute flow is executed to send the email and get the action done.
sendEmailExecute(receiver_email,MessageSubject,MessageBody,aifriend)
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.
# Port For SSL
port = 465
# Create a secure SSL context
context = ssl.create_default_context()
message = """Subject: {MessageSubject}
{MessageBody}"""
# Send email here
with smtplib.SMTP_SSL("smtp.gmail.com", port, context=context) as server:
server.login(sender_email, emailpassword)
server.sendmail(sender_email, receiver_email, message.format(MessageSubject=MessageSubject, MessageBody=MessageBody))
Email is sent, Control is now passed to NextStep flow.