python voice to email not working. Everything works just fine. It records and gives me my message output, but it doesn't send the password.
import speech_recognition as sr
import yagmail
recognizer=sr.Recognizer()
with sr.Microphone() as source:
print('clearing background noises:')
recognizer.adjust_for_ambient_noise(source,duration=1)
print("waiting for your message...")
recordedaudio = recognizer.listen(source)
print('done recording...!')
try:
print('printing the message..')
text=recognizer.recognize_google(recordedaudio,language='en,US')
print('Your message:{}'.format(text))
except Exception as ex:
print(ex)
#automate mails:
reciever='[email protected]'
message=text
sender=yagmail.SMTP('[email protected]')
sender.send(to=reciever,subject='this is an automated email written by manas using python',contents=message)
after you get your txt message you can send it like this, if you want to add the voice message itself you can attach that as well. Note: It is possible that google tries to block the app if the security does not meet their criteria.