Hello
I would like my Streamlit application which is in the cloud to be able to send emails. I still have the same error that occurs:
Erreur lors de l’envoi de l’e-mail : (535, b’5.7.8 Username and Password not accepted. Learn more at\n5.7.8 Check Gmail through other email platforms - Gmail Help 6-20020a170902ee4600b001b9c5e07bc3sm3605362plo.238 - gsmtp’)
I followed and looked up what other people were doing. I do like them. I’ve also looked at google’s documentation on this and I’m good at what to do. I think it’s a Streamlit Cloud problem.
My code:
email_sender = st.text_input(‘sender’)
email_receiver = st.text_input(‘receiver’)
subject = st.text_input(‘subject’)
body = st.text_input(‘body’)
password = st.text_input(‘password’)
if st.button(“Send Email”):
try:
connection=smtplib.SMTP(‘smtp.gmail.com’,587)
connection.starttls()
connection.login(email_sender,password)
message=“Subject:{}\n\n”.format(subject,body)
connection.sendmail(email_sender,email_receiver,message)
connection.quit()
st.succes(‘ok’)
except Exception as e:
st.error(f"Erreur lors de l’envoi de l’e-mail : {e}")
The code is not protected at this time. I am still in the testing phase.
Unfortunately it doesn’t work. I’ve tried just about everything I can find on the forums. The python packages are well installed elsewhere. And I don’t have two-factor authentication enabled. I also followed the recommendations of Google
I fixed the problem with your help. I didn’t have double authentication and I think Google is preventing SMTP connections without double authentication now… I just put double authentication, of course I created a password for the application and everything works perfectly
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.