Arduino NANO + ESP8266 SMTP mail problem

Hello! I am trying to use ESP8266 for my project and i have to send email. I found this example https://gist.github.com/Lstt2005/a1a72211b0e2d67a4f01 I think i understand the code mostly and I'm sure about my tx-rx connections but project is not working stably.. even though there is not an error about wifi connections just 2 or 3 out of 20 test is actually working :confused: If there is anyone who knows why please tell me :-[

#include <SoftwareSerial.h>
SoftwareSerial Serial3(12,11); 

#define SSID "******" 
#define PASS "**********" 

#define SMTPServer "mail.smtp2go.com"
#define SMTPPort "2525" 
#define MailLogin "*******" // 
#define MailLoginBase64 "*******"
#define MailPasswordBase64 "********" 
#define MailRelay "********" 
#define Message "Hello from Arduino!" 

#define SERIAL_RX_BUFFER_SIZE 256
#define SERIAL_TX_BUFFER_SIZE 256


void setup()
{
    delay(2000);
    Serial3.begin(115200);
    Serial3.setTimeout(5000);
    Serial.begin(115200); 
    Serial.println("Init");
    Serial3.println("AT+RST"); 
    delay(1000);
    if(Serial3.find("ready")) {
        Serial.println("WiFi - Module is ready");
    }else{
        Serial.println("Module doesn't respond.");
        while(1);
    }
    delay(100);

    Serial3.println(" AT+CIPMODE=0");
    WiteString("OK");
    while(Serial3.available()) { Serial3.read();}

    Serial3.println("AT+CIPMUX=1");
    WiteString("OK");
    while(Serial3.available()) { Serial3.read();}

    // try to connect to wifi
    boolean connected = false;
    for(int i=0;i<5;i++) {
        if(connectWiFi()) {
            connected = true;
            break;
        }
    }
        if (!connected) {
        while(1);
    }

    
}
void loop()
{
  
  String cmd = "AT+CIPSTART=0,\"TCP\",\"";
        cmd += String(SMTPServer);
        cmd += "\"," + String(SMTPPort);
        Serial3.println(cmd);
        
        if(Serial3.find("CONNECT")) {
            Serial.println("Link");
        }
        else {
            Serial.println("Link fail");
            while (1);
        }
    
        if (WiteString("OK", 2000)) {
            while(Serial3.available()) { Serial3.read();}
        }
        else {
            while (1);
      }
  
    Send("HELO 1.2.3.4", true);
    Send("AUTH LOGIN", true);
    Send(MailLoginBase64, true);
    Send(MailPasswordBase64, true);
    Send("MAIL FROM:<" + String(MailLogin) + ">", true);
    Send("RCPT TO:<" + String(MailRelay) + ">", true);
    Send("DATA", true);
    Send("Subject: Alarm", false);
    Send("To: <" + String(MailRelay)+ ">", false);
    Send("From: <" + String(MailLogin) + ">", false);
    Send("", false);
    Send(Message, false);
    Send(".", true);
    Send("QUIT", true);
    Serial.println("sended");
    while(1){};
}
 
boolean connectWiFi()
{
  Serial3.println("AT+CWMODE=1");
  while (!Serial3.available())  { delay(10);}
  while (Serial3.available()) {Serial3.read();}
  String cmd="AT+CWJAP=\"";
  cmd+=SSID;
  cmd+="\",\"";
  cmd+=PASS;
  cmd+="\"";
  Serial3.println(cmd);

  if(WiteString("OK", 8000)){
    Serial.println("Connected to WiFi.");
    return true;
  }else{
    Serial.println("Can not connect to the WiFi.");
    return false;
  }
}

bool Send(String S, bool wite) {
    Serial3.print("AT+CIPSEND=0,");
    Serial3.println(S.length()+2);
    while (!Serial3.available()) { delay(10);}
    if(Serial3.find(">")){
    }else{
        Serial3.println("AT+CIPCLOSE=0");
        delay(1000);
        return false;
    }
    Serial3.print(S + "\r\n");
    if (WiteString("OK", 15000)) {
        if (wite) {
            WiteString("+IPD", 15000);
            while(Serial3.available()) {
                Serial3.read();}}
        return true;}
    else {
        return false;}
}

void WiteString(String S) {
    int L = S.length();
    String T = String(" ");
    while(1) {
        if (Serial3.available()) {
            char c = Serial3.read();
            T = T + String(c);
            if (T.length() > L) T = T.substring(1);
            if (S.charAt(0) == T.charAt(0))
            if (S.compareTo(T) == 0) return;
        }
        else {
            delay(1);
        }
    }
}

bool WiteString(String S, int Time) {
    int L = S.length();
    String T = String(" ");
    while(Time>0) {
        if (Serial3.available()) {
            char c = Serial3.read();
            T = T + String(c);
            if (T.length() > L) T = T.substring(1);
            if (S.charAt(0) == T.charAt(0))
            if (S.compareTo(T) == 0) return true;
        }
        else {
            delay(1);
            Time--;
        }
    }
    return false;
}

String WiteString(int Time) {
    String T = String("");
    while(Time>0) {
        if (Serial3.available()) {
            char c = Serial3.read();
            T = T + String(c);
        }
        else {
            delay(1);
            Time--;
        }
    }
    return T;
}