POP3 protocol encapsulation

Source: Internet
Author: User

 

 

Currently, EMAIL is widely used on the Internet. About half of all TCP connection lines are used to send and receive emails. Therefore, it is impossible for many network applications to leave the POP3 protocol.

 

In addition, many EMAIL systems use the SMTP protocol as the sending protocol and POP3 protocol as the receiving protocol. For more information about the two Protocols, see RCF821 (about SMTP) and RCF1225 (about POP3 ). Although in WINDOWS, an MAPI application manages emails, it is not powerful enough to directly process some EMAIL services. Therefore, I wrote a C ++ class about POP3 protocol. In this class, I also used CSocket as a class member (which seems a bit unimaginable, we can use it during connection. In addition, some functions of the POP class are similar to some commands in POP3 protocol. The following code is used:

 

/*--------------------------------------------------------------------

Pop. h: main header file for the POP application

-----------------------------------------------------------------------*/

 

# If! Defined (afx_pop_h1_a44b38b6_697c_11d1_881e_1_1c3025811_included _)

# Define afx_pop_h1_a44b38b6_697c_11d1_881e_1_1c3025811_encoded _

 

# Define CONNECTION_CHECK 0

# Define USER_CHECK1

# Define PASSWORD_CHECK 2

# Define QUIT_CHECK3

# Define DELETE_CHECK 4

# Define RSET_CHECK5

# Define STAT_CHECK6

# Define NOOP_CHECK7

# Define LIST_CHECK8

# Define RETR_CHECK9

 

//////////////////////////////////////// /////////////////////////////////////

Class CPop

{

Public:

 BOOL List ();

 CWordArray m_SizeOfMsg;

 CString GetErrorMessage ();// If there is any error this will return it method

 CString GetPassword ();// Getting Password stored in class

 Void SetPassword (CString & Password );// Setting Password in class

 CString GetUser ();// Getting user name stored in class

 Void SetUser (CString & User );// Setting user name in class

 CString GetHost (); // Getting Host name (email server name) stored in class

 Void SetHost (CString & Host );// Setting Host name (email server name) in class

 BOOL Connect ();// Connecting to email server

 Int GetTotalMailSize ();// It returns the Total Mail Size

 Int GetNumberOfMails ();// It return the number of mails

 CString GetMsgContents ();

 BOOL Statistics ();// Issue the STAT command on email server

 BOOL Retrieve (int MsgNumber ); // Getting any participates mail message

 BOOL Reset ();// Issue the reset command on email server

 IntGetMessageSize (int MsgNumber );// Return a size of any participant mail

 BOOL Noop ();

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.