Question : SMTP CPJNSMTPConnection embed image in email MFC Visual C++ 6.0

Hi Experts,

I'm using PJ Naughter's SMTP connection class (CPJNSMTPConnection) to send emails programmatically.  It's a terrific class but I really need to embed images into the email directly like Outlook Express can do (insert image directly into the body of the email).. Attaching the images is just not sufficient.  Does anyone know of a class like CJ Naughter's class that can embed images that is free or open source?  Or can anyone help me with the implementation of embedding images into CJ Naughter's class?  I think there is a way to do it but I just don't understand MIME types well enough to use his class.... His latest and greatest code can be found here:  www.naughter.com (search for CPJNSMTPConnection)

Thanks for your help with this!

Mike

Answer : SMTP CPJNSMTPConnection embed image in email MFC Visual C++ 6.0

I use PJ Naughter's SMTP, and I have just made a research for your problem.

You should add your image tag using CID:
\"\"

  CString cid, sattach;
  sattach = "image.gif";
  attach->SetFilename(sattach);
  attach->SetContentID("<123456-1>"); // CID you can choose your own
  attach->SetContentType("image/gif");
  emsg->AddBodyPart(*attach);
Random Solutions  
 
programming4us programming4us