Reputation: 1207
I'm working on an application that captures some Outlook events. Is it possible to detect the event when an email is sent. I don't mean when the user clicks on "send" button but when the email is actually sent and is no more in the outbox. Thanks in advance.
UPDATE
I managed to capture the Items.ItemAdd
event on the sent mails folder. In order to check whether the last email added to the sent items folder is the one I'm interestd in I tried this :
STDMETHODIMP CItemsEventListener::HandleItemAdd(CString p_date, CString p_time)
{
CComPtr<Outlook::_Application> spApplication;
CComPtr<Outlook::_NameSpace> spSession;
CComPtr<Outlook::MAPIFolder> spSentMailsFolder;
CComPtr<Outlook::_Items> pSentboxItems;
spSentMailsFolder->get_Items(&pSentboxItems);
CComPtr<Outlook::_MailItem> pSentMail;
pSentMail = pSentboxItems->GetLast();
//do staff
return S_OK;
}`
I'm getting compiler error :
error C2660: 'Outlook::_Items::GetLast' : the function doesn't take 0 arguments
Which argument should I pass to the function?
Upvotes: 2
Views: 286
Reputation: 66235
MailItem.Send and Application.ItemSend events occur before the message is actually sent.
To capture when a message is actually sent, use the Items.ItemAdd event on the Sent Items folder.
Upvotes: 1