HOWTO: Customizing the Reply To Property for a Message

Last reviewed: March 19, 1997
Article ID: Q165350
The information in this article applies to:
  • Extended Messaging Application Programming Interface (MAPI), version 1.0

SUMMARY

There may be times when you want to force the reply of a message to a particular person or distribution list. You can accomplish this by using the PR_REPLY_RECIPIENT_NAMES property of the message.

MORE INFORMATION

You can set the PR_REPLY_RECIPIENT_NAMES property by using code. It should be noted that the code sample below is not a complete working program and it assumes that you have a handle to a MAPI session.

  1. Add the PR_REPLY_RECIPIENT_NAMES to the SPropValue array.

         pspvOut[OBSENTREP].ulPropTag = PR_REPLY_RECIPIENT_NAMES;
    

  2. Set the value of the PR_REPLY_RECIPIENT_NAMES property. This property will contain the Display Name of the recipients.

         pspvOut[OBSENTREP].Value.lpszA = "[SMTP:testing@Microsoft.com]";
    

  3. Create an ADRLIST structure containing the address or addresses to reply to.

    NAME, ADDR, EMAIL, RECIP are part of an enum of the recipient properties.

          LPADRLIST  pAdrList = NULL;
          if (FAILED(hRes = MAPIAllocateBuffer(CbNewSRowSet(1),
    
                                              (LPVOID*) &pAdrList)))
              goto Quit;
    
          if (FAILED(hRes = MAPIAllocateBuffer(
                   NUM_RECIP_PROPS * sizeof(SPropValue),
                  (LPVOID*) &(pAdrList->aEntries[0].rgPropVals) )))
              goto Quit;
    
          pAdrList->cEntries = 1;
          pAdrList->aEntries[0].cValues = 4;
          pAdrList->aEntries[0].rgPropVals[NAME].ulPropTag = PR_DISPLAY_NAME;
          pAdrList->aEntries[0].rgPropVals[NAME].Value.lpszA="Test User";
          pAdrList->aEntries[0].rgPropVals[ADDR].ulPropTag = PR_ADDRTYPE;
          pAdrList->aEntries[0].rgPropVals[ADDR].Value.lpszA = "SMTP";
          pAdrList->aEntries[0].rgPropVals[EMAIL].ulPropTag = PR_EMAIL_ADDRESS;
          pAdrList->aEntries[0].rgPropVals[EMAIL].Value.lpszA = "";
          pAdrList->aEntries[0].rgPropVals[RECIP].ulPropTag =
                 PR_RECIPIENT_TYPE;
          pAdrList->aEntries[0].rgPropVals[RECIP].Value.l = MAPI_TO;
    
    

  4. Call ResolveName to get ENTRYIDs for the addresses.

          hRes = m_pAddrBook->ResolveName(NULL,MAPI_DIALOG,
    
                                          "Resolve Names",pAdrList);
    
    

  5. Set the properties of the outbound message.

          if (FAILED(hRes = pMsg ->
    
              SetProps(NUM_OUTBOUND_PROPS,pspvOut,&pPropProblemArray)))
            goto Quit;
    
          hRes = pMsg -> ModifyRecipients(0,pAdrList);
    
    

REFERENCES

Microsoft Developer Network, WIN32 SDK


Keywords : EMAPI kbprg
Version : 1.0
Platform : WINDOWS
Issue type : kbhowto


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 19, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.