The attached sketch retrieves a mail from a POP3 mail server.
It is working for me, but I don't know if it works for others. Can someone test it ?
Everything is explaned in the sketch. I used an Arduino Mega with Ethernet Shield.
Send an email to a mail server with the Subject "L=1", and when the Arduino reads that email, it turns on the system led.
Yes, the define for deleting is on. I set up a mail server specific for the Arduino.
I could add a keyword to the Subject: ARDUINO L=1
The subject could be checked, and only if that keyword is found it is read and deleted.
Now that I think about it, that means going through all the emails. That needs a lot more code....
And if one of the other emails contains a photo of 10MB, the Arduino reads the full 10MB....
Hmm, that can't be good. Perhaps the "TOP" command to scan all the headers...
Version 1.01 is attached.
Now using "TOP" to get only the headers. Scanning through all the emails until one is found with "ARDUINO " at the beginning of the "Subject: ". That email with "ARDUINO " is deleted so the Arduino doesn't get the command twice.
Change the pop server settings in the sketch and send an email with "ARDUINO L=1" in the subject. That turns the system led on.