user28709: I am developing a sketch that uses an Uno and an ESP8266 to send email via smtp2go.  However "HELO" responds with "ERROR".  What might be the source of the problem?
To explore this, I created another sketch that simply sends commands to the ESP8266, and displays the results.
The wifi connection seems fine, as does the SMTP Server connect to mail.smtp2go.com.
However, the next command issued "HELO 10.1.0.35" provides a response of "ERROR".
The ESP8266 is  mounted on an ESP-01 board, and set @ 9600 baud.  have tested with different chip sets.
I have also tried using Gmail [smtp.gmail.com,465 ], but results are the same.
[I know that an ESP8266 can be used stand-alone.  However the final sketch requires 13 data pins.]
Output from sketch:
"ESP8266_ATcmdtest", compiled on: Jun  8 2017 at 17:58:18
Running on: Arduino UNO: ATmega328P

__________[ Disable echo (Echo sends back received command before response) ]__________
__________[ ATE0 ]__________
Response buffer:
OK

__________[ Delete server ]__________
__________[ AT+CIPSERVER=0 ]__________
Response buffer:
no change
OK

__________[ Restart the module ]__________
__________[ AT+RST ]__________
Response buffer:
OK
0,CLOSED
WIFI DISCONNECT
bB׆QR⸮⸮⸮ȤRN⸮ɥRL⸮H⸮⸮N⸮⸮d#@⸮⸮
WIFI CONNECTED

__________[ Check Firmware type [Responds with: AT version:1.2.0.0(Jul  1 2016 20:04:45) ]__________
__________[ AT+GMR ]__________
Response buffer:
AT+GMR
AT version:1.2.0.0(Jul  1 2016 20:04:45)
SDK version:WIFI GOT IP

__________[ Lists available APs ]__________
__________[ AT+CWLAP ]__________
Response buffer:
AT+CWLAP

+CWLAP:(0,"KCTcircuit2",-47,"08:bd:43:ff:6a:0c",1,21,0)
+CWLAP:(3,"49KHC",-88,"70:f1:96:66:29:ef",1,11,0)
+CWLAP:(3,"KCTstudy",-49,"04:a1:51:bf:6b:30",5,-11,0)
+CWLAP:(3,"Linksys05761",-75,"b4:75:0
e:64:54:b1",11,21,0)
+CWLAP:(3,"Pccd_main",-91,"14:91:82:83:f8

__________[ Get local IP address, e.g., 192.168.4.1 ]__________
__________[ AT+CIFSR ]__________
Response buffer:
AT+CIFSR
+CIFSR:STAIP,"10.0.0.4"
+CIFSR:STAMAC,"5c:cf:7f:34:

__________[ Set Station mode ]__________
__________[ AT+CWMODE=1 ]__________
Response buffer:
AT+CWMODE=1
OK

__________[ Set current multiplex mode ]__________
__________[ AT+CIPMUX=1 ]__________
Response buffer:
AT+CIPMUX=1

OK

__________[ Connect to AP ]__________
__________[ AT+CWJAP="KCTstudy","[pw redacted]" ]__________
Response buffer:
AT+CWJAP="KCTstudy","[pw redacted]"
WIFI DISCONNECT
WIFI CONNECTED

__________[ Prints the SSID of Access Point ESP8266 is connected to. ]__________
__________[ AT+CWJAP? ]__________
Response buffer:
AT+CWJAP?
busy p...
WIFI GOT IP

OK

__________[ Get IP address of ESP8266 station, e.g., 10.0.0.4 ]__________
__________[ AT+CIPSTA? ]__________
Response buffer:
AT+CIPSTA?
+CIPSTA:ip:"10.0.0.4"
+CIPSTA:gateway:"10.0.0.1"

__________[ SMTPServer connect ]__________
__________[ AT+CIPSTART=0,"TCP","mail.smtp2go.com",2525 ]__________
Response buffer:
AT+CIPSTART=0,"TCP","mail.smtp2go.com",2525
0,CONNECT

OK

+IPD,0,70:220 mail.smtp2go.com ESMTP Exim 4.87 Fri, 09 Jun 2017 00:59:07 +0000

__________[ Get information about connection ]__________
Response format  is:
STATUS:stat [ 2: Got IP, 3: Connected, 4: Disconnected]
+CIPSTATUS:id,type,addr,port,tetype [type: TCP, addr: IP address]
OK
__________[ AT+CIPSTATUS ]__________
Response buffer:
AT+CIPSTATUS
STATUS:3
+CIPSTATUS:0,"TCP","173.255.233.87",25

__________[ HELO ]__________
__________[ HELO 10.0.0.8 ]__________
Response buffer:
HELO 10.0.0.4
ERROR


Sketch code
#include <SoftwareSerial.h>

// _______________________________
#define sendit(x) ( { \
    Serial.print(F("__________[ ")); \
    Serial.print(x); \
    Serial.println(F(" ]__________")); \
     esp8266.write(x); \
   esp8266.write("\r\n"); \
     delay(300); \
     Serial.println(F("Response buffer: ")); \
     for (int i=0; i <= 99; i++) { \
         memset(buffer, 0, sizeof(buffer)); \
         delay(10); \
       bcount = esp8266.readBytes(buffer, sizeof(buffer)); \
           if (bcount == 0)  i = 100; \
           else { \
    if (bcount > 1) Serial.println(buffer); \
    delay(300); \
      } \
    } \
  } )

// _______________________________
#define desc(x) ( { \
    Serial.println(); \
    Serial.print(F("__________[ ")); \
    Serial.print(F(x)); \
    Serial.println(F(" ]__________")); \
  } )

