Network Component  Version 7.2
MDK Middleware for IPv4 and IPv6 Networking
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Control Interface

Functions to connect to an SMTP server. More...

Functions

netStatus netSMTPc_Connect (const NET_ADDR *addr)
 Start SMTP client to send an email. [thread-safe].
 

Description

Functions to connect to an SMTP server.

The SMTP client session starts with a connect request using netSMTPc_Connect. The SMTP client then opens a SMTP connection to the specified server. The user application then needs to wait for the callback function netSMTPc_Notify to return the state of the operation. Based on the callback event, further processing can be started.

Function Documentation

netStatus netSMTPc_Connect ( const NET_ADDR addr)

Start SMTP client to send an email. [thread-safe].

Parameters
[in]addrstructure containing IP address and port of SMTP server.
Returns
status code that indicates the execution status of the function as defined with netStatus.

The function netSMTPc_Connect starts the SMTP client. The SMTP client then connects to an SMTP server specified with the argument addr which points to a buffer containing the IP address and port of the SMTP server. If the specified port is 0, the client uses a standard SMTP server port 25 to connect to the server.

Note
An application can call the netSMTPc_Connect function to connect to an SMTP server to send emails.

Code Example

const NET_ADDR4 smtp_server = { NET_ADDR_IP4, 0, 192, 168, 0, 253 };
..
// Start SMTP client, use default SMTP port
if (netSMTPc_Connect ((NET_ADDR *)&smtp_server) != netOK) {
// Failed to start SMTP process
}