tfSmtpUserConnect
Table of Contents >> Optional Protocols >> SMTP
#include <trsocket.h> |
int tfSmtpUserConnect | ( |
ttSmtpClientHandle smtpClientHandle, | |
struct sockaddr_storage * serverAddrPtr, | |
ttUserConstCharPtr userNamePtr, | |
ttUserConstCharPtr passwordPtr | |
); |
Function Description
This function connects the client to the SMTP server.
Parameters
- smtpClientHandle
- The SMTP client session handle as returned by tfSmtpUserNewSession().
- serverAddrPtr
- The address of the SMTP server to connect to.
- userNamePtr
- The username to use if the SMTP server requires authenitcation. Can be NULL if the SMTP server does not require authentication.
- passwordPtr
- The password to use if the SMTP server requires authenitcation. Can be NULL if the SMTP server does not require authentication.
Returns
- TM_ENOERROR
- Success.
- TM_EINVAL
- Invalid SMTP client session handle, server address, or the user supplied a non-zero-length username with a zero-length password.
- TM_EISCONN
- The SMTP session is already connected.
- TM_EINPROGRESS
- The operation is in progress (non-blocking mode only). Call tfSmtpUserExecute() periodically until complete.
- TM_ESERVERPERM
- The server rejected a command with a permanent negative completion reply (5xx status code, see RFC 5321). Usually, this means the username/password combination provided was invalid and the client was unable to connect to the server.
- TM_ESERVERTEMP
- The server rejected a command with a transient negative completion reply (4xx status code, see RFC 5321).
- TM_ESERVERSYNC
- The client and server are out of sync and cannot proceed; the session has been disconnected. This can occur, for example, if the server unexpectedly sends an intermediate reply (3xx status code, see RFC 5321) to a command that requires a completion code.
- TM_ETIMEDOUT
- The Treck SMTP client timed out and disconnected while waiting for a reply from the server. The time limit is set via tfSmtpUserNewSession().
- TM_ESHUTDOWN
- The server closed the connection, unexpectedly.
- other errors