---
title: "W55RP20 SMTP example"
url: "https://maker.wiznet.io/Aimee0/projects/w55rp20-smtp-example/"
markdown_url: "https://maker.wiznet.io/Aimee0/projects/w55rp20-smtp-example/md"
type: "WCC: WIZnet Created Content"
author: "Aimee"
author_url: "https://maker.wiznet.io/Aimee0/"
original_author: "Aimee"
published: "2024-10-22"
language: "en"
hardware: ["WIZnet W55RP20-EVB-Pico"]
likes: 0
views: 693
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# W55RP20 SMTP example

> This is an example of acting as an SMTP client using W55RP20-EVB-Pico.

Original author: Aimee

## Components

- **WIZnet W55RP20-EVB-Pico** x 1 ([docs](https://wiznet.io/products/powered-by-raspberry-pi/w55rp20-evb-pico))

## Documents and links

- [W55RP20 smtp example](https://github.com/WIZnet-ioNIC/WIZnet-PICO-SMTP-C) (code)

## Article

github link : <https://github.com/WIZnet-ioNIC/WIZnet-PICO-SMTP-C>

### SMTP? (Simple Mail Transfer Protocol)

SMTP is the **standard communication protocol** used for sending emails over the internet. It governs the process of transmitting emails from the sender’s client to the recipient’s server. SMTP primarily handles **email transmission** between servers, and it is also used when a user sends an email via an email client, such as Outlook or Thunderbird.

### How to test SMTP example

**Setup board configuration**

Setup board to W55RP20_EVB_PICO in CMakeLists.txt in WIZnet-PICO-C/ directory.

```plaintext
# Set board
#set(BOARD_NAME WIZnet_Ethernet_HAT)
#set(BOARD_NAME W5100S_EVB_PICO)
#set(BOARD_NAME W5500_EVB_PICO)
set(BOARD_NAME W55RP20_EVB_PICO)
#set(BOARD_NAME W5100S_EVB_PICO2)
#set(BOARD_NAME W5500_EVB_PICO2)
```

**Setup network settings**

Setup network configuration such as IP in 'w5x00_smtp.c' which is the SMTP example in 'WIZnet-PICO-SMTP-C/examples/smtp/' directory.

```plaintext
/* Network */
static wiz_NetInfo g_net_info =
    {
        .mac = {0x00, 0x08, 0xDC, 0x12, 0x34, 0x56}, // MAC address
        .ip = {192, 168, 11, 2},                     // IP address
        .sn = {255, 255, 255, 0},                    // Subnet Mask
        .gw = {192, 168, 11, 1},                     // Gateway
        .dns = {8, 8, 8, 8},                         // DNS server
        .dhcp = NETINFO_STATIC                       // DHCP enable/disable
};
```

Setup smtp configuration in 'w5x00_smtp.c' in 'WIZnet-PICO-SMTP-C/examples/smtp/' directory.

```plaintext
/* Port */
#define PORT_STMP 25
...
static uint8_t g_smtp_target_ip[4] = {192, 168, 11, 3};
```

**Setup smtp message configuration**

Setup smtp message configuration in 'smtp.c'.

```plaintext
char hello[50] = "HELO localhost";                       
char hello_reply[] = "250";                          
char from[] = "admin@demo.org";                        
char from_reply[] = "250";
char to[] = "wiznet@demo.org"; 
char to_reply[] = "250";
char data_init[10] = "data";                 
char data_reply[] = "354";                   
char Cc[] = "wiznet@demo.org";             
char subject[] = "Hello!WIZnet!";            
char content[] = "Hello!WIZnet!";            
char mime_reply[] = "250"; 
char mailfrom[50] = "MAIL FROM:<>";
char rcptto[50] = "rcpt to:<>";
char mime[200] = "From:\r\n";
char mime1[50] = "To:\r\n";
char mime2[50] = "Cc:\r\n";
char mime3[50] = "Subject:\r\n";
char mime4[50] = "MIME-Version:1.0\r\nContent-Type:text/plain\r\n\r\n";
char mime5[50] = "\r\n.\r\n";
```

**Setup SMTP server**

1. Setup IIS

![](https://maker.wiznet.io/upload/ckeditor5/915160816%5F1729616447%2Epng)

2. Config SMTP mail

![](https://maker.wiznet.io/upload/ckeditor5/915160816%5F1729616512%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/915160816%5F1729616532%2Epng)

3. Download MailEnable

<https://www.mailenable.com/download.asp>

![](https://maker.wiznet.io/upload/ckeditor5/915160816%5F1729616784%2Epng)

Check STMP port is listening.

![](https://maker.wiznet.io/upload/ckeditor5/915160816%5F1729616870%2Epng)

Add user in mailbox.

![](https://maker.wiznet.io/upload/ckeditor5/915160816%5F1729616892%2Epng)

**Build & Run**

Build project and copy w5x00_smtp.uf2 to 'RPI-RP2'.

Reset your board, you can see the network information and the email is sent.

![](https://maker.wiznet.io/upload/ckeditor5/915160816%5F1729616948%2Epng)

You can check the email in the smtp server program.

![](https://maker.wiznet.io/upload/ckeditor5/915160816%5F1729616966%2Epng)

---

Source: https://maker.wiznet.io/Aimee0/projects/w55rp20-smtp-example/
