Checking Message Size

Checking Message Size

Question:
Is there a way to write a script at the Outlook client that will make sure the message size—including an attachment—doesn’t exceed our limit as soon as the message composition is started?

Answer:
Yes, you can do that with VB by using the ItemSend event like this:

Private Sub Application_ItemSend(ByVal Item
As_ Object, Cancel As Boolean) Item.Save If Item.Size < 100000 Then MsgBox Item.Size & " is too large a_ message." Cancel = True End IfEnd Sub

This uses the item.size property to determine the size of the message item (attachment and all) and compares it to an arbitrary value (in bytes). In this case, I've set the checkpoint to be 100,000 bytes (roughly 100K) but you could set it anywhere you like. It then displays a message box showing the user the message's size (in bytes) and letting them know it's too large. It then cancels their send, leaving the compose message screen up for them to modify their message.

If their message is under that size value, the message will be sent with no interaction with the user at all.

Note that you do need the item.save method before the item.size, because before the item is saved the size will always equal zero so your comparison always will fail and every message will be sent.

To distribute that to your users I'd compile it into a COM Add-in and distribute that—but you could just distribute the VBA project as well (if your users don't have any preexisting customizations that would be overwritten by this new project).

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes