Intro: How to Use SMTP Using My Mcu
I'm trying to make smtp protocol using my mcu & ethernet(W5500)
Step 1: 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
Step 2: 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
- software: LPCxpresso
- downloader: Flash magic
- etc: Hercules(Serial terminal) for debug
Step 3: Software
There are 8 functions for send e-mail but you can use 2 functions for use it.
- server = SMTP server address
- from = your full e-mail address (ex: email@example.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'
- 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
Step 4: Results
I was able to confirm that the CC and txt File arrives.