Sending Email ENC28J60

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
cruzxia
Posts: 88
Joined: Wed Jan 04, 2006 7:34 am
Been thanked: 8 times

Sending Email ENC28J60

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Sending Email ENC28J60

Post 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();

cruzxia
Posts: 88
Joined: Wed Jan 04, 2006 7:34 am
Been thanked: 8 times

Re: Sending Email ENC28J60

Post 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

Post Reply