hello I try to send an email from arduino ethernet through an account smt2go and telnet but I do not know where is the problem because my receiver does not receive anything in spite of write the commands of telnet are well like you can see on the image attachment , the weirdest is the report in my smtp2go account records the shipping.
thanks.
#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, 0x18};//mac of my arduino ethernet
byte smtp[] = { 207,58,147,66 }; //nslookup to smtpcorp.com
EthernetServer server(80);
EthernetClient client;
void setup()
{
Serial.begin(9600);
Serial.println("wating");
/**********************************/
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
for(;;);
}
Serial.print("My IP address: ");
for (byte thisByte = 0; thisByte < 4; thisByte++) {
Serial.print(Ethernet.localIP()[thisByte], DEC);
Serial.print(".");
}
Serial.println();
delay(2000);
/**********************************/
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("xxxxxxxxxxxx"); //mail account with smtp2go base64
delay(500);
client.println("xxxxxxxxxxxx"); //password with smtp2go base64
delay(500);
client.println("mail from: ekarduino001@gmail.com");
delay(500);
client.println("rcpt to: xxxxxxxxxxxx");
delay(500);
client.println("data");
delay(500);
client.println("To: USER");
delay(500);
client.println("From: ekarduino001");
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 there are incoming bytes available
// from the server, read them and print them:
if (client.available()) {
char c = client.read();
Serial.print(c);
}
// as long as there are bytes in the serial queue,
// read them and send them out the socket if it's open:
while (Serial.available() > 0) {
char inChar = Serial.read();
if (client.connected()) {
client.print(inChar);
}
}
// if the server's disconnected, stop the client:
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
// do nothing:
while(true);
}
}