SMTP Client#

Functions#

int32_t
rsi_smtp_client_create(uint8_t flags, uint8_t *username, uint8_t *password, uint8_t *from_address, uint8_t *client_domain, uint8_t auth_type, uint8_t *server_ip, uint32_t port)

Create an SMTP client. nitialize the client with a given configuration. This is a blocking API.

int32_t
rsi_smtp_client_mail_send_async(uint8_t *mail_recipient_address, uint8_t priority, uint8_t *mail_subject, uint8_t *mail_body, uint16_t mail_body_length, void(*smtp_client_mail_response_handler)(uint16_t status, const uint8_t cmd_type))

Send mail to the recipient from the SMTP client. This is non-blocking API.

int32_t
rsi_smtp_client_delete_async(void(*smtp_client_delete_response_handler)(uint16_t status, const uint8_t cmd_type))

Delete SMTP client. This is a non-blocking API.

Function Documentation#

rsi_smtp_client_create#

int32_t rsi_smtp_client_create (uint8_t flags, uint8_t *username, uint8_t *password, uint8_t *from_address, uint8_t *client_domain, uint8_t auth_type, uint8_t *server_ip, uint32_t port)

Create an SMTP client. nitialize the client with a given configuration. This is a blocking API.

Parameters
[in]flags

- Select IPV4/IPv6 version

Flags

Description

BIT(0) - RSI_IPV6

Set this bit to enable IPv6. Configured to IPv4 by default

BIT(1) to BIT(7)

Reserved for future use

[in]username

- Username for authentication, must be a NULL terminated string

[in]password

- Password for authentication, must be a NULL terminated string

[in]from_address

- Sender's address, must be a NULL terminated string

[in]client_domain

- Domain name of the client, must be a NULL terminated string

[in]auth_type

- Client authentication type. 1 - SMTP_CLIENT_AUTH_LOGIN, 3 - SMTP_CLIENT_AUTH_PLAIN

[in]server_ip

- SMTP server IP address. IPv4 address - 4 Bytes hexa-decimal, IPv6 address - 16 Bytes hexa-decimal

[in]port

- SMTP server TCP port

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffd,0xfffffffa)

Note

  • Precondition - rsi_config_ipaddress() API needs to be called before this API.

  • This API is not supported in current release.

  • Refer to Error Codes for the description of above error codes.


Definition at line 53 of file network/protocols/rsi_smtp_client.c

rsi_smtp_client_mail_send_async#

int32_t rsi_smtp_client_mail_send_async (uint8_t *mail_recipient_address, uint8_t priority, uint8_t *mail_subject, uint8_t *mail_body, uint16_t mail_body_length, void(*smtp_client_mail_response_handler)(uint16_t status, const uint8_t cmd_type))

Send mail to the recipient from the SMTP client. This is non-blocking API.

Parameters
[in]mail_recipient_address

- Mail recipient address

[in]priority

- Priority level at which mail is delivered. 1 - RSI_SMTP_MAIL_PRIORITY_LOW, 2 - RSI_SMTP_MAIL_PRIORITY_NORMAL, 4 - RSI_SMTP_MAIL_PRIORITY_HIGH

[in]mail_subject

- Subject line text, a null terminated string.

[in]mail_body

- Mail message

[in]mail_body_length

- Length of the mail body

[in]smtp_client_mail_response_handler

- Callback when asynchronous response comes from the sent mail. status: Status code, cmd: Sub-command type

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffd,0xfffffffa)

Note

  • Precondition - rsi_config_ipaddress() API needs to be called before this API.

  • This API is not supported in current release.

  • The total maximum length of mail_recipient_address, mail_subject & mail_body is 1024 bytes

  • If status in callback is non-zero, then sub command type will be in 6th byte of the descriptor

  • Refer to Error Codes for the description of above error codes.


Definition at line 266 of file network/protocols/rsi_smtp_client.c

rsi_smtp_client_delete_async#

int32_t rsi_smtp_client_delete_async (void(*smtp_client_delete_response_handler)(uint16_t status, const uint8_t cmd_type))

Delete SMTP client. This is a non-blocking API.

Parameters
[in]smtp_client_delete_response_handler

- Callback when asynchronous response comes for the delete request status: Status code cmd : Sub-command type

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffd,0xfffffffa)

Note

  • Precondition - rsi_config_ipaddress() API needs to be called before this API.

  • This API is not supported in current release.

  • If status in callback is non-zero, then sub-command type will be in 6th byte of the descriptor.


Definition at line 399 of file network/protocols/rsi_smtp_client.c