Page 1 of 1
Sending Email ENC28J60
Posted: Mon Aug 17, 2015 8:50 am
by cruzxia
I want to send an email from a pic24 device using the ENC28J60 component.
Most scripts I can find on the net to send emails require PHP on the server, and I am uncertain how to implement PHP on my pic.
What is the simplest way to send an email using the ENC28J60 component?
Regards
Cruzxia
Re: Sending Email ENC28J60
Posted: Mon Aug 17, 2015 10:42 am
by Benj
Hello,
You do not need PHP to send an email.
An email is simply a TCP transaction similar to requesting a webpage.
So you would establish a TCP connection to the server and then simply send the data using the connection. Here the client.println is Arduinos way of sending a string via the TCP connection.
Code taken from here:
http://playground.arduino.cc/Code/Email
Code: Select all
startTCPIP();
// change to your public ip
client.println(F("helo 1.2.3.4"));
// change to your email address (sender)
client.println(F("MAIL From: <me@mydomain.com>"));
// change to recipient address
client.println(F("RCPT To: <you@yourdomain.com>"));
client.println(F("DATA"));
// change to recipient address
client.println(F("To: You <you@yourdomain.com>"));
// change to your address
client.println(F("From: Me <me@mydomain.com>"));
client.println(F("Subject: Arduino email test\r\n"));
client.println(F("This is from my Arduino!"));
client.println(F("."));
client.println(F("QUIT"));
stopTCPIP();
Re: Sending Email ENC28J60
Posted: Tue Aug 18, 2015 7:47 am
by cruzxia
Hello Benj
Thanks for the reply. I have been looking at the Arduino coding, and I have a few questions.
I am trying to send the commands using TCPIP_ENC28J60: FillTcpDAta in place of (client.println). I noticed in the Arduino coding they are waiting for a reply after each command is sent. How do I check for the acknowledgment?
Should it work something like this.
FillTcpData(0, "helo 1.2.3.4""); // returns DataLength
Check for reply with time out.
FillTcpData(DataLength, "MAIL FROM: <
me@mydomain.com>");
Check for reply with time out.
etc.
Am I on the right track with this?
Lastly
ClientSendPacket - can you give a bit of explanation of this macro, there is very little info in the help file.
cruzxia