// _______________________________
SoftwareSerial esp8266(11, 12); // RX, TX
char buffer[200];
String SerialReadBuffer = "";
char SerialByteIn; // Temporary variable
boolean SerialEnd = false;
int bcount;

// _______________________________
void setup()
{
    Initialise();
}

// _______________________________
void loop()
{
}

// ____________________________________________________________________________________________________
void Initialise()
{
    SerialReadBuffer.reserve(64);
    esp8266.begin(9600);
        // esp8266.begin(115200);
    Serial.begin(9600);
    CommandList2();
}

// ____________________________________________________________________________________________________
void CommandList2()
{
    desc("Disable echo (Echo sends back received command before response)");
    sendit("ATE0");
    desc("Delete server");
    sendit("AT+CIPSERVER=0");
    desc("Restart the module");
    sendit("AT+RST");
    desc("Check Firmware type [Responds with: AT version:1.2.0.0(Jul  1 2016 20:04:45)");
    sendit("AT+GMR");
    desc("Lists available APs");
    sendit("AT+CWLAP");
    desc("Get local IP address, e.g., 192.168.4.1");
    sendit("AT+CIFSR");
    desc("Set Station mode");
    sendit("AT+CWMODE=1");
    desc("Set current multiplex mode");
    sendit("AT+CIPMUX=1");
    desc("Connect to AP");
    sendit("AT+CWJAP=\"KCTstudy\",\"[pw redacted]\"");
    desc("Prints the SSID of Access Point ESP8266 is connected to.");
    sendit("AT+CWJAP?");
    desc("Get IP address of ESP8266 station, e.g., 10.0.0.4");
    sendit("AT+CIPSTA?");
    desc("SMTPServer connect");
    sendit("AT+CIPSTART=0,\"TCP\",\"mail.smtp2go.com\",25");
    desc("Get information about connection");
    Serial.println(F("Response format  is: "));
    Serial.println(F("STATUS:stat [ 2: Got IP, 3: Connected, 4: Disconnected]"));
    Serial.println(F("+CIPSTATUS:id,type,addr,port,tetype [type: TCP, addr: IP address]"));
    Serial.println(F("OK"));
    sendit("AT+CIPSTATUS");
    //
    // Problems start here
    //
    desc("HELO");
    sendit("HELO 10.0.0.4");
    Serial.println(F("__________________"));
}


user4143: You're sending the word "HELO" to the ESP8266 and the ESP8266 is, quite rightly, saying "What?!?! I don't know the command HELO!"
You have opened a connection in multiple connection mode with ID 0. You then have to send data through that connection.  For instance:
AT+CIPSTART=0,"TCP\","mail.smtp2go.com",2525
OK
AT+CIPSEND=0,15
> HELO 10.0.0.4<CR><LF>
SEND OK

Using a protocol like SMTP in this mode is not easy. Better would be to use "unvarnished" mode:
AT+CIPSTART="TCP","mail.smtp2go.com",2525
OK
Linked
AT+CIPMODE=1
OK
AT+CIPSEND
> HELO 10.0.0.4<CR><LF>
250 mail.smtp2go.com Hello 10.0.0.4 [23.114.28.226]
MAIL FROM: "Foo Bar" <foo@bar.com>
250 OK
... etc ...
QUIT
221 mail.smtp2go.com closing connection

Note that just sending commands and blindly printing the responses isn't really the best way to go about it. You should be actively interpreting the responses that you get back and making decisions based upon them. Especially when you're in SEND mode. The SMTP protocol is two-way. You need to know what the responses are saying and what that means for your SMTP session.

28709: <p>I am developing a sketch that uses an Uno and an ESP8266 to send email via smtp2go.  However "HELO" responds with "ERROR".  What might be the source of the problem?</p>

<p>To explore this, I created another sketch that simply sends commands to the ESP8266, and displays the results.
The wifi connection seems fine, as does the SMTP Server connect to mail.smtp2go.com.
However, the next command issued "HELO 10.1.0.35" provides a response of "ERROR".</p>

<p>The ESP8266 is  mounted on an ESP-01 board, and set @ 9600 baud.  have tested with different chip sets.
I have also tried using Gmail [smtp.gmail.com,465 ], but results are the same.</p>

<p>[I know that an ESP8266 can be used stand-alone.  However the final sketch requires 13 data pins.]</p>

<p>Output from sketch:</p>

<pre><code>"ESP8266_ATcmdtest", compiled on: Jun  8 2017 at 17:58:18
Running on: Arduino UNO: ATmega328P

__________[ Disable echo (Echo sends back received command before response) ]__________
__________[ ATE0 ]__________
Response buffer:
OK

__________[ Delete server ]__________
__________[ AT+CIPSERVER=0 ]__________
Response buffer:
no change
OK

__________[ Restart the module ]__________
__________[ AT+RST ]__________
Response buffer:
OK
0,CLOSED
WIFI DISCONNECT
bB׆QR⸮⸮⸮ȤRN⸮ɥRL⸮H⸮⸮N⸮⸮d#@⸮⸮
WIFI CONNECTED

__________[ Check Firmware type [Responds with: AT version:1.2.0.0(Jul  1 2016 20:04:45) ]__________
__________[ AT+GMR ]__________
Response buffer:
AT+GMR
AT version:1.2.0.0(Jul  1 2016 20:04:45)
SDK version:WIFI GOT IP

__________[ Lists available APs ]__________
__________[ AT+CWLAP ]__________
Response buffer:
AT+CWLAP

+CWLAP:(0,"KCTcircuit2",-47,"08:bd:43:ff:6a:0c",1,21,0)
+CWLAP:(3,"49KHC",-88,"70:f1:96:66:29:ef",1,11,0)
+CWLAP:(3,"KCTstudy",-49,"04:a1:51:bf:6b:30",5,-11,0)
+CWLAP:(3,"Linksys05761",-75,"b4:75:0
e:64:54:b1",11,21,0)
+CWLAP:(3,"Pccd_main",-91,"14:91:82:83:f8

__________[ Get local IP address, e.g., 192.168.4.1 ]__________
__________[ AT+CIFSR ]__________
Response buffer:
AT+CIFSR
+CIFSR:STAIP,"10.0.0.4"
+CIFSR:STAMAC,"5c:cf:7f:34:

__________[ Set Station mode ]__________
__________[ AT+CWMODE=1 ]__________
Response buffer:
AT+CWMODE=1
OK

__________[ Set current multiplex mode ]__________
__________[ AT+CIPMUX=1 ]__________
Response buffer:
AT+CIPMUX=1

OK

__________[ Connect to AP ]__________
__________[ AT+CWJAP="KCTstudy","[pw redacted]" ]__________
Response buffer:
AT+CWJAP="KCTstudy","[pw redacted]"
WIFI DISCONNECT
WIFI CONNECTED

__________[ Prints the SSID of Access Point ESP8266 is connected to. ]__________
__________[ AT+CWJAP? ]__________
Response buffer:
AT+CWJAP?
busy p...
WIFI GOT IP

OK

__________[ Get IP address of ESP8266 station, e.g., 10.0.0.4 ]__________
__________[ AT+CIPSTA? ]__________
Response buffer:
AT+CIPSTA?
+CIPSTA:ip:"10.0.0.4"
+CIPSTA:gateway:"10.0.0.1"

__________[ SMTPServer connect ]__________
__________[ AT+CIPSTART=0,"TCP","mail.smtp2go.com",2525 ]__________
Response buffer:
AT+CIPSTART=0,"TCP","mail.smtp2go.com",2525
0,CONNECT

OK

+IPD,0,70:220 mail.smtp2go.com ESMTP Exim 4.87 Fri, 09 Jun 2017 00:59:07 +0000

__________[ Get information about connection ]__________
Response format  is:
STATUS:stat [ 2: Got IP, 3: Connected, 4: Disconnected]
+CIPSTATUS:id,type,addr,port,tetype [type: TCP, addr: IP address]
OK
__________[ AT+CIPSTATUS ]__________
Response buffer:
AT+CIPSTATUS
STATUS:3
+CIPSTATUS:0,"TCP","173.255.233.87",25

__________[ HELO ]__________
__________[ HELO 10.0.0.8 ]__________
Response buffer:
HELO 10.0.0.4
ERROR
</code></pre>

<hr>

<p>Sketch code</p>

<pre><code>#include &lt;SoftwareSerial.h&gt;

// _______________________________
#define sendit(x) ( { \
    Serial.print(F("__________[ ")); \
    Serial.print(x); \
    Serial.println(F(" ]__________")); \
     esp8266.write(x); \
   esp8266.write("\r\n"); \
     delay(300); \
     Serial.println(F("Response buffer: ")); \
     for (int i=0; i &lt;= 99; i++) { \
         memset(buffer, 0, sizeof(buffer)); \
         delay(10); \
       bcount = esp8266.readBytes(buffer, sizeof(buffer)); \
           if (bcount == 0)  i = 100; \
           else { \
    if (bcount &gt; 1) Serial.println(buffer); \
    delay(300); \
      } \
    } \
  } )

// _______________________________
#define desc(x) ( { \
    Serial.println(); \
    Serial.print(F("__________[ ")); \
    Serial.print(F(x)); \
    Serial.println(F(" ]__________")); \
  } )

