Virtual Developer Workshop: Containerized Development with Docker

Environment: Visual C++

This program is very useful when you want to send a message with an attachment if you use Outlook Express like your default program for sending or receiving messages. It is also useful in case of sending your documents from database, because it writes your attachment and puts it in a message.

In the EMail dialog there is the edit multiline control where you can type the text of the attachment. On the Email button you can save this text like a *.txt file and that text file is to be the attachment.

This function is similar to the function CDocument::OnFileSendMail(), except that using my function you may also put a subject and a note text in a message. In general, you can fill the MapiMessage structure as you like.

MapiMessage message;
memset(&message, 0, sizeof(message));
message.nFileCount = 1;
message.lpFiles = &fileDesc;
          "This program send message with *.txt attachment";


Download demo project - 70 Kb


  • How can you attach multi-files at Outlook Express?

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

    Originally posted by: Kit

    How can you attach multi-files at Outlook Express?

    Help me!

  • more information about mail ( smtp, imap, pop, mime)

    Posted by Legacy on 03/18/2002 08:00am

    Originally posted by: anna

    a lot of information are available here :


  • E-Mail

    Posted by Legacy on 01/09/2002 08:00am

    Originally posted by: Maya

    If you save *.txt attachment in other and not in current directory, you get error "Send mail failed to send message".
    The bug is in the line :

    if (file.Open(m_strPathName/*m_strTitle*/, CFile::modeReadWrite | CFile::modeCreate, NULL) == 0) {
    str.Format("Can't Write %s File!", m_strPathName);
    AfxMessageBox(str, MB_ICONEXCLAMATION);

    (m_strPathName instead m_strTitle)

  • You must have javascript enabled in order to post comments.

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

Most Popular Programming Stories

More for Developers

RSS Feeds

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