Jump to main content

##

# TCPIP_SMTPC_MailMessage Function

## C

    TCPIP_SMTPC_MESSAGE_HANDLE TCPIP_SMTPC_MailMessage(
        const TCPIP_SMTPC_MAIL_MESSAGE* pMailMessage,
        TCPIP_SMTPC_MESSAGE_RESULT* pRes
    );

## Description

This function sends a mail message to the specified server.

## Preconditions

SMTPC module should have been initialized.

## Parameters

Parameters | Description
--- | ---
pMailMessage | Pointer to a TCPIP_SMTPC_MAIL_MESSAGE describing the mail message to be sent.
pRes | Address to store the operation result. If the call failed, additional info will be reported with this result. Can be NULL if not needed.

## Returns

- A valid handle (!= 0) - If mail message scheduled successfully.
- 0 - If call failed.
- Error code otherwise.

## Remarks

The returned handle is valid until the final mail notification function is called (TCPIP_SMTPC_MESSAGE_CALLBACK()), if exists, or until the mail transaction is completed. After that the messageHandle is no longer valid and should not be used again.