Site icon Renzo Mischianti

different mail server not connecting

Hi Mischanti, first you made a great library thanks for that, i have been dancing around with this library and probably i can't seem to get it to work with a different email server. keep getting could not connect to mail server.i now the server can handle it.(made with a different email sender) see below: Sending greeting response... > C: send smtp command, HELO < S: 250-8BITMIME < S: 250-PIPELINING < S: 250-PIPE_CONNECT < S: 250-AUTH PLAIN LOGIN < S: 250-STARTTLS < S: 250 HELP Send command, STARTTLS > C: send STARTTLS command < S: 220 TLS go ahead > C: performing the SSL/TLS handshake Sending greeting response... > C: send smtp command, HELO < < S: 250-8BITMIME < S: 250-PIPELINING < S: 250-PIPE_CONNECT < S: 250-AUTH PLAIN LOGIN < S: 250 HELP

/*
 * EMailSender library for Arduino, esp8266 and esp32
 * Simple esp8266 Gmail send example
 *
 * http://mischianti.org/category/my-libraries/emailsender-send-email-with-attachments/
 *
 */

#include "Arduino.h"
#include <EMailSender.h>
#include <ESP8266WiFi.h>

const char *ssid = "Pannekoek";
const char *password = "stroopensuiker";

uint8_t connection_state = 0;
uint16_t reconnect_interval = 10000;

//EMailSender (………email_login,email_password,..email_from,……….name_from….., smtp_server, smtp_port );
EMailSender emailSend("tuinalarm@ziggo.nl","12345","tuinalarm@ziggo.nl","tuinalarm@ziggo.nl","smtp.ziggo.nl",587);

//void setIsSecure(bool isSecure = false);
//void setSASLLogin(bool isSASLLogin = false);

		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("iemand@gmail.com",
					message);

			Serial.println("Sending status: ");

			Serial.println(resp.status);
			Serial.println(resp.code);
			Serial.println(resp.desc);
		}

		void loop() {

		}

can you help???
Exit mobile version