Comments on: MicroPython: Send Emails with the ESP32/ESP826 https://randomnerdtutorials.com/micropython-send-emails-esp32-esp826/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Fri, 12 Apr 2024 10:15:41 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Sara Santos https://randomnerdtutorials.com/micropython-send-emails-esp32-esp826/#comment-905221 Fri, 12 Apr 2024 10:15:41 +0000 https://randomnerdtutorials.com/?p=124613#comment-905221 In reply to Diego.

Yes.
Maybe there is something wrong with the return of your function.
Save the date and time on a variable and then, concatenate everything on a variable instead of inside the write() function.
Regards,
Sara

]]>
By: Diego https://randomnerdtutorials.com/micropython-send-emails-esp32-esp826/#comment-905131 Thu, 11 Apr 2024 20:56:57 +0000 https://randomnerdtutorials.com/?p=124613#comment-905131 Hello,

I and attempting to send an email that displays a message as well as display the current time. However when I run, it my email is blank. I am running the code like this,

smtp = umail.SMTP('smtp.gmail.com', 465, ssl=True) # Gmail's SSL port
smtp.login(sender_email, sender_app_password)
smtp.to(recipient_email)
smtp.write("From:" + sender_name + "<"+ sender_email+">\n")
smtp.write("Subject:" + email_subject + "\n")
time_date_string = get_time_and_date()
smtp.write("You got mail "+"on " + get_time_and_date())
smtp.send()
smtp.quit()
previous_distance=distance

where get_time_and_date() calls on a function that give the time and date in a string format. Is it possible to send variables with strings in the write() function?

]]>
By: Marc Wouters https://randomnerdtutorials.com/micropython-send-emails-esp32-esp826/#comment-829742 Wed, 12 Apr 2023 09:10:26 +0000 https://randomnerdtutorials.com/?p=124613#comment-829742 Dear Sara,
the E-mail application is working well. Thanks !!
BUT, how to add/mail a file ? (F.i a .TXT file)
Best regards, Marc

]]>
By: Charles https://randomnerdtutorials.com/micropython-send-emails-esp32-esp826/#comment-829723 Wed, 12 Apr 2023 07:48:56 +0000 https://randomnerdtutorials.com/?p=124613#comment-829723 In reply to Sara Santos.

Hi Sara,
Sorry for the late reply
I try with different mail providers, different name, different apppasword, but without success
Hereafter the latest version

Email details

sender_email = ‘securesally@gmail.com’ #comming the screen wher the app_password is genereted
sender_name = ‘DB18X20’ #sender name
sender_app_password = ‘dudripvopbhcpkld’
recipient_email =’charlesesp8266@gmail.com’
email_subject =’Test Email’

from the repshell:
Connection successful
(‘192.168.1.35’, ‘255.255.255.0’, ‘192.168.1.1’, ‘192.168.1.1’)
Traceback (most recent call last):
File “”, line 32, in
File “umail.py”, line 74, in login
AssertionError: auth error 535, [‘5.7.8 Username and Password not accepted. Learn more at’, ‘5.7.8 https://support.google.com/mail/?p=BadCredentials o3-20020a05600c4fc300b003ee1e07a14asm1305937wmq.45 – gsmtp’]

Your comment will be appreciated
Charles

]]>
By: Sara Santos https://randomnerdtutorials.com/micropython-send-emails-esp32-esp826/#comment-828368 Tue, 04 Apr 2023 22:37:31 +0000 https://randomnerdtutorials.com/?p=124613#comment-828368 In reply to Javi.

That’s not true.
It disabled username and password. Now, you need to create an app password as shown in the tutorial.
I tested it this week.
It is working.
If you don’t find the app password field, you can open your account and access it on this link: https://myaccount.google.com/apppasswords
Regards,
Sara

]]>
By: Javi https://randomnerdtutorials.com/micropython-send-emails-esp32-esp826/#comment-828356 Tue, 04 Apr 2023 21:03:37 +0000 https://randomnerdtutorials.com/?p=124613#comment-828356 Hi

Gmail has disabled app passwords, so this no longer works. Is there any alternative?

https://www.neowin.net/news/google-no-longer-allows-username-and-passwords-on-third-party-email-applications/

]]>
By: Sara Santos https://randomnerdtutorials.com/micropython-send-emails-esp32-esp826/#comment-828089 Mon, 03 Apr 2023 09:52:10 +0000 https://randomnerdtutorials.com/?p=124613#comment-828089 In reply to Charles.

It seems an issue logging in.
Check that you’re inserting the right email and corresponding app password.
Try generating a new app password and try with that one.

]]>
By: Dave Festing https://randomnerdtutorials.com/micropython-send-emails-esp32-esp826/#comment-828081 Mon, 03 Apr 2023 08:53:50 +0000 https://randomnerdtutorials.com/?p=124613#comment-828081 You have enabled 2-factor auth?

]]>
By: Charles https://randomnerdtutorials.com/micropython-send-emails-esp32-esp826/#comment-828062 Mon, 03 Apr 2023 05:50:01 +0000 https://randomnerdtutorials.com/?p=124613#comment-828062 In reply to Sara Santos.

Hi Sara
Thanks for your reply.
My formulation was not right .
I try different change in the email detail lines of the main .py
sender_email = ‘secuesally@gmail.com’ : I try different different email adress
sender_app_password = ‘ swqchecibgaptjkw’ : password generated by Google
The result of testing the program is always :
QUOTE
Connection successful
(‘192.168.1.35’, ‘255.255.255.0’, ‘192.168.1.1’, ‘192.168.1.1’)
Traceback (most recent call last):
File “”, line 32, in
File “umail.py”, line 74, in login
AssertionError: auth error 535, [‘5.7.8 Username and Password not accepted. Learn more at’, ‘5.7.8 https://support.google.com/mail/?p=BadCredentials z6-20020a5d4d06000000b002e6d4ac31a3sm4812726wrt.72 – gsmtp’]
UNQUOTE
Line 32 is the line SMPT login in main .py
Line 74 is related to Def. login fonction
assert code==235 or code==503, ‘auth error %d, %s’ % (code, resp)
What is the problem
Thanks for your comment

]]>
By: Dave Festing https://randomnerdtutorials.com/micropython-send-emails-esp32-esp826/#comment-827994 Sun, 02 Apr 2023 19:30:48 +0000 https://randomnerdtutorials.com/?p=124613#comment-827994 In reply to Charles.

Maybe, have a look at:
https://github.com/davefes/My-uMail-and-examples
for examples of sending different file types via Gmail’s STP server.

]]>