I followed your advice , I have an email account in smtp2go and this is my code but it do not works even not connects. I tested with cmd command from my pc with my smtp2go account and I had not a problem but with arduino does no connect.
thanks for your comments and sorry my english is not good.
#include <Dhcp.h>
#include <Dns.h>
#include <Ethernet.h>
#include <EthernetClient.h>
#include <EthernetServer.h>
#include <EthernetUdp.h>
#include <util.h>
#include <SPI.h>
byte mac[] = {0x90, 0xA2, 0xDA, 0x0D, 0x5C, 0x16};
IPAddress ip(192,168,1,5);
byte gateway [] = {192,168,1,1};
byte subnet [] = {255, 255, 255, 0};
byte smtp[] = {186,47,174,186};//{ 207,58,147,66 }; // I tried with two ip
EthernetServer server(80); //nslookup to smtpcorp.com
//IPAddress server(207,58,147,66); // conflicting declaration 'IPAddress server' -- and I do not why.
EthernetClient client;
void setup()
{
Ethernet.begin(mac, ip,gateway,subnet);
Serial.begin(9600);
delay(1000);
Serial.println("connecting...");
if (client.connect(smtp,8025)) //2525/25/8025/587/465/8465 // I tried with all ports
{
delay(500);
client.println("ehlo");
delay(500);
client.println("auth login");
delay(500);
client.println(" name account base 64"); //mail account with smtp2go
delay(500);
client.println("password base 64");
delay(500);
client.println("mail from: mail account with gmail"); //This is related to smtp2go
delay(500);
client.println("rcpt to: xxxxxxxxxx");
delay(500);
client.println("data");
delay(500);
client.println("To: xxxxx");
delay(500);
client.println("From: xxxxx");
delay(500);
client.println("Subject: MENSAJE DE PRUEBA");
delay(500);
client.println();
delay(500);
client.println("ESTE ES UN MENSAJE DE PRUEBA DESDE ARDUINO");
delay(500);
client.println(".");
delay(500);
client.println("quit");
}
else {
Serial.println("connection failed");
}
}
void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c);
}
while (Serial.available() > 0) {
char inChar = Serial.read();
if (client.connected()) {
client.print(inChar);
}
}
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
while(true);
}
}