EMAIL_POP_OPEN Function
Syntax
Arguments
- pSocketPointer
A pointer variable that is populated by this function with the following child variables:
- bufferCharacter
The text of the last communication with the mail server. It is mostly used if an error occurs. If there is an error, buffer will contain the text of the error.
- nMessagesNumeric
The number of messages stored on the server
- nTotalBytesNumeric
The total number of bytes stored in messages on the server.
- sPointer
An open socket to the server.
- pop_serverCharacter
The hostname of the POP3 server.
- usernameCharacter
The user's logon.
- passwordCharacter
The user's password.
- portNumeric
Default = 110. The TCP port used for the connection.
- modeCharacter
Default = "". The mode used for the connection, e.g. "SSL".
Returns
- Result_FlagLogical
.T. = Login was successful, .F. = Login was not successful. If the login fails, pSocket.buffer will contain an error message with more information.
Description
The EMAIL_POP_OPEN() function opens a connection to a POP3 server and logs in.
Example 1
The following example shows a successful logon to mail.mycompany.com. pSocket is a dot variable with four child variables: buffer, nMessages, nTotalBytes, and s. Buffer contains the text of the last communication with the mail server (in this case, "+OK 5 7091429") and is mostly used if an error occurs. If there is an error, buffer will contain the text of the error (as in the next example). nMessages is the number of messages stored on the server. nTotalBytes is the total number of bytes stored in messages on the server. S is an open socket to the server. It is created with SOCKETS.OPEN().
dim pSocket as P ? email_pop_open(pSocket, "mail.mycompany.com", "john_doe", "sneaky") = .T. ? pSocket = buffer = +OK 5 7091429 nMessages = 5.000000 nTotalBytes = 7091429.000000 +s.
Example 2
Example 2 shows an error condition. EMAIL_POP_OPEN() returns .F. and pSocket.buffer contains an error message.
? email_pop_open(pSocket, "mail.mycompany.com", "john_doe", "sneaky") = .F. ? pSocket = buffer = -ERR User testmailer already logged on. nMessages = 0.000000 nTotalBytes = 0.000000 +s.
See Also