Site icon Renzo Mischianti

WiFiManager and Wemos d1 esp8266 sending mail problem

Total newbie here. I just can't figure out why I can't connect to the smtp server. I have used the app password. Can someone take a look for me? here is my code. Thanks for the assist
#include <WiFiClient.h> 
#include <WiFiManager.h>          //https://github.com/tzapu/WiFiManager
#include <TimeLib.h> 
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <strings_en.h>
#include <ESP8266mDNS.h>

#include <ESP_EEPROM.h>
#include "Arduino.h"
//wifi,email, internet
#include <EMailSender.h>
//#include <ArduinoJson.h>
//
#include "mainPage.h"
#include <Wire.h>
#include <Beastdevices_INA3221.h>

//Wifi setting

#define AP_SSID "custom" // custom filter roller SSID
#define AP_PWD  "1234567890"      // custom passowrd

ESP8266WebServer server(80);
WiFiManager wm;                 

char email_to[32] = "";
char email_login[32] = "";   //these are stored in EEPROM after input from web
char email_password[32] = "";

EMailSender emailSend(email_login, email_password);    
void setup() {
 
  EEPROM.begin (120);
 
  
//Wifi setup
  WiFi.mode(WIFI_STA); //set wifi toSTA;default STA+AP
  wm.setConfigPortalBlocking(false);
  wm.setConfigPortalTimeout(60);

    //automatically connect using saved credentials if they exist
    //If connection fails it starts an access point with the specified name
  // check if stored connection info is correct
  if (wm.autoConnect(AP_SSID, AP_PWD)) {
    Serial.println("\Connection data is correct!");
     Serial.println(WiFi.localIP());
  } else {
    Serial.println("\Connection data is incorrect…");
  }

//wm.startConfigPortal();

 
EMailSender::EMailMessage message;
    message.subject = "Float sensor may be stuck";
    message.message = "Float sensor may be stuck, motor disabled until float sensor is resetted";
    EMailSender::Response resp = emailSend.send(email_to, message);
    Serial.println("Sending status: ");
    Serial.println(resp.status);
    Serial.println(resp.code);
    Serial.println(resp.desc);
};
Exit mobile version