Updated SMTP Class

I was really happy to see thoses class for smtp's transactions. One thing I didn't have in my own smtp object was the file transfert with MIME specifications. The only thing the Wes Clyburn's class missed is the use of CC ad BCC. Since it's more easy to add those things than adding the file transfer functionality to my own class, I decided to take the Wes Clyburn object and modified it.

These modifications have been done to enhance the real good object CMailMessage, with the functionnality of CC and BCC copy and in the context of keeping the same public interface.

All new parameters are only optionnal. Still thanks to Wes Clyburn.

How to use ?

Still the same function, but with optional arguments that will change the recipients list. You have three kinf of recipients.

	CMailMessage::TO (the default one)   
	CMailMessage::CC   
	CMailMessage::BCC

	//*** Example..CMIMEMessage msg;
	msg.AddMultipleRecipients( "banana@culture.com" );
	msg.AddMultipleRecipients( "president.of.banana@culture.com,CMailMessage::CC );
	msg.AddMultipleRecipients( "secret@banana.eater", CMailMessage::BCC );

	...

The reste remains the same.. Voila !!!

Download source - 16KB



Comments

  • TextPlain is not included

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

    Originally posted by: rstone

    hi!

    TextPlain file is not included.

    Reply
  • For those you are looking for the CTextPlain...

    Posted by Legacy on 05/18/1999 12:00am

    Originally posted by: Jean-Francois Ouellet

    Go to the internet section.. and just after the UPDATE SMTP Class, you will have UPDATE SMTP class part II

    Every files are there ;)

    Reply
  • Where is the CTextPlain class?

    Posted by Legacy on 05/18/1999 12:00am

    Originally posted by: David Jarvis

    Could you please add the CTextPlain source to the download, or send it to me?

    Reply
  • CMIMEMessage doesn't work - CTextPlain not found...

    Posted by Legacy on 02/15/1999 12:00am

    Originally posted by: johnny p.

    Hi,
    
    

    Nice explanation. Really appreciate the code. However, class
    CMIMEMessage creates objects of type CTextPlain which wasn't
    included in the downloaded demo. Can you update the zip file
    with this class or send a copy of this class to me?

    Thanks so much,

    johnny p.

    Reply
  • Modification for NT

    Posted by Legacy on 12/20/1998 12:00am

    Originally posted by: Christian Trillo

    I had a little trouble by compiling it with UNICODE. If you're not familiar with it, don't worry, there is a function that helps.
    To compile the code both for ANSI and UNICODE you could use macros for the preprocessor and deppending on them the code would compile cleanly for any version.

    So, In this case we want to use a raw CAsyncSocket::Send function. we simply have to declare a char buffer and use conditional compilation as follows:

    char myHugeBuffer[2048];
    ...
    #ifdef _UNICODE
    WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)sFrom, -1, myHugeBuffer, 2048, NULL, NULL);
    #endif
    m_wsSMTPServer.Send(myHugeBuffer, sFrom.GetLength());

    Is just one step more and we are done. We could also have used a generic buffer (m_buffer) for efficency or dynamic memory allocation.

    suggestion: for further improvement is recommended to use threads :)


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

Top White Papers and Webcasts

  • 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 …

  • Live Event Date: May 6, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT While you likely have very good reasons for remaining on WinXP after end of support -- an estimated 20-30% of worldwide devices still are -- the bottom line is your security risk is now significant. In the absence of security patches, attackers will certainly turn their attention to this new opportunity. Join Lumension Vice President Paul Zimski in this one-hour webcast to discuss risk and, more importantly, 5 pragmatic risk mitigation techniques …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds