简体   繁体   中英

Capture the event of a sent email in outlook

i'm writing for a addin for Outlook and i'm trying to capture the event of a mail sent from outlook. On thw web i've found a lot of examples for a SEND email, but i need to know the event of an email that was SENT. There is a method or a procedure to hook this particular event? Thanks

There is a variable which contains a boolean if a mail item is sent. You can send your mail and check that boolean.

mailItem.Send();
if (mailItem.Sent) 
{
    // Do your thing
}    

i figured a simple cute work around for that, without using add-ins

Just check the MailItem.Sent value after displaying to user, if it's false than you know the email was closed without sending, and if it has no value, meaning you get an error "item was removed or deleted", that means the email was sent and that's why the object disappears

try it

MailItem.Display(True)

Try
     Dim sent As Boolean = MailItem.sent
     'msg was closed without sending
Catch ex As Exception
     'msg was sent
End Try

使用Application.ItemSend事件。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM