SMTP/POP3 MFC classes

Wes Clyburn already wrote an SMTP class that sent mails which were stored in CMailMessage entities. Look at his entry on the Codeguru site for details.

I took these classes and added a POP3 class, based on Wes' CSMTP class. For this, I slightly modified CMailMessage and CSMTP.

Now you can create a message in a CMailMessage class, send it using Wes' CSMTP. Or you can retrieve mails using my CPOP3 class, which stores the mails in a CMailMessage object.

However, I still had some troubles parsing the headers of retrieved mails:
  1. The Cc: field can contain several lines. CPOP3 only parses the first one.
      Cc: recipient1 
    In this case, CPOP3 only finds "recipient1".

  2. The Date: field isn't parsed at all - there are different possible date formats.

Maybe I'll add those features later ? Thanks, Wes, for the good base you provided !

Download source/demo project - 19 KB


  • SMTP/POP3 using C++

    Posted by Legacy on 11/29/2003 12:00am

    Originally posted by: Vishnu

    can i get open source code for POP3/SMTP servers which works on linux platform.

  • Transmitter is always "<somebody>"

    Posted by Legacy on 07/22/2003 12:00am

    Originally posted by: Andreas Wortmann


    thanks for these nice classes :)
    Due to the fact that I'm totally new to using sockets in
    vc++, I've got ne clue why the above mentioned happens every
    time I send an email.
    No matter which smtp server I'm using, the sender ist always
    <somebody> (currently I'm using and Strato for testing purposes). Is there any way I can
    change this?

    Andreas Wortmann

  • any help on pop3 server

    Posted by Legacy on 03/08/2003 12:00am

    Originally posted by: sharon james

    as i'm a beginner in vc++ programming ...
    i'd be grateful if anyone can tell me what r the initial
    steps i should follow to develop a pop3 server.
    it'll be useful ..if i can get some immediate responses.
    thank you.

  • How to use "AUTH" command in SMTP

    Posted by Legacy on 03/04/2003 12:00am

    Originally posted by: Teron

    My mail server needs to authentication. How insert it into Code

    "MAIL FROM:<>\r\n",
    "RCPT TO:<>\r\n",

  • Memory Leak.

    Posted by Legacy on 09/02/2002 12:00am

    Originally posted by: John Tullos

    The CPOP3 class has a memory leak that starts with Connect(), I havn't tracked it down to the exact problem, but the class is leaking memory every time it connects and checks for e-mail. Doesn't anyone bother checking for this these days? Suppose someone ran this class all day for 7 days, thats just hopeless, CRRAASSHHH. Nice job with the class, just you forgot to check for leaks :-)

    P.S. Now im stuck to finding ur leak :-(

    • Leak

      Posted by Geno Carman on 12/15/2004 08:22pm

      I have been using this class for a while and never detected a leak.

  • Parsing downloaded mails using VB

    Posted by Legacy on 07/05/2002 12:00am

    Originally posted by: C.V.Kishore Kumar

    Is there any standard APIs to split the downloaded mail content(ie., attachment,mail body etc.),or is there any standards to to parse mails of any server.pls advice me.

    C.V.Kishore Kumar

  • SMTP works but POP3 doesn't

    Posted by Legacy on 01/11/2002 12:00am

    Originally posted by: Lizhongxian

    CSMTP class sounds OK. But when I use CPop3,it return me with msg "bad username", why?
    Anyone can help me?

  • i can't send mail using stmp or receive any mails using pop3!

    Posted by Legacy on 09/10/2001 12:00am

    Originally posted by: helenwh

    when sending, the error is :"503, SMTP server not ready for data"; but i can send mail to the one with the same LAN with me.
    when receiving, the error is: "RETReive failed".
    thank u for your help!!!
    best regards!

  • Help needed on : if( !get_response( IDENTIFICATION ) )

    Posted by Legacy on 07/18/2001 12:00am

    Originally posted by: Steven


    Everything seems to work just fine until I reach
    if( !get_response( IDENTIFICATION ) )
    This reacts very slowly on different servers, but is not giving any errors.
    Did anybody improve this program or used it in any way ?
    It seems to be quite difficult to find information on the subject...
    Any help is welcome.


  • I can't view mail recv message

    Posted by Legacy on 06/27/2001 12:00am

    Originally posted by: kom

    I can not view mail so recv message.

  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • U.S. companies are desperately trying to recruit and hire skilled software engineers and developers, but there's simply not enough quality talent to go around. In response, companies often resort to inferior solutions -- hiring substandard developers and engineers, recruiting talent on a part-time or temporary basis, poaching people from competitors, or burdening an already stressed IT staff for more of their labor. Fortunately, there's a better solution. Read this white paper to learn the business value of …

  • Moving from an on-premises environment to Office 365 does not remove the need to plan for disruptions or reduce the business risk requirements for protecting email services. If anything, some risks increase with a move to the cloud. Read how to ease the transition every business faces if considering or already migrating to cloud email. This white paper discusses: Setting expectations when migrating to Office 365 Understanding the implications of relying solely on Exchange Online security Necessary archiving …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date