HOWTO: Obtaining the SMTP Header for a MAPI Message

Last reviewed: January 6, 1998
Article ID: Q178073
The information in this article applies to:
  • Extended Messaging Application Programming Interface (MAPI), version 1.0

SUMMARY

This article contains a sample function that allows you to access the SMTP header for a message received over the Internet.

MORE INFORMATION

The entire header is stored in the property PR_TRANSPORT_MESSAGE_HEADERS.

   //  GetHeader takes a LPMESSAGE and returns a CString containing
   //  the header for the message.

   CString GetHeader(LPMESSAGE poEnv)
   {
     CString      csHeader;
     HRESULT         hr;
     LPSPropValue   lpProps = NULL;

     // MAPI property creation flags
     const ULONG ulFlags = MAPI_BEST_ACCESS | MAPI_DEFERRED_ERRORS;

     hr = HrGetOneProp(poEnv,PR_TRANSPORT_MESSAGE_HEADERS,&lpProps);
     if (S_OK == hr)
    {
       csHeader = lpProps[0].Value.lpszA;
    }
    return csHeader;
   }


Additional query words: Header Headers smtp
Keywords : kbcode EMAPI XWEB
Version : WINDOWS: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: January 6, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.