Manual Correo Telnet
Transcript of Manual Correo Telnet
-
7/28/2019 Manual Correo Telnet
1/42
RT-IP
1
SMTP/POP3
C
HA
P
T
E
R
1
RTIP SMTP/POP3
SIMPLE MAIL TRANSFER PROTOCOLPOST OFFICE PROTOCOL
CHAPTER ONE
INTRODUCTIONTO SMTP AND POP3
Chapter 1 Table of Contents
Introduction ................................................. 3
Rev. 12/01/1998
-
7/28/2019 Manual Correo Telnet
2/42
RT-IP/POP3 SMTP
2
-
7/28/2019 Manual Correo Telnet
3/42
-
7/28/2019 Manual Correo Telnet
4/42
RT-IP/POP3 SMTP
4
-
7/28/2019 Manual Correo Telnet
5/42
RT-IP
5
SMTP/POP3
C
HA
P
T
E
R
2
Chapter 2 Table of Contents
Configuring SMTP and POP3 ..................... 7
RTIP SMTP/POP3
CHAPTER
TWO
CONFIGURING SMTP AND POP3
-
7/28/2019 Manual Correo Telnet
6/42
RT-IP/POP3 SMTP
6
-
7/28/2019 Manual Correo Telnet
7/42
RT-IP
7
SMTP/POP3
Configuring SMTP and POP
The following defines are set by the makefile:
INCLUDE_RTFS - Specifies that the file system to use to access web pages ondisk should be RTFS.
INCLUDE_DOS_FS - Specifies that the file system to use to access web pages on
disk should be DOS.
The following defines for SMTP and POP are in xnconf.h
CFG_MAIL_TIMEOUT - Timeout in seconds when waiting for a response from server.
CFG_MAX_FROM_LEN - The maximum length of from field in MIME header.
CFG_MAX_SUBJECT_LEN - The maximum length of subject field in MIME header.
Configuring SMTP:
The following defines for SMTP are in xnconf.h
CFG_SMTP_MAX_RCPTS - The maximum # of recipients for a message.
CFG_SMTP_BUF_SIZE - The size of the buffer for server response.
Configuring POP:
The following defines for POP are in xnconf.h
CFG_POP_BUF_SIZE - The size of the buffer for server response.
CFG_POP_MAX_BOUNDARY - The maximum boundary length saved; used to determine end
of message when reading a multi-part mime message.
Configuring SMTP:
Configuring POP:
Configuring SMTP and POP:
-
7/28/2019 Manual Correo Telnet
8/42
RT-IP/POP3 SMTP
8
-
7/28/2019 Manual Correo Telnet
9/42
RT-IP
9
SMTP/POP3
C
HA
P
T
E
R
3
Chapter 3 Table of Contents
Configuring SMTP .................................... 11
RTIP SMTP/POP3
SIMPLE MAIL TRANSFER PROTOCOL
CHAPTER THREE
SMTP INTRODUCTION
-
7/28/2019 Manual Correo Telnet
10/42
RT-IP/POP3 SMTP
10
-
7/28/2019 Manual Correo Telnet
11/42
RT-IP
11
SMTP/POP3
SMTP: Simple Mail Transfer Protocol
Introduction:
The purpose of SMTP is to allow an SMTP client to send an email message to an SMTP server. The
client connects to TCP port 25, the SMTP port, and sends a greeting of the form HELO domain,where domain is the domain name of the client. The server response consists of a result code followed
by any optional text and ending with a pair. The client then uses the MAIL FROM:
command to specify the author of the message, and the RCPT TO: command to specify the recipients.
Note that if the message has multiple recipients, this command may be used more than once for a single
message. The client then sends theDATA command, which informs the server that what follows is the
mail message. The client then sends the message, terminated by .. The QUIT
command is used to close the connection.
A typical SMTP client-server interaction is as follows:
S: < waits for connection on TCP port 25 >. . .
C: < connects to TCP port 25 >
S: < sends optional greeting >
C: HELO linux.etcbin.com
S: 250 OK
C: MAIL FROM: [email protected]
S: 250 OK
C: RCPT TO: [email protected]
S: 250 OK
C: RCPT TO: [email protected]: 250 OK
C: DATA
S: 354 send mail data, end with .
C: < sends the email message with appropriate termination sequence >
S: 250 OK
C: QUIT
S: 221 OK closing connection.
In general, result codes that begin with 2 or 3 are positive, while those that begin with 4 or 5 indicate an error.
Introduction:
-
7/28/2019 Manual Correo Telnet
12/42
RT-IP/POP3 SMTP
12
-
7/28/2019 Manual Correo Telnet
13/42
RT-IP
13
SMTP/POP3
C
HA
P
T
E
R
4
Chapter 4 Table of Contents
xn_smtp ..................................................... 15
RTIP SMTP/POP3
CHAPTER
FOUR
SMTP API
-
7/28/2019 Manual Correo Telnet
14/42
RT-IP/POP3 SMTP
14
-
7/28/2019 Manual Correo Telnet
15/42
RT-IP
15
SMTP/POP3
Function:
xn_smtp() - send mail message through SMTP
Summary:
#include smtp.h
int xn_smtp(info)
PSMTP_INFO info - structure containing mail info
Description:
This function sends an email message using the SMTP protocol. The string char *from will appear
in the From: section of the message. Recipients are not listed by default. To include a list of
recipients at the beginning of a message, simply prepend this list onto the body of the message.
The format of the parameter is:
/* receipient of mail message */
struct rcpt
{
char name[80];
};
/* parameter to xn_smtp */
typedef struct _smtp_info{
byte smtp_server_ip[IP_ALEN]; /* IP address of SMTP server */
char reverse_path[200]; /* domain name of sender */
char from[CFG_MAX_FROM_LEN]; /* email address of author */
char subject[CFG_MAX_SUBJECT_LEN]; /* subject of message */
struct rcpt rcpts[CFG_SMTP_MAX_RCPTS];
/* list of recipients */
PFCHAR body; /* body of message */
/* (set to 0 if body not in a buffer) */
PFCHAR body_file; /* filename for body of message */
/* (set to 0 if body not in a file) */int num_rcpts; /* # of recipients */
PFCHAR attach /* attachment buffer */
/* (set to 0 if no buffer attachment) */
PFCHAR attach_file; /* filename of attachment */
/* (set to 0 if no attachment) */
xn_smtp
-
7/28/2019 Manual Correo Telnet
16/42
RT-IP/POP3 SMTP
16
PFCHAR attach_type /* attachment type (text/plain */
/* application octet-stream, etc.) */
/* Note: any type other than text/plain will be */
/* base64 encoded. */
} smtp_info;
typedef struct _smtp_info KS_FAR *PSMTP_INFO;
Returns:
0 on success, -1 upon failure. If an error occurred, call xn_getlasterror and xn_geterror_string to
return the error value. Appendix B of the RTIP Reference Manual further describes each error.
Possible values for this function are:
ESMTPSERVDOWN - The SMTP Server is not responding
ESMTPBADRESP - The SMTP Server returned error
Example:
See Appendix A
-
7/28/2019 Manual Correo Telnet
17/42
RT-IP
17
SMTP/POP3
C
HA
P
T
E
R
5
Chapter 5 Table of Contents
Introduction ............................................... 19
RTIP SMTP/POP3
CHAPTER
FIVE
POP INTRODUCTION
-
7/28/2019 Manual Correo Telnet
18/42
RT-IP/POP3 SMTP
18
-
7/28/2019 Manual Correo Telnet
19/42
RT-IP
19
SMTP/POP3
POP3 Introduction
The purpose of POP is to allow a client to retrieve email messages from a server. The POP client
establishes a TCP connection to port 110, the POP port, and the POP server sends back a greeting. The
POP Client then sends login information, using the USER and PASS commands. The POP server
responds starting with +OK if the login was valid and -ERR if the login was invalid. The POPClient may then send the STATcommand, in response to which the POP server will send a reply of the
form +OK n m, where n is the number of messages and m is the size of the mail file. The POP Client
may then send theLISTcommand, which lists the size of each mail message individually. Commands
of the form RETR n and DELE n may be used to retrieve and delete messages, respectively, where
n is the number of the message.
A typical dialogue between POP client and server is as follows:
S:
. . .
C: < open connection >S: +OK POP3 Server ready . . .
C: USER johndoe
S: +OK User name ok, enter password:
C: PASS redclover
S: +OK Password accepted.
C: STAT
S: +OK 5 1142
C: LIST
S: +OK Mail listing follows:
S: 1 212S: 2 315
S: 3 100
S: 4 405
S: 5 110
S: .
C: RETR 1
S: +OK 212 octets
S:
C: DELE 1
S: +OK deleting message 1.
C: QUITS: +OK bye
The POP Client uses the QUITcommand to terminate the session.
Another important command available to the POP Client is of the form TOP n, where n is a message
number. The server will send back the header from message n.
Introduction
-
7/28/2019 Manual Correo Telnet
20/42
RT-IP/POP3 SMTP
20
-
7/28/2019 Manual Correo Telnet
21/42
RT-IP
21
SMTP/POP3
C
HA
P
T
E
R
6
Chapter 6 Table of Contents
xn_pop_checkmail..................................... 23
xn_pop_client ............................................ 24
xn_pop_DELE ........................................... 25
xn_pop_mailinfo ....................................... 26
xn_pop_mailsize ........................................ 27
xn_pop_QUIT ........................................... 28
xn_pop_RETR_done ................................. 29
xn_pop_RETR_next .................................. 30
RTIP SMTP/POP3
CHAPTER
SIX
POP3 API
-
7/28/2019 Manual Correo Telnet
22/42
RT-IP/POP3 SMTP
22
-
7/28/2019 Manual Correo Telnet
23/42
RT-IP
23
SMTP/POP3
Function:
xn_pop_checkmail() - returns mailbox info
Summary:
#include pop.h
int xn_pop_checkmail(context, info)
PPOP_CONTEXT context - client context
PPOP_INFO info - structure in which to put mail info
Description:
Once you are connected to a POP server (i.e. once xn_pop_client has been called) you may call
xn_pop_checkmail to obtain the number of messages in the mailbox and the size of the mail file.The function xn_pop_checkmail fills in the fields in an instance ofpop_info, which is declared as
follows:
struct pop_info
{
int num_messages;
long mail_size;
};
typedef struct _pop_info KS_FAR *PPOP_INFO;
The number of the messages will be put into num_messages, and the total size of the mail file will
be put into mail_size.
Returns:
Returns 0 upon success, otherwise -1. If an error occurred, call xn_getlasterror and
xn_geterror_string to return the error value. Appendix B of the RTIP Reference Manual further
describes each error.
Possible values for this function are:
ESRVDOWN - Server not responding
ESRVBADRESP - Server sent invalid response or error.
Example:
See Appendix Axn_pop_checkmail
-
7/28/2019 Manual Correo Telnet
24/42
RT-IP/POP3 SMTP
24
Function:
xn_pop_client() - connects to POP server and checks mail
Summary:
#include pop.h
int xn_pop_client(context, pop_server_ip, username, pass)
PPOP_CONTEXT context - client context
PFBYTE pop_server_ip - servers IP address
PFCHAR username - username to log in to POP server
PFCHAR pass - password to log in to POP server
Description:
This function connects to a POP server and to the server. The function xn_pop_QUIT needs to be
called to close the connection after all the information needed (i.e. all calls to xn_pop_RETR_next,
xn_pop_checkmail, etc.) have been made.
Returns:
Returns 0 upon success, otherwise -1. If an error occurred, call xn_getlasterror and
xn_geterror_string to return the error value. Appendix B of the RTIP Reference Manual further
describes each error.
Possible values for this function are:
ESRVDOWN - Server not responding
ESRVBADRESP - Server sent invalid response or error.
Example:
See Appendix A
xn_pop_client
-
7/28/2019 Manual Correo Telnet
25/42
RT-IP
25
SMTP/POP3
Function:
xn_pop_DELE() - deletes a mail message
Summary:
#include pop.h
int xn_pop_DELE(context, num);
ppop_context context - client context
int num - index of message to delete
Description:
This routine deletes a mail message from the POP server. Each message on the server is identified
with an index. The message whose index is num will be deleted from the server.
Returns:
Returns 0 upon success, otherwise -1. If an error occurred, call xn_getlasterror and
xn_geterror_string to return the error value. Appendix B of the RTIP Reference Manual further
describes each error.
Possible values for this function are:
ESRVDOWN - Server not responding
ESRVBADRESP - Server sent invalid response or error.
Example:
See Appendix A
xn_pop_DELE
-
7/28/2019 Manual Correo Telnet
26/42
RT-IP/POP3 SMTP
26
Function:
xn_pop_mailinfo() - returns mailbox info
Summary:
#include pop.h
int xn_pop_mailinfo(context, info, msg_num)
PPOP_CONTEXT context - client context
PPOP_MSG_INFO info - structure in which to put mail info
int msg_num - message number
Description:
Once you are connected to a POP server (i.e. once xn_pop_client has been called) you may call
xn_pop_mailinfo to obtain the other information about a mail message, i.e. this function fills in the
fields in an instance of struct pop_msg_info. For each message, the senders address and the sub-
ject will be written to the parameter info.
The structure pop_msg_info is declared as follows:
struct pop_msg_info
{
char from[100];
char subject[100];
};
The sender address and subject into from and subject, respectively.
Returns:
Returns 0 upon success, otherwise -1. If an error occurred, call xn_getlasterror and
xn_geterror_string to return the error value. Appendix B of the RTIP Reference Manual further
describes each error.
Possible values for this function are:
ESRVDOWN - Server not responding
ESRVBADRESP - Server sent invalid response or error.
Example:
See Appendix A
xn_pop_mailinfo
-
7/28/2019 Manual Correo Telnet
27/42
RT-IP
27
SMTP/POP3
Function:
xn_pop_mailsize() - returns mailbox info
Summary:
#include pop.h
int xn_pop_mailsize(context, mail_sizes, first_msg, len)
PPOP_CONTEXT context - client context
PFLONG mail_sizes - array to be filled in with mail sizes
int first_msg - first mail message to get mail sizes for
int num_msgs - size of mail_sizes
Description:
Once you are connected to a POP server (i.e. once xn_pop_client has been called) you may call
xn_pop_mailsize to obtain the sizes of the mail messages.
The sizes of messages first_msg through (num_msgs-first_msg) are obtained. The sizes obtained
are written to the array mail_sizes. For each message, the message size will be put at the index
(message number - first_msg), i.e. the size of mail message first_msg is written at offset 0, the size
of the first_msg+1 is written at offset 1, etc. Any unsued entries in mail_sizes are set to -1.
Returns:
Returns 0 upon success, otherwise -1. If an error occurred, call xn_getlasterror and
xn_geterror_string to return the error value. Appendix B of the RTIP Reference Manual further
describes each error.
Possible values for this function are:
ESRVDOWN - Server not responding
ESRVBADRESP - Server sent invalid response or error.
Example:
See Appendix A
xn_pop_mailsize
-
7/28/2019 Manual Correo Telnet
28/42
RT-IP/POP3 SMTP
28
Function:
xn_pop_QUIT() - logs out of POP server and closes connection
Summary:
int xn_pop_QUIT(context)
PPOP_CONTEXT context - client context
Description:
This routine logs out of the POP server that was connected to via xn_pop_client and closes the
connection. This routine should be called at the end of any POP client application.
Returns:
Returns 0 upon success, otherwise -1. If an error occurred, call xn_getlasterror and
xn_geterror_string to return the error value. Appendix B of the RTIP Reference Manual further
describes each error.
Possible values for this function are:
ESRVDOWN - Server not responding
Example:
See Appendix A
xn_pop_QUIT
-
7/28/2019 Manual Correo Telnet
29/42
RT-IP
29
SMTP/POP3
Function:
xn_pop_RETR_done() - cleans up after calls to xn_pop_RETR_next
Summary:
#include pop.h
int xn_pop_RETR_done(context)
PPOP_CONTEXT context - client context
Description:
This routine should be called after all calls to xn_pop_RETR_next to retrieve a mail message have
been done. It reads any residue data from the socket and sets the context to the proper state for
reading another mail message.
Returns:
Returns 0 upon success, otherwise -1. If an error occurred, call xn_getlasterror and
xn_geterror_string to return the error value. Appendix B of the RTIP Reference Manual further
describes each error.
Possible values for this function are:
ESRVDOWN - Server not responding
Example:
See Appendix A
xn_pop_RETR_done
-
7/28/2019 Manual Correo Telnet
30/42
RT-IP/POP3 SMTP
30
Function:
xn_pop_RETR_next() - retrieves next part of message from POP server
Summary:
#include pop.h
int xn_pop_RETR_next(context, num, parse_info)
PPOP_CONTEXT context - client context
int num - number of mail message to retrieve
PMIME_PARSE_INFO parse_info - results are written to this structure
Description:
This function retrieves the next field of a mail message where the possible fields are a MAILheader field, a MIME header field, as much data of MAIL or ATTACHMENT message as can fit
in context->pop_buffer (or up to a \r\n). The results of the field read are put in parse_info,
i.e. the type of field read is put in parse_info->mime_type and a pointer to the body of the
field is written to parse_info->mime_field_ptr. The length of the body of the field is written
to parse_info->mime_field_len.
NOTE: the same context structure must be passed between calls to this function
NOTE: call ing this routine overwrites data in context->pop_buffer (i .e parse_info-
>mime_field_ptr is set to the start of the body in context->pop_buffer), therefore, any data in the
buffer from the previous call must be processed before calling this routine.
The format of parse_info structure is:
typedef struct _mime_parse_info
{
int mime_type; /* mime type - see below*/
PFCHAR mime_field_ptr; /* pointer to body of mime field*/
int mime_field_len; /* length of body of the mime field*/
} mime_parse_info;
typedef struct _mime_parse_info KS_FAR *PMIME_PARSE_INFO;
The support mime types include:
MIME_RETURN_PATH
MIME_RECEIVED
MIME_DATE
MIME_FROM
MIME_MESSAGE_ID
MIME_SUBJECT xn_pop_RETR_next
-
7/28/2019 Manual Correo Telnet
31/42
RT-IP
31
SMTP/POP3
MIME_VERSION
MIME_CONTENT_TYPE
MIME_STATUS
MIME_CONTENT_ENCODE
MIME_CONTENT_DISP
MAILATTACH
Returns:
Returns 0 upon success, otherwise -1. If an error occurred, call xn_getlasterror and
xn_geterror_string to return the error value. Appendix B of the RTIP Reference Manual further
describes each error.
Possible values for this function are:
ESRVDOWN - Server not responding
ESRVBADRESP - Server sent invalid response or error.
-
7/28/2019 Manual Correo Telnet
32/42
RT-IP/POP3 SMTP
32
-
7/28/2019 Manual Correo Telnet
33/42
RT-IP
33
SMTP/POP3
A
P
P
E
N
D
I
X
A
APPENDIX A
EXAMPLES
Chapter 1 Table of Contents
SMTP examples ......................................... 35
POP3 example ........................................... 38
POP3 example ........................................... 40
POP3 example ........................................... 41
-
7/28/2019 Manual Correo Telnet
34/42
RT-IP/POP3 SMTP
34
-
7/28/2019 Manual Correo Telnet
35/42
RT-IP
35
SMTP/POP3
/* ************************************************************* */
/* SMTP EXAMPLE */
/* */
/* Description: */
/* This examples demonstrate sending mail messages. */
/* *//* NOTE: there is an interactive example in smtpcli.c in the apps directory */
/* */
/* */
/* This example demonstrates the following: */
/* - Calling xn_smtp to send a mail message */
/* */
/* */
#define SMTP_BUF_SIZE 2000
struct _smtp_infoKS_FAR smtp_param;
char KS_FAR body_buffer[SMTP_BUF_SIZE];
char KS_FAR body_file[80];char KS_FAR attach_file[80];
/* send a mail message to 1 receipients from a buffer without an attachment */
void smtp_send_mail(void)
{
/* initialize parameter to xn_smtp */
smtp_param.attach_file = (PFCHAR)0;
smtp_param.body_file = (PFCHAR)0;
smtp_param.body = body_buffer;
tc_strcpy(smtp_param.reverse_path, [email protected]);
/* set up to send the mail message to paul */
smtp_param.num_rcpts = 1;
tc_strcpy(smtp_param.rcpts[0].name, [email protected]);
/* set up the subject field */
tc_strcpy(smtp_param.subject, test);
/* set up the message */
tc_strcpy(smtp_param.body, this is a test message);
/* send the message */
if (xn_smtp(&smtp_param) < 0)
{
printf(Call to xn_smtp failed);
}
}
SMTP EXAMPLE
-
7/28/2019 Manual Correo Telnet
36/42
RT-IP/POP3 SMTP
36
/* send a mail message to 1 receipients from a file without an attachment */
void smtp_send_mail(void)
{
/* initialize parameter to xn_smtp */
smtp_param.attach_file = (PFCHAR)0;
smtp_param.body_file = body_file;smtp_param.body = (PFCHAR)0;
tc_strcpy(smtp_param.reverse_path, [email protected]);
/* set up to send the mail message to paul and mary */
smtp_param.num_rcpts = 1;
tc_strcpy(smtp_param.rcpts[1].name, [email protected]);
/* set up the subject field */
tc_strcpy(smtp_param.subject, test);
/* set up the message */tc_strcpy(smtp_param.body_file, mail1.txt);
/* send the message */
if (xn_smtp(&smtp_param) < 0)
{
printf(Call to xn_smtp failed);
}
}
/* send a mail message to 2 receipients from a buffer with one attachment */
void smtp_send_mail(void)
{
/* initialize parameter to xn_smtp */
smtp_param.attach_file = attach_file;
smtp_param.body_file = (PFCHAR)0;
smtp_param.body = body_buffer;
smtp_param.body[0] = \0;
tc_strcpy(smtp_param.reverse_path, [email protected]);
/* set up to send the mail message to paul and mary */smtp_param.num_rcpts = 2;
tc_strcpy(smtp_param.rcpts[0].name, [email protected]);
tc_strcpy(smtp_param.rcpts[1].name, [email protected]);
/* set up the subject field */
tc_strcpy(smtp_param.subject, test);
/* set up the message */
-
7/28/2019 Manual Correo Telnet
37/42
RT-IP
37
SMTP/POP3
tc_strcpy(smtp_param.body, this is a test message);
/* set up to send an attachment (attachments are always files) */
tc_strcpy(smtp_param.attach_file, attach1.txt);
/* send the message */if (xn_smtp(&smtp_param) < 0)
{
printf(Call to xn_smtp failed);
}
}
-
7/28/2019 Manual Correo Telnet
38/42
RT-IP/POP3 SMTP
38
POP3 EXAMPLE
/* ************************************************************* */
/* POP3 EXAMPLE */
/* */
/* Description: */
/* This examples demonstrate displaying available mail messages. */
/* *//* This example demonstrates the following: */
/* - Calling xn_pop_client to connect to server */
/* - Calling xn_pop_checkmail to get the number of mail messages */
/* - Calling xn_pop_mailsize to get the sizes of all all mail messages */
/* - Calling xn_pop_mailinfo to get information on each mail message */
/* - Calling xn_pop_quit to terminate the connection */
/* */
/* */
/* */
/* Parameters: */
/* pop_srv_ip_addr - POP servers IP address *//* username - username for use in logging on to pop server */
/* password - password for use in logging on to pop server */
/*
#define NUM_MAIL_MSGS 10
struct _pop_msg_size mail sizes[MAIL_BUF_SIZE];
void pop_display_mail(PFBYTE pop_srv_ip_addr, PFCHAR username, PFCHAR password)
{
struct _pop_context context;
struct _pop_msg_info msg;PPOP_MSG_SIZE mail_sizes;
int mail_num;
int first_msg;
int n;
int msg_left;
int max_msgs;
/* connect to the POP3 Server */
if (xn_pop_client((PPOP_CONTEXT)&context, pop_srv_ip_addr, username, password) == -1)
{
printf(xn_pop_client failed.),return(-1);
}
/* get number of messages available */
if (xn_pop_checkmail(context, info) < 0)
{
printf(xn_pop_checkmail failed),
return;
}
-
7/28/2019 Manual Correo Telnet
39/42
RT-IP
39
SMTP/POP3
printf(You have %d messages\n, info->num_messages);
if (info->num_messages == 0)
return;
max_msgs = MAX_MAIL_MSGS;
if (info -> num_messages < MAX_MAIL_MSGS)max_msg = info -> num_messages;
msg_left = info -> num_messages;
while (msg_left > 0)
{
if (max_msg > msg_left)
max_msg = msg_left;
/* get mail sizes for current set of mail messages */
if (xn_pop_mailsize(context, mail_sizes, first_msg, max_msg))
{
printf(xn_pop_mailsize failed);return;
}
printf(# size sender subject);
for (n = 0; n
-
7/28/2019 Manual Correo Telnet
40/42
RT-IP/POP3 SMTP
40
POP3 EXAMPLE
/* ************************************************************* *//* POP3 EXAMPLE *//* *//* Description: *//* This examples demonstrate retrieving a mail message. *//* *//* NOTE: there is an interactive example in popcli.c in the apps directory *//* *//* *//* This example demonstrates the following: *//* - Calling xn_pop_client to connect to server */ /* - Calling xn_pop_RETR_next to retrieve field of mail message */ /* - Calling xn_pop_RETR_done to finish the retrieve */ /* - Calling xn_pop_quit to terminate the connection */ /* *//* *//* */
/* Parameters:/* pop_srv_ip_addr - POP servers IP address/* msg_num - message number to retrieve/* username - username for use in logging on to pop server/* password - password for use in logging on to pop server/*
void pop_display_mail(PFBYTE pop_srv_ip_addr, int msg_num,PFCHAR username, PFCHAR password)
{struct _pop_context context;mime_parse_info parse_info;
if (xn_pop_client((PPOP_CONTEXT)&context, pop_srv_ip_addr, username, password) == -1){
printf(xn_pop_client failed.);return;
}
while ( (xn_pop_RETR_next((PPOP_CONTEXT)&context, msg_num,(PMIME_PARSE_INFO)&parse_info) != -1))
{printf(%s: %s, mime_headers[mime_type].mime_header,
parse_info.mime_field_ptr);}xn_pop_RETR_done((PPOP_CONTEXT)&context);
if (xn_pop_QUIT((PPOP_CONTEXT)&context) == -1){
printf(xn_pop_QUIT failed.);return;
}}
-
7/28/2019 Manual Correo Telnet
41/42
RT-IP
41
SMTP/POP3
/* ************************************************************* *//* POP3 EXAMPLE *//* *//* Description: *//* This examples demonstrate deleting a mail message. *//* *//* NOTE: there is an interactive example in popcli.c in the apps directory *//* *//* *//* This example demonstrates the following: *//* - Calling xn_pop_client to connect to server */ /* - Calling xn_pop_DELE_next to delete a mail message */ /* - Calling xn_pop_quit to terminate the connection */ /* *//* *//* *//* Parameters: */
/* pop_srv_ip_addr - POP servers IP address *//* msg_num - message number to retrieve *//* username - username for use in logging on to pop server *//* password - password for use in logging on to pop server *//* */
void pop_display_mail(PFBYTE pop_srv_ip_addr, int msg_num,PFCHAR username, PFCHAR password)
{struct _pop_context context;
if (xn_pop_client((PPOP_CONTEXT)&context, pop_srv_ip_addr, username, password) == -1){
printf(xn_pop_client failed.);return;
}
if (xn_pop_DELE(PPOP_CONTEXT)&context,msg_num)
-
7/28/2019 Manual Correo Telnet
42/42
RT-IP/POP3 SMTP