none
Receive email mail item. RRS feed

  • Question

  • I am writing a program in C++ MFC to capture an event of email received and sent out of outlook. I have managed to get the outgoing email event and get the mail item and extract all the data i need (sender,receiver,body and attachment) .

    But i cant seem to do the same with receive mail. Is it because when outlook recieive an email it only gets the header first and downloads the mail later?

    Is there any way i can get the mailitem and info of a received email

    ******************************************************************************/ 
    STDMETHODIMP CAppEventListener::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
                                      WORD wFlags, DISPPARAMS* pDispParams,
                                      VARIANT* pVarResult, EXCEPINFO* pExcepInfo,
                                      UINT* puArgErr)
    {
    	CString szText;
    
    	szText.Format( L"DISP_ID: %x\n", dispIdMember );
    	OutputDebugString( szText );
    
    	switch(dispIdMember)
    	{
    		case 0x0000f002: //send mail NewMail()
    			if(pDispParams->cArgs !=2)
    				return E_INVALIDARG;
    			else
    			{
    				HandleNewMail(pDispParams->rgvarg[1].pdispVal, 
    				(VARIANT_BOOL*) pDispParams->rgvarg[0].pboolVal);	 
    				
    				//Mail.ReleaseDispatch();
    				break;
    				
    			}
    		case 0x0000fab5:		// NewMail()
    			if(pDispParams->cArgs !=0)
    			{
    				return E_INVALIDARG;
    			}

     I use the  "pDispParams->rgvarg[1].pdispVal" as the mail item and get data for sending the mail. Is there a way i can do the same when recieved

    Thanks 

    Tuesday, December 16, 2014 10:43 AM

Answers