SMTP C API Reference
Table of Contents | Previous | Next | Index

Messaging Access SDK Guide
Part 2. Messaging Access SDK C Reference


Chapter 9
SMTP C API Reference

This chapter describes the functions and structures of the C language API for the SMTP (Simple Mail Transfer Protocol) protocol of the Messaging Access SDK.

You'll find links to each function and structure in this introduction. Each reference entry gives the name of the function or structure, its header file, its syntax, and its parameters.

All C interface definitions are found in the smtp.h file.

[Top]

SMTP Functions

This table lists SMTP functions alphabetically by name, with descriptions. Click the function name to get information about it.

Function Description
smtp_bdat

Sends binary data chunks to the server.

smtp_connect

Connects to the server using the default port.

smtp_data

Prepares to send data to the server.

smtp_disconnect

Closes the socket connection with the server.

smtp_ehlo

Sends the EHLO command to the server.

smtp_expand

Expands a given mailing list.

smtp_free

Frees the smtpClient_t structure.

smtp_get_option

Gets IO models.

smtp_help

Gets help on a given topic.

smtp_initialize

Initializes and allocates the smtpClient_t structure and sets the response sink.

smtp_mailFrom

Initiates sending message; supplies message's reverse path.

smtp_noop

Gets positive server response; does not affect SMTP session.

smtp_processResponses

Processes the server responses for API commands.

smtp_quit

Closes the connection with the server.

smtp_rcptTo

Specifies a message recipient's address.

smtp_reset

Resets the state of the server; discards any sender and recipient information.

smtp_send

Sends message data to the server.

smtp_sendCommand

Sends an unsupported command to the server.

smtp_sendStream

Sends message data from a stream to the server.

smtp_setChunkSize

Sets the size of the data chunks to send.

smtp_set_option

Sets IO models.

smtp_setPipelining

Attempts to enable pipelining.

smtp_setResponseSink

Sets a new response sink.

smtp_setTimeout

Sets the amount of time allowed to wait before returning control to the user.

smtp_verify

Verifies a username.

smtpSink_free

Frees the SMTP response sink and its data members.

smtpSink_initialize

Initializes and allocates the smtpSink_t structure.

