How to Use SMTP Using My Mcu

by wpgnss in Circuits > Computers

1301 Views, 2 Favorites, 0 Comments

How to Use SMTP Using My Mcu

556bb613937ddbe293000126.jpeg

I'm trying to make smtp protocol using my mcu & ethernet(W5500)

SMTP(Simple Mail Transfer Protocol)

smtp.PNG
3wayhandshake.png
send_ok_2.jpg

There are 3 steps for sending e-mail

  1. Establish TCP session with SMTP server (3way handshaking)
  2. Response & Requset SMTP Command
  3. Close the session

SMTP link:

Meterials.

w5500-evb.png

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

function_list.PNG
include_list.PNG
define_list.PNG

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

another_simple_mail.PNG
file_mail.PNG

I was able to confirm that the CC and txt File arrives.