Click here to Skip to main content
15,349,119 members
Articles / Desktop Programming / MFC
Posted 9 Oct 2002


34 bookmarked

CPopProxyMT - A multi-threaded POP3 proxy skeleton

Rate me:
Please Sign up or sign in to vote.
4.69/5 (12 votes)
9 Oct 2002CPOL1 min read
CPopProxyMT is a skeletal class that wraps a multi-threaded POP3 proxy. You can further modify this class to suite your needs.


CPopProxyMT is a multi-threaded POP3 proxy server class that is a skeleton for you to work on and modify to suite your own purposes. In its bare condition, it is a simple POP3 proxy that can be installed and run on any Windows machine. Obviously some of you might have further uses for it, in which case you can expand on the class - for example you might want to filter out certain mails or you might want to log every mail that's received.

Class structure

class CPopProxyMT
    SOCKET m_PopServerSocket;
    HANDLE m_ServerThread;
    // The thread that listens for connections
    static DWORD ServerThread(DWORD arg);
    int m_port;
    DWORD MServerThread(void); 
    static char* MakeCaps(char* str);
    // This starts the multi-threaded POP proxy server
    int StartProxy(int port); 
    // Flag that's set if the proxy is running
    BOOL bRunning;
    static DWORD ClientThread(DWORD arg); 
    void StartClientThread(SOCKET sock);
    static void StartDataThread(DWORD parm);
    static DWORD DataThread(DWORD parm);
    BOOL IsRunning(void);
    void StopProxy(void);

Sample usage


CPopProxyMT pop_proxy;


    switch (LOWORD(wParam)) 
    case IDOK:
        // This is a sorta toggle button
        // It starts/stops the proxy alternatively
            SetDlgItemText(hwnd,IDC_EDIT1,"POP Proxy stopped");
            SetDlgItemText(hwnd,IDC_EDIT1,"POP Proxy running");
        return TRUE;



  • Multi-threaded (any number of POP clients can connect)
  • No MFC required

POP client configuration

  • POP3 server - This should be the domain name or IP address of your POP3 proxy server
  • Username - This should be the format :- username/POP3 server
  • Password - Your POP3 password

A sample configuration is shown below for Outlook Express 6


Well I wouldn't have written this class if not for Colin Davies who had asked me whether I'd mind writing such a class for him (he is a man with the most amazing ideas and I reckon this one is for one such idea of his). Thanks Colin, this one is for you :-)


  • October 10th 2002 - Although most of the code was written somewhere in mid-2001, this class was written only on 10-10-02


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Nish Nishant
United States United States
Nish Nishant is a Principal Software Architect based out of Columbus, Ohio. He has over 17 years of software industry experience in various roles including Lead Software Architect, Principal Software Engineer, and Product Manager. Nish was a Microsoft Visual C++ MVP between 2002 and 2015.

Nish is an industry acknowledged expert in the Microsoft technology stack. He authored C++/CLI in Action for Manning Publications in 2005, and had previously co-authored Extending MFC Applications with the .NET Framework for Addison Wesley in 2003. In addition, he has over 140 published technology articles on and another 250+ blog articles on his WordPress blog. Nish is vastly experienced in team management, mentoring teams, and directing all stages of software development.

Contact Nish : If you are interested in hiring Nish as a consultant, you can reach him via his google email id voidnish.

Company Website :

Comments and Discussions

GeneralProblem in In/Outgoing mail server setting... Pin
Musthafa (Member 379898)5-Jul-09 1:48
MemberMusthafa (Member 379898)5-Jul-09 1:48 
GeneralProblem in configuring outlook express to proxy server Pin
k_swathi14328-Jan-07 19:54
Memberk_swathi14328-Jan-07 19:54 
QuestionHow to configure outlook express to my proxy server Pin
k_swathi14319-Jan-07 23:13
Memberk_swathi14319-Jan-07 23:13 
GeneralThread stopping problem Pin
Holms12-Mar-04 9:53
professionalHolms12-Mar-04 9:53 
GeneralPlug-in for Outlook Express. Please help....... Pin
Atif Bashir4-Aug-03 1:38
MemberAtif Bashir4-Aug-03 1:38 
GeneralRe: Plug-in for Outlook Express. Please help....... Pin
tyounsi18-Feb-04 7:50
Membertyounsi18-Feb-04 7:50 
Generaldoesn't work at all for me. Pin
leemidgley2-Jul-03 9:59
Memberleemidgley2-Jul-03 9:59 
Questionhow can i browse email as OutLook Pin
fhgu14-Jan-03 21:27
Memberfhgu14-Jan-03 21:27 
Generali can't compile .... Pin
jcdkuo28-Oct-02 15:38
Memberjcdkuo28-Oct-02 15:38 
GeneralRe: i can't compile .... Pin
Nish [not logged in]28-Oct-02 17:18
sussNish [not logged in]28-Oct-02 17:18 
GeneralRe: i can't compile .... Pin
Anonymous1-Nov-02 12:55
MemberAnonymous1-Nov-02 12:55 
QuestionIs there another way to proxy? Pin
b_p_smith15-Oct-02 4:13
Memberb_p_smith15-Oct-02 4:13 
AnswerRe: Is there another way to proxy? Pin
Petr Prazak19-Oct-02 4:47
MemberPetr Prazak19-Oct-02 4:47 
GeneralRe: Is there another way to proxy? Pin
b_p_smith19-Oct-02 9:18
Memberb_p_smith19-Oct-02 9:18 
GeneralRe: Is there another way to proxy? Pin
tonymudd8-Jan-03 2:48
Membertonymudd8-Jan-03 2:48 
GeneralRaw Sockets Pin
Matthew R. Miller11-Oct-02 4:23
MemberMatthew R. Miller11-Oct-02 4:23 
GeneralVC6 compilation Pin
Stephane Rodriguez.10-Oct-02 7:36
MemberStephane Rodriguez.10-Oct-02 7:36 
GeneralRe: VC6 compilation Pin
Nish Nishant10-Oct-02 7:47
sitebuilderNish Nishant10-Oct-02 7:47 
GeneralRe: VC6 compilation Pin
Stephane Rodriguez.10-Oct-02 21:04
MemberStephane Rodriguez.10-Oct-02 21:04 
GeneralRe: VC6 compilation Pin
Nish Nishant10-Oct-02 21:07
sitebuilderNish Nishant10-Oct-02 21:07 
GeneralRe: VC6 compilation Pin
ColinDavies10-Oct-02 18:46
MemberColinDavies10-Oct-02 18:46 
GeneralRe: VC6 compilation Pin
Nish Nishant10-Oct-02 18:52
sitebuilderNish Nishant10-Oct-02 18:52 
GeneralRe: VC6 compilation Pin
ColinDavies10-Oct-02 20:12
MemberColinDavies10-Oct-02 20:12 
GeneralRe: VC6 compilation Pin
Steve S10-Oct-02 22:01
MemberSteve S10-Oct-02 22:01 
GeneralRe: VC6 compilation Pin
Anthony_Yio23-Oct-02 17:37
MemberAnthony_Yio23-Oct-02 17:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.