How to Use SMTP Using My Mcu
I'm trying to make smtp protocol using my mcu & ethernet(W5500)
SMTP(Simple Mail Transfer Protocol)
There are 3 steps for sending e-mail
- Establish TCP session with SMTP server (3way handshaking)
- Response & Requset SMTP Command
- Close the session
SMTP link:
Meterials.
Just used W5500-EVB(Ethernet evaluation board) for sending e-mail.
- mcu: LPC11E36(CM0) included in W5500-EVB
- etc: MAC address
- ethernet: W5500
W5500 wiki page: http://wizwiki.net/wiki/doku.php?id=products:w5500:start
Tools
- software: LPCxpresso
- downloader: Flash magic
- etc: Hercules(Serial terminal) for debug
Software
There are 8 functions for send e-mail but you can use 2 functions for use it.
1. SendMail()
- server = SMTP server address
- from = your full e-mail address (ex: abcd@eee.com)
- pwd = password
- to[] = receiver e-mail address
- cc[] = receiver e-mail address(carbon copy)
- subject = subject
- body = body
- auth = you can choose 2 options between 'SMTP_AUTH_NONE' and 'SMTP_AUTH_PLAIN'
- FileAttached = if you want to send some files, you cans choose a option instead of 'FILE_DISABLE'
2. AttachFile()
- filename = file name (ex: abc.txt)
- filebody = file body
- filetype = ZIP, TXT, JPG, BIN
- Used sntp.h for getting the time.
** I'll upload the entire source code at github and write link after modified a bit
Results
I was able to confirm that the CC and txt File arrives.