Hi, yes I did get an email sent using this as a template.
From what I can figure out, you can't send email using gmail because the arduino doesn't have any ssl libraries, and gmail only allows for ssl/tls connections through their SMTP servers.
HOWEVER, yahoo.com DOES allow free open SMTP traffic if you use their mobile servers (the ones for smartphones like blackberries, droid, etc.)
So if you enter the IP address of their smtp.mobile.mail.yahoo.com server (98.136.86.109), and you authenticate (you have to send a username/password). Then you can send any email you want.
To authenticate, you have to send an encoded username/password, you can generate it on your computer and just copy/paste it into your arduino sketch.
So grab the info from here: qmail.jms1.net/test-auth.shtml - sorry, this is my first post, so the site won't let me make this a link.
Basically it says to run a perl script with your info like this: perl -MMIME::Base64 -e 'print encode_base64("\000jms1\@jms1.net\000not.my.real.password")'
Then copy/paste the output into your sketch. Here's my example:
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xAF, 0xCE, 0xDD }; // whatever mac you want
byte ip[] = { LOCAL IP ADDRESS };
byte server[] = { 98, 136, 86, 109 }; // Mail server address (this is for yahoo's mobile smtp)
Client client(server, 587); // yahoo's mobile smtp server ip/port
void setup()
{
Ethernet.begin(mac, ip);
Serial.begin(9600);
delay(1000);
Serial.println("connecting...");
if (client.connect()) {
Serial.println("connected");
client.println("EHLO MYSERVER");
client.println("AUTH PLAIN ************************************"); // replace the **'s with your auth info from the perl script.
client.println("MAIL FROM:<email@email.email>");
client.println("RCPT TO:<email@email.email>");
client.println("DATA");
client.println("From: <email@email.email>");
client.println("TO: <email@email.email>");
client.println("SUBJECT: This is the subject");
client.println();
client.println("This is the body.");
client.println("This is another line of the body.");
client.println(".");
client.println(".");
} else {
Serial.println("connection failed");
}
}
void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c);
}
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;;)
;
}
}
Now this is actually my first Arduino sketch. It sends an email every time I hit the reset button. It seems to work for me, but as always, YMMV.
-Rob