// _______________________________
SoftwareSerial esp8266(11, 12); // RX, TX
char buffer[200];
String SerialReadBuffer = "";
char SerialByteIn; // Temporary variable
boolean SerialEnd = false;
int bcount;

// _______________________________
void setup()
{
    Initialise();
}

// _______________________________
void loop()
{
}

// ____________________________________________________________________________________________________
void Initialise()
{
    SerialReadBuffer.reserve(64);
    esp8266.begin(9600);
        // esp8266.begin(115200);
    Serial.begin(9600);
    CommandList2();
}

// ____________________________________________________________________________________________________
void CommandList2()
{
    desc("Disable echo (Echo sends back received command before response)");
    sendit("ATE0");
    desc("Delete server");
    sendit("AT+CIPSERVER=0");
    desc("Restart the module");
    sendit("AT+RST");
    desc("Check Firmware type [Responds with: AT version:1.2.0.0(Jul  1 2016 20:04:45)");
    sendit("AT+GMR");
    desc("Lists available APs");
    sendit("AT+CWLAP");
    desc("Get local IP address, e.g., 192.168.4.1");
    sendit("AT+CIFSR");
    desc("Set Station mode");
    sendit("AT+CWMODE=1");
    desc("Set current multiplex mode");
    sendit("AT+CIPMUX=1");
    desc("Connect to AP");
    sendit("AT+CWJAP=\"KCTstudy\",\"[pw redacted]\"");
    desc("Prints the SSID of Access Point ESP8266 is connected to.");
    sendit("AT+CWJAP?");
    desc("Get IP address of ESP8266 station, e.g., 10.0.0.4");
    sendit("AT+CIPSTA?");
    desc("SMTPServer connect");
    sendit("AT+CIPSTART=0,\"TCP\",\"mail.smtp2go.com\",25");
    desc("Get information about connection");
    Serial.println(F("Response format  is: "));
    Serial.println(F("STATUS:stat [ 2: Got IP, 3: Connected, 4: Disconnected]"));
    Serial.println(F("+CIPSTATUS:id,type,addr,port,tetype [type: TCP, addr: IP address]"));
    Serial.println(F("OK"));
    sendit("AT+CIPSTATUS");
    //
    // Problems start here
    //
    desc("HELO");
    sendit("HELO 10.0.0.4");
    Serial.println(F("__________________"));
}
</code></pre>
 4143: <p>You're sending the word "HELO" to the ESP8266 and the ESP8266 is, quite rightly, saying "What?!?! I don't know the command HELO!"</p>

<p>You have opened a connection in <em>multiple connection</em> mode with ID 0. You then have to <em>send</em> data through that connection.  For instance:</p>

<pre><code>AT+CIPSTART=0,"TCP\","mail.smtp2go.com",2525
OK
AT+CIPSEND=0,15
&gt; HELO 10.0.0.4&lt;CR&gt;&lt;LF&gt;
SEND OK
</code></pre>

<p>Using a protocol like SMTP in this mode is not easy. Better would be to use "unvarnished" mode:</p>

<pre><code>AT+CIPSTART="TCP","mail.smtp2go.com",2525
OK
Linked
AT+CIPMODE=1
OK
AT+CIPSEND
&gt; HELO 10.0.0.4&lt;CR&gt;&lt;LF&gt;
250 mail.smtp2go.com Hello 10.0.0.4 [23.114.28.226]
MAIL FROM: "Foo Bar" &lt;foo@bar.com&gt;
250 OK
... etc ...
QUIT
221 mail.smtp2go.com closing connection
</code></pre>

<p>Note that just sending commands and blindly printing the responses isn't really the best way to go about it. You should be actively interpreting the responses that you get back and making decisions based upon them. Especially when you're in SEND mode. The SMTP protocol is two-way. You need to know what the responses are saying and what that means for your SMTP session.</p>
