Error sending the message
Closed this issue · 5 comments
Hello. An error occurs when sending a message. At the same time, it is connected to the access point.
`
import network
import umail
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect('ZB555KL', 'my_password')
wlan.ifconfig()
def email_send():
smtp = umail.SMTP('smtp.yandex.ru', 465, ssl=True)
smtp.login('alexey-kovrov@yandex.ru', 'my_password')
smtp.to(['alexey-kovrov@yandex.ru', 'kovrov.electro@yandex.ru'])
smtp.write("From: Aleksey alexey-kovrov@yandex.ru\n")
smtp.write("To: Aleksey alexey-kovrov@yandex.ru\n")
smtp.write("Subject: Test\n\n")
smtp.write("Send mail is work\n")
smtp.write("...\n")
smtp.send()
smtp.quit()
email_send()
`
Error:
`Traceback (most recent call last):
File "", line 46, in
File "", line 31, in email_send
File "umail.py", line 45, in init
AssertionError: start tls failed 503, ['5.5.4 Bad sequence of commands. StartTls command has been already sent. 1640644772-8lZPcmDU8T-dVQmGQxk']`
Tell me, what could be the problem?
Can you try ssl=False
?
If ssl=False:
File "umail.py", line 36, in __init__ OSError: [Errno 116] ETIMEDOUT
I read it in the description. A repeating error 503 may indicate connection problems. The response of the 503 SMTP server is most often an indicator that the SMTP server requires authentication, and you are trying to send a message without authentication (login + password). Check the General Settings to make sure that the SMTP server settings are correct.
Authentication and SSL are two different concepts.
Usually if you connect to a server with ssl=True
, the server should never respond STARTTLS
.
STARTTLS
is reserved for connection without SSL, it means (your current connection is not secure) the server now wants you to upgrade your current connection to a secure one so that the safety of subsequent password authentication can be guaranteed.
In your case, the server replies STARTTLS
regardless of the initial connection method, which is odd.
Can you try comment out line 43-45 to see if it works?
Lines 43 to 46 in 29cc10f
Thanks. Now the emails are being sent. Question: Will this modification of the library affect the work of applications in the future and will it work with other mail services?
I will update the code to ignore redundant STARTTLS
if connect with ssl=True
once I have the time.
Thanks for reporting this!