[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_bdat

Sends binary data chunks to the server.

Syntax

#include <smtp.h>
int smtp_bdat(
smtpClient_t * in_pSMTP,
               const char * in_data,
               unsigned int length,
               boolean in_fLast);

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

in_data

Pointer to message data.

length

Size of the binary chunk to send. Default: 1K.

in_fLast

Whether this is the last data chunk to send. Values:

Returns

Description

This function sends data in binary chunks of the size you determine. Call smtp_bdat multiple times until the boolean value in the in_fLast parameter is set to true.

If you use the smtp_send or smtp_sendStream function, send data with smtp_data and not with smtp_bdat. For more information, see Sending the Message.

This function sends the DATA SMTP protocol command.

NOTE: bdat is not supported by Messaging Server 4.0. Use smtp_data instead. §
This function is mapped to one or more callbacks in the smtpSink_t structure. For more information, see SMTP Function Callback Mapping.

See Also

smtpSink_t.bdat, smtpSink_t.error, smtp_data, 
smtp_sendStream, smtp_send, smtp_setChunkSize
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_connect

Connects to the server using the specified port.

Syntax

#include <smtp.h>
int smtp_connect(
smtpClient_t * in_pSMTP,
                  const char * in_server,
                  unsigned short in_port );

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

in_server

Pointer to the name of the server.

in_port

Server port to connect to. A value of 0 connects using the Protocol standard default port (25).

Returns

Description

For more information, see Connecting to a Server.

This function is mapped to one or more callbacks in the smtpSink_t structure. For more information, see SMTP Function Callback Mapping.

See Also

smtpSink_t.connect, smtpSink_t.error, 
smtp_quit, smtp_ehlo
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_data

Prepares to send data to the server.

Syntax

#include <smtp.h>
int smtp_data(
smtpClient_t * in_pSMTP);

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

Returns

Description

This function sends data in conjunction with smtp_send or smtp_sendstream. Call smtp_data, then call one of these functions. You must always use smtp_data and not smtp_bdat with either of these functions. This function sends the DATA SMTP protocol command. For more information, see Sending the Message.

This function is mapped to one or more callbacks in the smtpSink_t structure. For more information, see SMTP Function Callback Mapping.

See Also

smtpSink_t.data, smtpSink_t.error, smtp_bdat,
smtp_send, smtp_sendStream
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_disconnect

Closes the socket connection with the server.

Syntax

#include <smtp.h>
int smtp_disconnect(
smtpClient_t * in_pSMTP );

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client to disconnect.

Returns

Description

This function closes the socket connection. It could be used to implement a Cancel button.

NOTE: Do not call the SMTP_processResponses function after this function. Operations for which you do not call processResponses: disconnecting, the set functions, initializing and freeing the client and sink. §

See Also

smtp_connect, smtp_ehlo
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_ehlo

Starts the SMTP session

Syntax

#include <smtp.h> 
int smtp_ehlo(
smtpClient_t * in_pSMTP,
               const char * in_domain );

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

in_domain

Pointer to the server domain name string.

Returns

Description

This function returns a multiline message listing the SMTP extensions, such as pipelining or DSN, that are supported by the server. This is similar to the functionality of the IMAP4 capability command. This function sends the EHLO SMTP protocol command. For more information, see Determining ESMTP Support.

This function is mapped to one or more callbacks in the smtpSink_t structure. For more information, see SMTP Function Callback Mapping.

See Also

smtpSink_t.ehlo, smtpSink_t.error, 
smtpSink_t.ehloComplete, smtp_connect,
imap4_capability
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_expand

Expands the specified mailing list.

Syntax

#include <smtp.h> 
int smtp_expand(
smtpClient_t * in_pSMTP,
                const char * in_mailingList);

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

in_mailingList

Pointer to name of user mailing list you want to expand.

Returns

Description

This function gets the email addresses of the users on the mailing list. It sends the EXPN SMTP protocol command.

This function is mapped to one or more callbacks in the smtpSink_t structure. For more information, see SMTP Function Callback Mapping.

See Also

smtpSink_t.expand, smtpSink_t.expandComplete, 
smtpSink_t.error
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_free

Frees the SMTPClient_t structure.

Syntax

#include <smtp.h> 
void smtp_free(
smtpClient_t ** in_ppSMTP );

Parameters

The function has the following parameters:
in_ppSMTP

Pointer to a pointer to a client structure.

Description

This function frees the SMTPClient_t structure. When the function returns, the client structure is set to null. The user must free any pointers to opaque data.

See Also

smtp_initialize, smtpSink_free
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_get_option

Gets IO models.

Syntax

#include <smtp.h> 
int smtp_get_option(
smtpClient_t * in_pSMTP,
                     int in_option,
                     void * in_pOptionData );

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

in_option

Pointer to option you want to set. See nsmail_io_fns_t. For the option that is currently supported, see "Option Definition."

in_pOptionData

Pointer to option data set with smtp_set_option.

Returns

Description

This Do not call processResponses after this function.

See Also

smtp_set_option
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_help

Asks the server for help on a specified topic.

Syntax

#include <smtp.h> 
int smtp_help(
smtpClient_t * in_pSMTP,
               const char * in_helpTopic);

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

in_helpTopic

Pointer to one-word help topic name. If null, displays help information on all supported commands.

Returns

Description

This function asks the server for help on a specified topic. It sends the HELP SMTP protocol command.

This function is mapped to one or more callbacks in the smtpSink_t structure. For more information, see SMTP Function Callback Mapping.

See Also

smtpSink_t.help, smtpSink_t.helpComplete, smtpSink_t.error
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_initialize

Initializes and allocates the SMTPClient_t structure and sets the response sink.

Syntax

#include <smtp.h> 
int smtp_initialize(
smtpClient_t ** out_ppSMTP,
                   smtpSink_t * in_psmtpSink );

Parameters

The function has the following parameters:
out_ppSMTP

Pointer to a pointer to an SMTP client structure.

in_psmtpSink

Pointer to the response sink structure to use.

Returns

Description

Do not call processResponses after this function.

For more information, see Creating a Client.

See Also

smtp_connect, smtpSink_free
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_mailFrom

Initiates sending message; supplies message's reverse path.

Syntax

#include <smtp.h>
int smtp_mailFrom(
smtpClient_t * in_pSMTP,
                  const char * in_reverseAddress,
                  const char * in_esmtpParams );

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

in_reverseAddress

Message's reverse path, usually sender's fully qualified domain name.

in_esmtpParams

Pointer to optional ESMTP (Extended SMTP) parameters.

Returns

Description

This function initiates sending the message. The in_reverseAddress parameter supplies the message's reverse path, usually the sender's fully qualified domain name. This function sends the MAIL FROM: SMTP protocol command. For more information, see Setting the Mailer.

NOTE: Using the ESMTP option DSN requires a detailed understanding of the SMTP protocol. (Links to RFCs: SMTP RFCs) §
This function is mapped to one or more callbacks in the smtpSink_t structure. For more information, see SMTP Function Callback Mapping.

See Also

smtpSink_t.mailFrom, smtpSink_t.error, smtp_rcptTo
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_noop

Gets positive server response.

Syntax

#include <smtp.h> 
int smtp_noop(
smtpClient_t * in_pSMTP);

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

Returns

Description

If you send any command, the server responds with a "still here" response. Sending the smtp_noop function does nothing except force this server response. You can use this function to maintain server connection, perhaps issuing it at timed intervals to make sure that the server is still active.

Your application may not need this function. For example, if the application does something and then disconnects at once, there is no need to make sure that the server is still connected.

This function sends the NOOP SMTP protocol command. It is mapped to one or more callbacks in the smtpSink_t structure. For more information, see SMTP Function Callback Mapping.

See Also

smtpSink_t.noop, smtpSink_t.error
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_processResponses

Processes the server responses for API commands.

Syntax

#include <smtp.h> 
int smtp_processResponses(
smtpClient_t * in_pSMTP );

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

Returns

Description

This function reads in responses from the server. It invokes the callback functions provided by the user for all responses that are available at the time of execution.

If a time-out occurs, the user can continue by calling smtp_processResponses again.

Do not call SMTP_processResponses after these operations: disconnecting, using any of the set functions, or initializing or freeing either the client or the response sink.

See Also

smtpSink_t
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_quit

Closes the connection with the server.

Syntax

#include <smtp.h> 
int smtp_quit(
smtpClient_t * in_pSMTP);

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

Returns

Description

This function sends the QUIT SMTP protocol command. Issuing this function ends the session. For more information, see Ending the Session.

This function is mapped to one or more callbacks in the smtpSink_t structure. For more information, see SMTP Function Callback Mapping.

See Also

smtpSink_t.quit, smtpSink_t.error
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_rcptTo

Specifies a message recipient's address.

Syntax

#include <smtp.h> 
int smtp_rcptTo(
smtpClient_t * in_pSMTP,
                const char * in_forwardAddress,
                const char * in_esmtpParams );

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

in_forwardAddress

Pointer to the recipient's address.

in_esmtpParams

Pointer to optional ESMTP (Extended SMTP) parameters.

Returns

Description

This function specifies the address of a message recipient. It is called once for each recipient and should follow the smtp_mailFrom command. For more information, see Setting the Recipient.

This function sends the RCPT TO SMTP protocol command. It is mapped to one or more callbacks in the smtpSink_t structure. For more information, see SMTP Function Callback Mapping.

See Also

smtpSink_t.rcptTo, smtpSink_t.error, smtp_mailFrom
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_reset

Resets the state of the server; discards any sender and recipient information.

Syntax

#include <smtp.h> 
int smtp_reset(
smtpClient_t * in_pSMTP );

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

Returns

Description

This function cancels the current mail transfer and resets the state of the server. It sends the RSET SMTP protocol command, causing the server to return to the state that followed the last function that sent the EHLO command.

This function is mapped to one or more callbacks in the smtpSink_t structure. For more information, see SMTP Function Callback Mapping.

See Also

smtpSink_t.reset, smtpSink_t.error, smtp_ehlo
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_send

Sends message data to the server.

Syntax

#include <smtp.h> 
int smtp_send(
smtpClient_t * in_pSMTP,
               const char * in_data );

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

in_data

Pointer to message data to send.

Returns

Description

This function sends data in conjunction with smtp_data. Call smtp_data, then call this function. For more information, see Sending the Message.

You can use either the send or sendStream function to deliver data to the server. smtp_send sends data in a single chunk, while smtp_sendStream sends the data in a series of smaller chunks. If you use one of these functions, prepare to send data with smtp_data and not smtp_bdat.

This function is mapped to one or more callbacks in the smtpSink_t structure. For more information, see SMTP Function Callback Mapping.

See Also

smtpSink_t.send, smtpSink_t.error, 
smtp_bdat, smtp_data, smtp_sendStream
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_sendCommand

Sends an SMTP command that is not otherwise supported by the SDK.

Syntax

#include <smtp.h> 
int smtp_sendCommand(
smtpClient_t * in_pSMTP,
                      const char * in_command);

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

in_command

Pointer to the unsupported command to send.

Returns

Description

You can use this function to extend the protocol to meet your application needs. Using this function, you can extend the functionality of the SDK to meet your needs by adding functions or passing different parameters to a function.

This function is mapped to one or more callbacks in the smtpSink_t structure. For more information, see SMTP Function Callback Mapping.

See Also

smtpSink_t.sendCommand, 
smtpSink_t.SendCommandComplete,
smtpSink_t.error
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_sendStream

Sends message data from a stream to the server.

Syntax

#include <smtp.h> 
int smtp_sendStream(
smtpClient_t * in_pSMTP,
                     nsmail_inputstream_t * in_inputStream );

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

in_inputStream

Pointer to the input stream source of the data to send.

Returns

Description

This function sends data in conjunction with smtp_data. Call smtp_data, then call this function. For more information, see Sending the Message.

You can use either the send or sendStream function to deliver data to the server. smtp_send sends data in a single chunk, while smtp_sendStream sends the data in a series of smaller chunks. If you use one of these functions, prepare to send data with smtp_data and not smtp_bdat.

This function is mapped to one or more callbacks in the smtpSink_t structure. For more information, see SMTP Function Callback Mapping.

See Also

smtpSink_t.send, smtpSink_t.error,  
smtp_bdat, smtp_data, smtp_send
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_setChunkSize

Sets the size of the data chunks to send.

Syntax

#include <smtp.h> 
int smtp_setChunkSize(
smtpClient_t * in_pSMTP,
                      int in_chunkSize );

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

in_chunkSize

Size of message data chunk to set. Default: 1 K.

Returns

Description

This function sets the size of the message data chunks that are read from the input stream and sent to the server. For more information, see Sending the Message.

See Also

smtp_sendStream
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_set_option

Sets IO models.

Syntax

#include <smtp.h> 
int smtp_set_option(
smtpClient_t * in_pSMTP,
                     int in_option,
                     void * in_pOptionData );

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

in_option

Pointer to option you want to set. See nsmail_io_fns_t. For the option that is currently supported, see "Option Definition."

in_pOptionData

Pointer to option data you want to set.

Returns

Description

To inquire on options set with this function, use smtp_get_option.

NOTE: Do not call the processResponses function after this function. §

See Also

smtp_get_option
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_setPipelining

Attempts to enable pipelining.

Syntax

#include <smtp.h> 
int smtp_setPipelining(
smtpClient_t * in_pSMTP,
                        boolean in_enablePipelining);

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

in_enablePipelining

Whether to enable pipelining. Values:

Returns

Description

This function attempts to enable or disable pipelining. Pipelining is enabled if the server supports it. If not, the way the network works does not change. This function sends the PIPELINING SMTP protocol command.

Pipelining is a way to batch functions. If enabled, pipelinable functions are stored locally until a specific function triggers the commands to be sent. When triggered by any non-pipelinable function, all functions begin to execute.

The pipelinable functions are smtp_bdat, smtp_mailFrom, smtp_rcptTo, smtp_send, and smtp_sendStream.

You can enable pipelining at any time, but it may make sense to do this immediately after invoking the smtp_ehlo function.

For more information, see Pipelining Commands.

NOTE: Do not call the processResponses function after this function. Functions for which you do not call processResponses: disconnecting, the set functions, initializing and freeing the client and sink. §

See Also

smtp_ehlo, smtp_bdat, smtp_mailFrom,
smtp_rcptTo, smtp_send, smtp_sendStream
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_setResponseSink

Sets a new response sink.

Syntax

#include <smtp.h> 
int smtp_setResponseSink (
smtpClient_t * in_pSMTP,
                           smtpSink_t * in_psmtpSink );

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

in_psmtpSink

Pointer to the response sink to use.

Returns

Description

This function overrides the response sink passed into the initialized function.

NOTE: Do not call the processResponses function after this function. Functions for which you do not call processResponses: disconnecting, the set functions, initializing and freeing the client and sink. §

See Also

smtpSink_t
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_setTimeout

Sets the amount of time allowed to wait before returning control to the user.

Syntax

#include <smtp.h> 
int smtp_setTimeout(
smtpClient_t * in_pSMTP,
                     double in_timeout );

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

in_timeout

Time-out period to set in seconds. Values, in seconds:

Returns

Description

This function sets the amount of time, in seconds, allowed to wait before returning control to the user.

NOTE: Do not call the processResponses function after this function. Functions for which you do not call processResponses: disconnecting, the set functions, initializing and freeing the client and sink. §

See Also

smtp_processResponses
[Top] [SMTP Functions] [SMTP Functions by Task]

smtp_verify

Verifies a user name.

Syntax

#include <smtp.h> 
int smtp_verify(
smtpClient_t * in_pSMTP,
                  const char * in_user );

Parameters

The function has the following parameters:
in_pSMTP

Pointer to the SMTP client.

in_user

Pointer to the user name to verify.

Returns

Description

This function sends the VRFY SMTP protocol command. It is mapped to one or more callbacks in the smtpSink_t structure. For more information, see SMTP Function Callback Mapping.

See Also

smtpSink_t.verify, smtpSink_t.error
[Top] [SMTP Functions] [SMTP Functions by Task]

smtpSink_free

Frees the SMTP response sink and its data members.

Syntax

#include <pop3.h>
void smtpSink_free( smtpSink_t ** in_ppsmtp_Sink );

Parameters

The function has the following parameters:
in_ppsmtpSink

Pointer to a pointer to a client structure associated with the response sink to free.

Returns

Description

This function frees the SMTPClient_t structure and its data members. When this function returns, the response sink is set to null. The user must free any opaque data.

NOTE: Do not call the processResponses function after this function. §

See Also

smtp_quit, smtp_free, smtpSink_initialize
[Top] [SMTP Functions] [SMTP Functions by Task]

smtpSink_initialize

Initializes and allocates the smtpSink_t structure.

Syntax

#include <smtp.h> 
int smtpSink_initialize( smtpSink_t ** out_ppsmtpSink );

Parameters

The function has the following parameters:
out_ppSMTPSink 

Pointer to pointer to the response sink to initialize.

Returns

Description

For more information, see Creating a Response Sink.

NOTE: Do not call the processResponses function after this function. §

See Also

smtp_connect, smtp_noop, smtpSink_free,
smtp_initialize
[Top] [SMTP Functions] [SMTP Functions by Task]

SMTP Structures

This section defines SMTP data structures, listed in alphabetical order.

smtpClient_t
smtpSink_t

[Top] [SMTP Functions]

smtpClient_t

Represents the SMTP client.

Syntax

typedef struct smtpClient smtpClient_t;

Description

The client uses this structure to communicate with an SMTP server. The developer uses this structure to perform SMTP API operations. All data contained within the client structure is used internally by the API.

For more information, see Creating a Client.

See Also

smtp_initialize, smtp_free
[Top] [SMTP Structures]

smtpSink_t

Represents the SMTP notification sink.

Syntax

typedef struct smtpSink 
{
   void * pOpaqueData;
   void (*bdat)( smtpSink_t * in_psmtpSink,
         int in_responseCode,
         const char * in_responseMessage );
   void (*connect)( smtpSink_t * in_psmtpSink,
         int in_responseCode,
         const char * in_responseMessage );
   void (*data)( smtpSink_t * in_psmtpSink,
         int in_responseCode,
         const char * in_responseMessage );
   void (*ehlo)( smtpSink_t * in_psmtpSink,
         int in_responseCode,
         const char * in_serverExtension );
   void (*ehloComplete)(smtpSink_t * in_psmtpSink );
   void (*expand)( smtpSink_t * in_psmtpSink,
         int in_responseCode,
         const char * in_emailAddress );
    void (*error)( SMTPSinkPtr_t in_psmtpSink,
         int in_responseCode,
         const char * in_errorMessage );
   void (*expand)( SMTPSinkPtr_t in_psmtpSink,
         int in_responseCode,
         const char * in_emailAddress );
   void (*expandComplete)(smtpSink_t * in_psmtpSink);
   void (*help)( smtpSink_t * in_psmtpSink,
         int in_responseCode,
         const char * in_helpMessage );
   void (*helpComplete)(smtpSink_t * in_psmtpSink );
   void (*mailFrom)( smtpSink_t * in_psmtpSink,
         int in_responseCode,
         const char * in_responseMessage );
   void (*noop)( smtpSink_t * in_psmtpSink,
         int in_responseCode,
         const char * in_responseMessage );
   void (*quit)( smtpSink_t * in_psmtpSink,
         int in_responseCode,
         const char * in_responseMessage );
   void (*rcptTo)( smtpSink_t * in_psmtpSink,
         int in_responseCode,
         const char * in_responseMessage );
   void (*reset)( smtpSink_t * in_psmtpSink,
         int in_responseCode,
         const char * in_responseMessage );
   void (*send)( smtpSink_t * in_psmtpSink,
         int in_responseCode,
         const char * in_responseMessage );
   void (*sendCommand)( smtpSink_t * in_psmtpSink,
         int in_responseCode,
         const char * in_responseMessage );
   void (*sendCommandComplete)(smtpSink_t *
         in_psmtpSink );
   void (*verify)( smtpSink_t * in_psmtpSink,
         int in_responseCode,
         const char * in_responseMessage );
}smtpSink_t;

Fields

The structure has the following fields:
void * pOpaqueData;

User data.

void (*bdat)( 
   SMTPSinkPtr_t in_psmtpSink,
   int in_responseCode,
   const char * in_responseMessage );

Notification for the response to the BDAT command. Parameters: the response sink to use, the SMTP response code, and descriptive response message.

void (*connect)( 
   SMTPSinkPtr_t in_psmtpSink,
   int in_responseCode,
   const char * in_responseMessage );

Notification for the response to the connection to the server. Parameters: the response sink to use, the SMTP response code, and descriptive response message.

void (*data)( 
   SMTPSinkPtr_t in_psmtpSink,
   int in_responseCode,
   const char * in_responseMessage );

Notification for the response to the DATA command. Parameters: the response sink to use, the SMTP response code, and descriptive response message.

void (*ehlo)( 
   SMTPSinkPtr_t in_psmtpSink,
   int in_responseCode,
   const char * in_serverExtension );

Notification for the response to the EHLO command. Parameters: the response sink to use, the SMTP response code, and descriptive response message.

void (*ehloComplete)( 
   SMTPSinkPtr_t in_psmtpSink );

Notification for the completion of the EHLO command. Parameter: response sink to use.

void (*error)( 
   SMTPSinkPtr_t in_psmtpSink,
   int in_responseCode,
   const char * in_errorMessage );

Notification for an error. Parameters: the response sink to use, the SMTP response code, and descriptive response message.

void (*expand)( 
   SMTPSinkPtr_t in_psmtpSink,
   int in_responseCode,
   const char * in_emailAddress );

Notification for the response to the EXPN command. Parameters: the response sink to use, the SMTP response code, and descriptive response message.

void (*expandComplete)( 
   SMTPSinkPtr_t in_psmtpSink);

Notification for the completion of the EXPN command. Parameter: response sink for this client.

void (*help)( 
   SMTPSinkPtr_t in_psmtpSink,
   int in_responseCode,
   const char * in_helpMessage );

Notification for the response to the HELP command. Parameters: the response sink to use, the SMTP response code, and descriptive response message.

void (*helpComplete)( 
   SMTPSinkPtr_t in_psmtpSink );

Notification for the completion of the HELP command. Parameters: the response sink to use.

void (*mailFrom)( 
   SMTPSinkPtr_t in_psmtpSink,
   int in_responseCode,
   const char * in_responseMessage );

Notification for the response to the MAIL FROM command. Parameters: the response sink to use, the SMTP response code, and descriptive response message.

void (*noop)( 
   SMTPSinkPtr_t in_psmtpSink,
   int in_responseCode,
   const char * in_responseMessage );

Notification for the response to the NOOP command. Parameters: the response sink to use, the SMTP response code, and descriptive response message.

void (*quit)( 
   SMTPSinkPtr_t in_psmtpSink,
   int in_responseCode,
   const char * in_responseMessage );

Notification for the response to the QUIT command. Parameters: the response sink to use, the SMTP response code, and descriptive response message.

void (*rcptTo)( 
   SMTPSinkPtr_t in_psmtpSink,
   int in_responseCode,
   const char * in_responseMessage );

Notification for the response to the RCPT TO command. Parameters: the response sink to use, the SMTP response code, and descriptive response message.

void (*reset)( 
   SMTPSinkPtr_t in_psmtpSink,
   int in_responseCode,
   const char * in_responseMessage );

Notification for the response to the RSET command. Parameters: the response sink to use, the SMTP response code, and descriptive response message.

void (*send)( 
   SMTPSinkPtr_t in_psmtpSink,
   int in_responseCode,
   const char * in_responseMessage );

Notification for the response to data sent to the server. Parameters: the response sink to use, the SMTP response code, and descriptive response message.

void (*sendCommand)( 
   SMTPSinkPtr_t in_psmtpSink,
   int in_responseCode,
   const char * in_responseMessage );

Notification for the response to sendCommand function. Parameters: the response sink to use, the SMTP response code, and descriptive response message.

void (*sendCommandComplete) 
   (SMTPSinkPtr_t in_psmtpSink );

Notification for the completion of the extended command. Parameters: the response sink to use.

void (*verify)( 
   SMTPSinkPtr_t in_psmtpSink,
   int in_responseCode,
   const char * in_responseMessage );

Notification for the response to the VRFY command. Parameters: the response sink to use, the SMTP response code, and descriptive response message.

      

Description

The SMTP response sink structure is made up of function pointers and opaque data. You must define the functions yourself, and you must point these pointers to your functions if you want to receive the related server responses. For more information, see SDK Response Sinks for C and Creating a Response Sink.

The function pointers serve as callbacks for many SMTP functions. See SMTP Function Callback Mapping.

See Also

smtp_setResponseSink, smtpSink_initialize,
smtpSink_free
[Top] [SMTP Structures]


Table of Contents | Previous | Next | Index

Last Updated: June 3, 1998

Copyright © 1998 Netscape Communications Corporation