Hello. This is my first post.
I wish to send an email through SMTP2GO to my gmail account when a temperature probe goes out of range.
The extracted section for the email itself is below.
The serial monitor displays connected after connecting with mail.smtp2go.com (server2).
I didn't have client.read in there before because after the serial monitor displayed "email sent" I thought it was successful but the SMTP2GO dashboard shows no mails sent and gmail has nothing received. So I inserted the function to print out what the client was saying but nothing is printed to the serial monitor.
This might have something to do with authentication.
SMTP2GO can accept pre-approved IP addresses but I'm not sure which one it is going to accept because I have a public IP that people see outside my network (211.xx.xx.xx), then I have the generic 198.168.0.17 IP from within my network.
Which one do I use?
And can anyone see an issue with the SMTP syntax?
//send email alert
if { \if temp out of range
Serial.println("Connecting to: ");
Serial.println(server2);
if (client.connect(server2,2525)) {
Serial.println("connected");
if (client.available()) {
char c = client.read();
Serial.print(c);
}
client.println("HELO 198.168.0.17");
client.println("AUTH LOGIN");
client.println("akvapoiertpawekljrnhsaxci=="); //Base64 username
client.println("asdfgadfrt"); //Base64 password
client.println("MAIL FROM:xxxxx@xxxxx.edu.au");
client.println("RCPT TO:xx.xxxx@gmail.com");
client.println("DATA");
client.println("From:xxxxx@xxxxx.edu.au");
client.println("To:xx.xxxx@gmail.com");
client.println("SUBJECT: Testing subject to arduino ethernet shield");
client.println();
client.println("This is the line body.");
client.println("This is another line of the body.");
client.println(".");
client.println("QUIT");
client.stop();
Serial.println("Disconnected");
Serial.println("Email sent");
} else {
Serial.println("connection failed");
}