Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6141741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:17:30+00:00 2026-05-23T18:17:30+00:00

I’m working with MAPI library in C++ to send emails. Now I need that

  • 0

I’m working with MAPI library in C++ to send emails. Now I need that the emails I send have a reply-to set to more than one email and I just can do it to one email.

I have been reading that to be able to do this I need to work with the objects FLATENTRYLIST (link) and FLATENTRY (link).
My doubt is how can I store more than one FLATENTRY object in the FLATENTRYLIST. My experience in C++ is not very high so if anyone can help me I will apreciate.

Thanks in advance

Paulo

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:17:31+00:00Added an answer on May 23, 2026 at 6:17 pm

    Here is the solution I developed – http://www.codeproject.com/KB/IP/CMapiEx.aspx?msg=3959770#xx3959770xx

    Thanks Dmitry for your help.

    When I was copying the EntryID to the FlatEntry I as copying the wrong bytes number. Here is the final code that works like a charm.

    BOOL CMAPIMessage::SetReplyTo(LPADRLIST lpAddrList)
    {
        HRESULT hRes = S_OK;
        SPropValue pspvReply[1];
        LPFLATENTRYLIST lpEntryList = NULL;
        BOOL bResult = false;
        CString m_strReplyToNames;
    
        int cb = 0; 
        int displayNameTagID = -1;
        int emailTagID = -1;
        int entryIDTagID = -1;
        int cbAllBytes = 0;
    
        //Get all the EntryID's bytes to initalize the FLATENTRYLIST
        for(unsigned j=0; j<lpAddrList->cEntries; j++)
        {
            for (unsigned i = 0; i < lpAddrList->aEntries[j].cValues; i++)
            {
                if (lpAddrList->aEntries[j].rgPropVals[i].ulPropTag == PR_ENTRYID)
                {
                    entryIDTagID = i;
                }
            }
    
            if (entryIDTagID >= 0)
            {
                int feBytes = CbNewFLATENTRY(lpAddrList->aEntries[j].rgPropVals[entryIDTagID].Value.bin.cb);
    
                cbAllBytes += feBytes;
                cbAllBytes += ((feBytes + 4 & ~3) - feBytes);
            }   
        }
    
        //Allocate a new FLATENTRYLIST with all flatentries bytes
        cb = CbNewFLATENTRYLIST(cbAllBytes);
        hRes = MAPIAllocateBuffer(cb, (LPVOID *)&lpEntryList);
        if (FAILED(hRes))
        {
            bResult = false;    
            goto Cleanup;
        }
    
        ZeroMemory((VOID *)lpEntryList, cb);
    
        // Copy the bits of the FLATENTRY into the FLATENTRYLIST.
        lpEntryList->cEntries  = lpAddrList->cEntries;
    
        int countBytesAdded = 0;
    
        for(unsigned j=0; j<lpAddrList->cEntries; j++)
        {
            for (unsigned i = 0; i < lpAddrList->aEntries[j].cValues; i++)
            {
                if (lpAddrList->aEntries[j].rgPropVals[i].ulPropTag == PR_TRANSMITABLE_DISPLAY_NAME)
                {
                    displayNameTagID = i;
                }
                else if (lpAddrList->aEntries[j].rgPropVals[i].ulPropTag == PR_EMAIL_ADDRESS)
                {
                    emailTagID = i;
                }
                else if (lpAddrList->aEntries[j].rgPropVals[i].ulPropTag == PR_ENTRYID)
                {
                    entryIDTagID = i;
                }
            }
    
            if ((emailTagID>=0) && (entryIDTagID>=0))
            {
                CString m_strReplyToName;
                CString m_strReplyToEmail;
    
                m_strReplyToEmail=lpAddrList->aEntries[j].rgPropVals[emailTagID].Value.lpszA;
    
                if(displayNameTagID>=0) 
                    m_strReplyToName=lpAddrList->aEntries[j].rgPropVals[displayNameTagID].Value.lpszA;
                else
                    m_strReplyToName = m_strReplyToEmail;
    
                m_strReplyToNames += (CString)m_strReplyToName + ";";
    
                // Allocate a new FLATENTRY structure for the PR_REPLY_RECIPIENT_ENTRIES property
                LPFLATENTRY lpReplyEntry = NULL;
    
                cb = CbNewFLATENTRY(lpAddrList->aEntries[j].rgPropVals[entryIDTagID].Value.bin.cb);
                hRes = MAPIAllocateBuffer(cb, (LPVOID *)&lpReplyEntry);
                if (FAILED(hRes))
                {
                    bResult = false;    
                    goto Cleanup;
                }
    
                ZeroMemory((VOID *)lpReplyEntry, cb);
    
                // Copy the bits of the entry id into the FLATENTRY structure
                CopyMemory(lpReplyEntry->abEntry, 
                    lpAddrList->aEntries[j].rgPropVals[entryIDTagID].Value.bin.lpb, 
                                    lpAddrList->aEntries[j].rgPropVals[entryIDTagID].Value.bin.cb);
    
                lpReplyEntry->cb = lpAddrList->aEntries[j].rgPropVals[entryIDTagID].Value.bin.cb;
    
                int missingBytes  = 0;
                int feBytes = CbFLATENTRY(lpReplyEntry);
    
                missingBytes = ((feBytes + 4 & ~3) - feBytes);
    
                //Copy each FLATENTRY to the abEntries, next to the previous added bytes
                CopyMemory(lpEntryList->abEntries + countBytesAdded, lpReplyEntry, feBytes);
    
                countBytesAdded += feBytes + missingBytes; 
    
                //Clean Memory
                if (lpReplyEntry) MAPIFreeBuffer(lpReplyEntry);
            }
    
            displayNameTagID = -1;
            emailTagID = -1;
            entryIDTagID = -1;
        }
    
        lpEntryList->cbEntries = countBytesAdded;
    
        pspvReply[0].ulPropTag = PR_REPLY_RECIPIENT_ENTRIES;
    
        // Allocate memory in the lpb to hold the FLATENTRYLIST
        hRes = MAPIAllocateBuffer(CbFLATENTRYLIST(lpEntryList), (LPVOID *)&pspvReply[0].Value.bin.lpb);
        if (FAILED(hRes))
        {
            bResult = false;    
            goto Cleanup;
        }
    
        // Copy the memory into the SPropValue
        CopyMemory(pspvReply[0].Value.bin.lpb,lpEntryList,CbFLATENTRYLIST(lpEntryList));
        pspvReply[0].Value.bin.cb = CbFLATENTRYLIST(lpEntryList);
    
        //Set the PR_REPLY_RECIPIENT_NAMES property with all names
        SetPropertyString(PR_REPLY_RECIPIENT_NAMES, m_strReplyToNames);
    
        // Set the property that contains the FLATENTRYLIST with the reply-to adresses to the message properties
        hRes = Message()->SetProps(1,pspvReply,NULL);
        if (FAILED(hRes))
        {
            bResult = false;    
            goto Cleanup;
        }
    
        bResult = true; 
    
    Cleanup:
        if (lpEntryList) MAPIFreeBuffer(lpEntryList);
    
        return bResult;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
In my XML file chapters tag has more chapter tag.i need to display chapters
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.