tfSmtpUserNewSession
Table of Contents >> Optional Protocols >> SMTP
| #include <trsocket.h> |
| ttSmtpClientHandle tfSmtpUserNewSession | ( |
| const char * clientHostNamePtr, | |
| ttSmtpCbFuncPtr cbFuncPtr, | |
| int timeout, | |
| int blockingState, | |
| int * errorCodePtr | |
| ); |
Function Description
This function allocates an SMTP session with the user-specified options and returns an SMTP client handle. This handle is passed as the first parameter of every other SMTP API. Upon return, *errorCodePtr contains the error code.
Parameters
- clientHostNamePtr
- The name used to identify ourselves to the SMTP server, this should be the host name of the SMTP client. If NULL, a default name of "Treck" will be used.
- cbFuncPtr
- A pointer to the user-defined ttSmtpCbFunc SMTP callback function.
- timeout
- The timeout value for the session.
- blockingState
- One of the following:
- TM_BLOCKING_ON for blocking mode.
- TM_BLOCKING_OFF for non-blocking mode.
- errorCodePtr
- Upon return, *errorCodePtr contains the error code. See below for possible values.
Returns
- Valid ttSmtpClientHandle
- Success.
- NULL
- Failure. Check *errorCodePtr for more details.
Possible *errorCodePtr Values
- TM_ENOERROR
- Success.
- TM_EINVAL
- One of the following:
- timeout was <= 0.
- blockingState was not TM_BLOCKING_ON or TM_BLOCKING_OFF.
- blockingState was TM_BLOCKING_OFF and cbFuncPtr was NULL.
- TM_ENOBUFS
- Insufficient resources to complete the operation.