Hi,
Ah, excellent work! Too bad you're using the wrong compiler. ;-)
Everything you need to know is in the RFCs covering the SMTP protocol but they can be a bit "much" from time to time. I also, strongly suggest that you do some "manual" emailing using telnet to your intended server, that way you get a feel for the protocol and what it "looks like". Anyway, here's a list from my notes
- Setup a free socket with IP adress and port (usually 25 or 2525) of remote SMTP server.
- Open the socket and wait for it to initialize.
- Issue the sockets connect command, ARP request resolves the remote MAC adress and populate the W5100 registers.
- Wait for remote server to return a response 220. If it doesn't the remote server probably isn't a SMTP server.
- Send EHLO adress.domain
- Wait for remote server to return a response 250
- Send AUTH LOGIN
- Wait for server remote server to return a response 334
- Send the username of the email account, BASE64 encoded
- Wait for server remote server to return a response 334
- Send account password, BASE64 encoded
- Wait for remote server to return a response 235 - when received the connection is authenticated.
- Send the Mail From: command
- Wait for remote server to return a response 250
- Send the Rcpt To: command
- Wait for remote server to return a response 250
- Send the DATA command
- Wait for remote server to return a response 354
- Send a <CR><LF>, a valid email header, the content of the email, followed by <CR><LF>.<CR><LF> (note the dot)
- Wait for remote server to return a response 250
- Send the QUIT command
- Wait for remote server to return a response 221 (bye bye).
- Close the connection.
A complete email including the header might look like this, note the blank lines and the dot at the end.
Date: Tue, 25 Mar 2014 19:18:00 +0200
Message-Id: <1234>
From: Your W5100
To: Someone <[email protected]>
Subject: Test
Hello,
This is a test.
.
If you don't want to use authenticated login the use the HELO command instead of EHLO.
And again, note that the above will not work with email servers requiring SSL or other encryption.
/Henrik.




Bookmarks