Hi ![]()
I want to send an email by using arduino ethernet shield.
So far I have tried to use google smtp server (smtp-relay.gmail.com, port 587)
As you can probably tell I'm a beginner at this.
I really hope someone can help me ![]()
This is the setup part of the code:
#include <Ethernet.h>
#include <SPI.h>
byte mac[]= { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,0,103);
IPAddress gateway(192,168,0,1);
IPAddress subnet(255,255,255,0);
char server[]="smtp-relay.gmail.com";
int port=587;
EthernetClient client;
void setup()
{
Serial.begin(115200);
Ethernet.begin(mac,ip,gateway,gateway,subnet);
delay(2000);
}
And this is the sending email part of the code:
Serial.println("Connecting...");
if(client.connect(server, port))
Serial.println("Connected");
client.println("EHLO ");
This EHLO part I'm really unsure about
client.println("AUTH LOGIN");
client.println("Mail in base 64 code");
client.println("Password in base 64 code");
client.print("MAIL FROM:");
client.println("fromMail@gmail.com");
client.print("RCPT TO:");
client.println("toMail@gmail.com");
client.println("DATA");
client.print("from");
client.println("fromMail@gmail.com");
client.print("to:");
client.println("toMail@gmail.com");
client.println("SUBJECT: Something");
client.println();
client.println("This is the body.");
client.println(".");
client.println("QUIT");
client.stop();
Serial.println("Sent");
The Arduino seems to run trough the whole code. In the serial monitor it prints "Connecting..", "Connected" and "Sent" but no email so far ![]()
Anyone have any ideas as to how I can fix it?