The SMTP client code is operating enough to send a message through my ISP's server to the outside world.
The SMTP protocol is not very complex, but it has evolved quite a bit in the many years it has been around. Finding documentation specific enough to get the authentication stuff working was the most difficult part.Information is scattered through several RFC documents.
I had a weird problem where the SMTP simulator that I wrote worked OK, and the real server did not. It turned out that I was using \r\n sequences to end the commands to the WIFI module, and it only needed the \r character. When I issued the socket write command (AT+S.sockw) to send a command or data to the SMTP server, I used the \r\n sequence to close the command. The \n character was unnecessary and it got stuck on the front of the SMTP command that I was trying to send. This caused two problems. First, it caused the real SMTP server to send an error message about bad syntax before processing each command. Second, since you must tell the WIFI module how many characters you are going to write to a socket, it resulted in one fewer of the "payload" characters being sent to the socket.
After a lot of poking around with Wireshark, and digging through my TCPIP book, I figured out the problem and corrected it.
The authentication still needs some work. The AUTH LOGIN authentication does not send usernames and passwords in clear text, but it is sending them in a simple BASE64 format that obscures stuff but would still be trivial to snoop. Possible fixes for this are to investigate the CRAM-MD5 protocol or to see if I can just open a secure socket to the SMTP server and let the existing code in the WIFI module deal with the encryption.
I still need to clean up the code, add some error handling and such, but this is a major milestone for this project.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
do u have anny other tools for smtps
Are you sure? yes | no