简体   繁体   中英

How to get the Outlook mail item's size?

'm writing an Outlook Add-in for Outlook 2007. This is a VSTO 3.0 , C# add-in. I capture the send event in the add-in and then check some of the Email properties (Which is being sent out) and based on that display some alert.

When I try to get the total size of email using mailItem.Size, it always returns 0 while the actual size of email is not 0. And if I save the email (mailitem.Save()) then mailItem.Size returns the correct size of the mail. Does any one know about reason behind this behavior . Is there any otherway to get the email size ?

yes, this is the default behavior in Outlook.
I suggest you save it ( MailItem.Save ) before you send it.
Saving the email will place it in the drafts folder...but who cares because you will now check its size ( MailItem.Size ) and send it ( MailItem.Send ).

Does any one know about reason behind this behavior . Is there any otherway to get the email size ?

AFAIK, This is the default behavior in Outlook. You cannot get the size till the time you save/send it.

You can however check for the Attachment size or the Body Length if that helps?

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