Site icon Renzo Mischianti

Arduino NANO 33 IOT: Sending 2 mails OK, following FAILS

Hi Renzo, I use Arduino NANO 33 IOT, latest WiFiNINA version 1.8.13, latest EMailSender version 2.4.2 libraries. Arduino NANO has uploaded certificate for gmail.com:443 domain. I came across the same faulty behaviour of the EMailSender library like Paul Bozoian reported on 30 September 2021 at 16:55": > I use a MKR1010 WiFi, code will send email correctly two times but on the > third and subsequent attempts will not connect to mail server. Any ideas? First two emails are sent without a problem, 3+ in a row fails with an error (output with EMAIL_SENDER_DEBUG enabled): ONLY ONE RECIPIENTmultiple destination and attachments Insecure client:0 smtp.gmail.com 465 ### client.connect(this->smtp_server, this->smtp_port) Failed! Status: 0 Code: 2 Desc: Could not connect to mail server //source file: EmailSender.cpp around line 400 DEBUG_PRINTLN(this->smtp_server); DEBUG_PRINTLN(this->smtp_port); if(!client.connect(this->smtp_server, this->smtp_port)) { response.desc = F("Could not connect to mail server"); response.code = F("2"); response.status = false; return response; } Some additional info: * WIFI connectivity is ON before and after email sending attempts, I ping  8.8.8.8 from NANO right after sending attempts without a problem. * Gmail does not block my sending attempts, I checked it via another python script. * BUT! When I call WiFi.disconnect(); WiFi.end(); after each attempt & before a new one WiFi.begin(), email sending works without any problem. This is just a quick workaround, not a solution. Please, could you take a look at it? Thanks for your time! Irgo
Exit mobile version