Click here to Skip to main content
Click here to Skip to main content

CPopProxyMT - A multi-threaded POP3 proxy skeleton

, 9 Oct 2002 CPOL
Rate this:
Please Sign up or sign in to vote.
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 Smile | :)


  • 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 is a real nice guy who has been writing code since 1990 when he first got his hands on an 8088 with 640 KB RAM. Originally from sunny Trivandrum in India, he has been living in various places over the past few years and often thinks it’s time he settled down somewhere.
Nish has been a Microsoft Visual C++ MVP since October, 2002 - awfully nice of Microsoft, he thinks. He maintains an MVP tips and tricks web site - where you can find a consolidated list of his articles, writings and ideas on VC++, MFC, .NET and C++/CLI. Oh, and you might want to check out his blog on C++/CLI, MFC, .NET and a lot of other stuff -
Nish loves reading Science Fiction, P G Wodehouse and Agatha Christie, and also fancies himself to be a decent writer of sorts. He has authored a romantic comedy Summer Love and Some more Cricket as well as a programming book – Extending MFC applications with the .NET Framework.
Nish's latest book C++/CLI in Action published by Manning Publications is now available for purchase. You can read more about the book on his blog.
Despite his wife's attempts to get him into cooking, his best effort so far has been a badly done omelette. Some day, he hopes to be a good cook, and to cook a tasty dinner for his wife.

Comments and Discussions

GeneralProblem in In/Outgoing mail server setting... PinmemberMember 3798985-Jul-09 2:48 
GeneralProblem in configuring outlook express to proxy server Pinmemberk_swathi14328-Jan-07 20:54 
I configuring proxy servers to Outlook express 6 by changing
tools->mail->properties->server :
incoming mails(pop3) “” to
by doing like this all the mails from starting is getting downloaded (that is all the mail previously downloaded and also new).How to avoid this problem ?
Is there any other way to proxy settings.
QuestionHow to configure outlook express to my proxy server Pinmemberk_swathi14320-Jan-07 0:13 
GeneralThread stopping problem PinmemberHolms12-Mar-04 10:53 
GeneralPlug-in for Outlook Express. Please help....... PinmemberAtif Bashir4-Aug-03 2:38 
GeneralRe: Plug-in for Outlook Express. Please help....... Pinmembertyounsi18-Feb-04 8:50 
Generaldoesn't work at all for me. Pinmemberleemidgley2-Jul-03 10:59 
Questionhow can i browse email as OutLook Pinmemberfhgu14-Jan-03 22:27 
Generali can't compile .... Pinmembercasperx28-Oct-02 16:38 
GeneralRe: i can't compile .... PinsussNish [not logged in]28-Oct-02 18:18 
GeneralRe: i can't compile .... PinsussAnonymous1-Nov-02 13:55 
QuestionIs there another way to proxy? Pinmemberb_p_smith15-Oct-02 5:13 
AnswerRe: Is there another way to proxy? PinmemberPetr Prazak19-Oct-02 5:47 
GeneralRe: Is there another way to proxy? Pinmemberb_p_smith19-Oct-02 10:18 
GeneralRe: Is there another way to proxy? Pinmembertonymudd8-Jan-03 3:48 
GeneralRaw Sockets PinmemberMatthew R. Miller11-Oct-02 5:23 
GeneralVC6 compilation Pinmember__Stephane Rodriguez__10-Oct-02 8:36 
GeneralRe: VC6 compilation PineditorNishant S10-Oct-02 8:47 
GeneralRe: VC6 compilation Pinmember__Stephane Rodriguez__10-Oct-02 22:04 
GeneralRe: VC6 compilation PineditorNishant S10-Oct-02 22:07 
GeneralRe: VC6 compilation PinmemberColin Davies10-Oct-02 19:46 
GeneralRe: VC6 compilation PineditorNishant S10-Oct-02 19:52 
GeneralRe: VC6 compilation PinmemberColin Davies10-Oct-02 21:12 
GeneralRe: VC6 compilation PinmemberSteve S10-Oct-02 23:01 
GeneralRe: VC6 compilation PinmemberAnthony_Yio23-Oct-02 18:37 
GeneralRe: VC6 compilation PineditorNishant S23-Oct-02 18:59 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150327.1 | Last Updated 10 Oct 2002
Article Copyright 2002 by Nish Nishant
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid