Sorry all, here I am with a connexion problem several persons got in the past.
I use an ESP8266 chip paired onboard with an ATMega.
ESP8266 core lib is 3.0.2.
EMAIL_NETWORK_CLASS is "WiFiClientSecure"
I really do not undersand because I'm in a very basic case.
I did what have to be done to get an App password from Google, but it seems to me it's not an auth problem. I'm sure of my wifi config because I usually use NTP requests to sync my time on that device same config, together with other https cloud requests. Here is the simple code I tested to sendmail.
#include <ESP8266WiFi.h>
#include <Arduino.h>
#include <EMailSender.h>
#include <EMailSenderKey.h>
#include <trust_anchors.h>
// wifi stufs
const char ssid[] = "my wifi name";
const char pass[] = "aSecret";
IPAddress local_IP(192, 168, 1, 3);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);
IPAddress primaryDNS(192, 168, 1, 1);
void setup() {
Serial.begin(115200);
delay(1000);
while (!WiFi.config(local_IP, gateway, subnet, primaryDNS)) {
Serial.println("WiFi.config() Failed, wait 5 secs then retry");
delay(5000);
}
Serial.println("WIFI connected...");
IPAddress ip = WiFi.localIP();
Serial.print("My IP Address: ");
Serial.println(ip);
EMailSender emailSender("my_mail@gmail.com", "google_app_passw");
const char* arrayOfRecipientsEmail[] = {"anotherMailAddress@me.com"};
EMailSender::EMailMessage message;
message.mime = MIME_TEXT_HTML;
message.subject = "Ciao bello";
message.message = "Questa è la storia di uno di noi..." ;
Serial.print("Sending mail...");
EMailSender::Response resp = emailSender.send(arrayOfRecipientsEmail, 1, message);
Serial.println("Email sending status: ");
Serial.println(resp.status);
Serial.println(resp.code);
Serial.println(resp.desc);
}
void loop() {
}
WIFI connected...
My IP Address: 192.168.1.3
Sending mail...miltiple destination and attachments
Insecure client:0
MFLN supported: no
smtp.gmail.com
465
Email sending status:
0
2
Could not connect to mail server
Thanks for your help.
Bernard