Update SMTP class part II

Environment: Windows NT 4.0 with sp3, VC6.0

I've previously sent a article about Wes Clyburn's SMTP class. But I forgot to place the files TextPlain.cpp and TextPlain.h. Also, some people asked for a demo, so here you are.

The demo project is very easy to look. Go directly to the function - void CEMailDlg::OnButtonSend() - to see everything needed to understand how the class work. The project have been built with Windows NT 4.0 with sp3 and VC6.0. Even if you don't have this version it should also work. I've also added a makefile with everything needed to start a new project for those who don't have the Visual C++ 6.0.

The demo's code have been done really rapidly, I do not intent that's good programmation ;-)

Download demo project - 76KB

Download source - 18KB


  • some file attachements work, some do not ...

    Posted by qadddd on 11/14/2005 07:45am

    Hello, Thanks for these classes very usefull for me. But I have 3 problems : - more and more we have to give a user and password to log on smtp server, how can it be handled in these classes - mails arriving in my mailbax do not display date and time ? something missing in smtp exchange to handle this ? - my biggest problem : I send a mail with a files attached. But depending the file I attached, mail arriving in my mailbox still have the file or do not have it anymore. I follow the code till the send of body part, file is MIME encoded and sent but I don't retrieve it in the mailbox. It doesn't appear to be a random problem because when I use file "a.txt" it always works, and when I use file "b.txt" it always misses ... I try to simplify the maximum "b.txt" (it contains a simple line of usual characters) but I never succeed in retrieving it in the mail received in mail box. The mail itself is always present, only the file is missing . Any suggestion for debugging or solution will be appreciated Brgds DD

  • Embedded types other than TEXT_PLAIN

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

    Originally posted by: Robert Dunn

    These classes are excellent and I have enjoyed learning form these examples however, I cannot seem to get my own agent to work in the way that I want. I can use the existing classes to attach an rtf document to an email but what I really want is to embed enriched text directly into the e-mail message body.
    To that end I wrote an agent for TEXT_ENRICHED, defined that eMIMETypeCode, and kind of jammed together the AddMIMEPart member functions of CAppOctetStream and CTextPlain to get CTextEnriched::AddMIMEPart which handles encoding. Is this on the right track? No matter what I do the .rtf shows up as an attachment and never is expanded into the message body as desired.
    Anyone have constructive comments?

  • How to use CBase64

    Posted by Legacy on 04/08/2002 12:00am

    Originally posted by: Maya

    I successfully used CBase64::Encode to convert binary data to base64.
    But now I need the opposite toconvert base64 to binary.

    Is it possible this to be done with CBase64::Decode
    and how???

    Any examples?????


  • while did i always get "553 host deny relay" message!!!!!!!!!!!!

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

    Originally posted by: zhangguoping

    during sending mail, i always got this message.
    only one email address is ok, others all got this
    message. why!!!!!!!!!!!!!

  • Using this source on PocketPC

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

    Originally posted by: Assaf

    I try using this code (with several changes, mostly because of the unicode) on PocketPC, and encounter a problem with the Receive() from the socket after the HELO is sent.
    The Send() ends well (I check its return value in order to be sure), but then the Receive() gets stuck, and the application hangs.

    Did it happen to anyone on PC ? does anyone have any idea how to solve it ?

  • Problems with the "From" tag

    Posted by Legacy on 12/02/2001 12:00am

    Originally posted by: Birgit Ruhe

    I want to use this class to send mails to a domain registration robot. Therefore i have to fill the from field with a string like "userID"<customer@sample.com>. If I try so, I always get the following error: "503:Server not ready for data". What do I do wrong?

  • Forget to Unlock the critical section

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

    Originally posted by: Mustafa Demirhan


    You call m_csAccess.Lock(); but you never call m_csAccess.Unlock();

    This fails in a multi-threaded application

  • What about receiving mails??

    Posted by Legacy on 01/25/2001 12:00am

    Originally posted by: Paras Shah

    Hi there,

    I use ur demo for seinding mails and it works nice. But i want to receive the mails in the same manner. Is there any way to do it? if u have some demo or source than pls send me.

    thanks in advance.

  • small bug

    Posted by Legacy on 11/09/2000 12:00am

    Originally posted by: Anton

    this library does not send correctly a file if 
    its name has a space in it.
    here is how i fixed it:

    in AppOctetStream.cpp find

    sTemp.Format(_T( "Content-Disposition: attachment; filename=%s%s\r\n" ),szFName, szExt );

    change it to:

    sTemp.Format(_T( "Content-Disposition: attachment; filename=\"%s%s\"\r\n"),szFName, szExt );

  • I found a solution to solve the problems with some SMTP servers !!

    Posted by Legacy on 09/30/2000 12:00am

    Originally posted by: MiniCooler

    See at http://codeguru.earthweb.com/internet/SMTP_POP3.shtml

  • Loading, Please Wait ...

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

Top White Papers and Webcasts

  • Download the Information Governance Survey Benchmark Report to gain insights that can help you further establish business value in your Records and Information Management (RIM) program and across your entire organization. Discover how your peers in the industry are dealing with this evolving information lifecycle management environment and uncover key insights such as: 87% of organizations surveyed have a RIM program in place 8% measure compliance 64% cannot get employees to "let go" of information for …

  • The impact of a data loss event can be significant. Real-time data is essential to remaining competitive. Many companies can no longer afford to rely on a truck arriving each day to take backup tapes offsite. For most companies, a cloud backup and recovery solution will eliminate, or significantly reduce, IT resources related to the mundane task of backup and allow your resources to be redeployed to more strategic projects. The cloud - can now be comfortable for you – with 100% recovery from anywhere all …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds