Forum Replies Created
-
AuthorPosts
-
Thank you for your help. I really appreciate it.
However,when I change the variable from char to String, I’d get error message
testemail:14:50: error: no matching function for call to ‘EMailSender::EMailSender(String&, String&)’
14 | EMailSender emailSend(email_login, email_password);I know this is not part of your library, but was wondering if you can help. I recorded my email and password in EEProm, but when the value are used to login I can’t login. However, if I placed the value like char email_login[32]= “claudacate@gmail.com” I’d have no problem. I serial print out the value they looked identical. Here is what I used to update my email and password. Thank you
char email_login[32]; char email_password[32]; void loademail() { EEPROM.get(0, email_to); EEPROM.get(0 + sizeof(email_to), email_login); EEPROM.get(0 + sizeof(email_to) + sizeof(email_login), email_password); char ok[3]; EEPROM.get( 0 + sizeof(email_to) + sizeof(email_login) + sizeof(email_password), ok); if (String(ok) != String(“OK”)) { email_to[0] = 0; email_login[0] = 0; email_password[0] = 0; } } void saveemail() { EEPROM.put(0, email_to); EEPROM.put(0 + sizeof(email_to), email_login); EEPROM.put(0 + sizeof(email_to) + sizeof(email_login), email_password); char ok[3] = “OK”; EEPROM.put( 0 + sizeof(email_to) + sizeof(email_login) + sizeof(email_password), ok); EEPROM.commit(); }
I found my mistake! When I read the tutorial I followed the instruction for esp8266 core 2.4.2 and changed the emailsenderkey.h. I feel silly. Sorry I took up so much your time Renzo. Thanks again for your help.
However, upon further research. It seems port 465 requires SSL to connect. I used openssl and below is result. I think I am missing SSL in the code
openssl s_client -connect smtp.gmail.com:465
CONNECTED(00000005)
depth=3 C = BE, O = GlobalSign nv-sa, OU = Root CA, CN = GlobalSign Root CA
verify return:1
depth=2 C = US, O = Google Trust Services LLC, CN = GTS Root R1
verify return:1
depth=1 C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
verify return:1
depth=0 CN = smtp.gmail.com
verify return:1Here is the EMailSenderEsp8266GMailTest.ino I used
#include "Arduino.h" #include <EMailSender.h> #include <ESP8266WiFi.h> const char *ssid = "hotspot"; const char *password = "12345678"; uint8_t connection_state = 0; uint16_t reconnect_interval = 10000; EMailSender emailSend("sendemailfrom@gmail.com", "passworddfdf"); uint8_t WiFiConnect(const char *nSSID = nullptr, const char *nPassword = nullptr) { static uint16_t attempt = 0; Serial.print("Connecting to "); if (nSSID) { WiFi.begin(nSSID, nPassword); Serial.println(nSSID); } uint8_t i = 0; while (WiFi.status() != WL_CONNECTED && i++ < 50) { delay(200); Serial.print("."); } ++attempt; Serial.println(""); if (i == 51) { Serial.print("Connection: TIMEOUT on attempt: "); Serial.println(attempt); if (attempt % 2 == 0) Serial.println( "Check if access point available or SSID and Password\r\n"); return false; } Serial.println("Connection: ESTABLISHED"); Serial.print("Got IP address: "); Serial.println(WiFi.localIP()); return true; } void Awaits() { uint32_t ts = millis(); while (!connection_state) { delay(50); if (millis() > (ts + reconnect_interval) && !connection_state) { connection_state = WiFiConnect(); ts = millis(); } } } void setup() { Serial.begin(115200); connection_state = WiFiConnect(ssid, password); if (!connection_state) // if not connected to WIFI Awaits(); // constantly trying to connect EMailSender::EMailMessage message; message.subject = "Soggetto"; message.message = "Ciao come stai<br>io bene.<br>www.mischianti.org"; EMailSender::Response resp = emailSend.send("hcubeh@yahoo.com", message); Serial.println("Sending status: "); Serial.println(resp.status); Serial.println(resp.code); Serial.println(resp.desc); } void loop() { }
Hi, I have tried the following. 1. I have used my iPhone’s hotspot as a wifi source since my home network may have possible network problem such as firewall. Result: same error as before. 2. I have spoofed my email address to see if I get different error code. Result: same error as before. 3. telnet to smtp.gmail.com 25 result: telnet smtp.gmail.com 25
Trying 142.251.8.108…
Connected to smtp.gmail.com.
Escape character is ‘^]’.
220 smtp.gmail.com ESMTP z11-20020a17090a1fcb00b001bc58804974sm5738172pjz.27 – gsmtp4. telnet to smtp.gmail.com 465. Result: telnet smtp.gmail.com 465
Trying 142.251.8.108…
Connected to smtp.gmail.com.
Escape character is ‘^]’.
Connection closed by foreign host.I used the standard WiFi management and EMailSenderEsp8266GMailTest.ino and still I can’t get a connection. Here is the serial monitor output. Hopefully you can make sense of it. Thank you
Connecting to Tea King
…………….
Connection: ESTABLISHED
Got IP address: 192.168.88.217
ONLY ONE RECIPIENTmiltiple destination and attachments
Insecure client:0
smtp.gmail.com
465
Sending status:
0
2
Could not connect to mail serverI read your link. I did not use your version of the Wi-Fimanager library. I think that is the problem. Do I just swap the whole library? Or should I change a file? Thanks
Thank you for replying. I think WifiManager set the DNS, but I am not sure. I will read up on the link you provided. Here is the serial output:
wm:[1] AutoConnect: SUCCESS
*wm:[1] STA IP Address: 192.168.88.217
Connection data is correct!
192.168.88.217
HTTP server started
ONLY ONE RECIPIENTmiltiple destination and attachments
Insecure client:0
smtp.gmail.com
465
Sending status:
0
2
Could not connect to mail server -
AuthorPosts