How to Let Outlook Warn You When Sending an Email Larger Than a Specific Size

When sending a too large email, you will find it difficult to send it out successfully. So why not make Outlook to automatically check the mail size before sending? This article will teach you how to realize it with Outlook VBA.

As usual, when you intend to attach a file larger than a specific size, you’ll get an Outlook alert, which will stop you from attaching it. MS Outlook comes endowed with this feature, aimed to ensure that the email can be sent out successfully. But if the email is too large, maybe due to containing too many attachments, although each attachment is within the appropriate size, it is still difficult to send it out. So it’s suggested not to send too large email. Then, how can you identify whether the email is too large or not? Focused on this issue, here we will introduce a method to enable Outlook to automatically check the size and prompt you if the email is larger than you pre-determined maximum size.

Warn You When Sending an Email Larger Than a Specific Size

  1. At the very outset, start Outlook and shift to “Developer” tab.
  2. Then click on “Visual Basic” button.
  3. Subsequently, in the popup “Microsoft Visual Basic for Applications” window, you ought to double click on “ThisOutlookSession” project at left side.
  4. Next you can copy and paste the following VBA codes into the new project.
Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim olSize As Long
    Dim MaxSize As Long
    Dim strMsg As String
    Dim nRes As Integer
 
    olSize = Item.Size
    MaxSize = 20000 'in bytes
 
    If olSize > MaxSize Then
       strMsg = "The current mail has exceeded " & MaxSize & " bytes." & vbCrLf & "It may fail to be sent out. Do you still want to send it anyway?"
       nRes = MsgBox(strMsg, vbYesNo + vbExclamation, "Check Mail Size")
       If nRes = vbNo Then
          Cancel = True
       End If
    End If
End Sub

VBA Codes - Warn You When Sending an Email Larger Than a Specific Size

  1. After that, digitally sign this code. Utilize “Digital Certificates for VBA Projects” to create a certificate and then assign this certificate to the code.Sign the Current Macro
  2. Finally you can exit the current window and proceed to have a try. When you attempt to send an email which is larger than you preset maximum size, you will receive a warning, like the following screenshot:Check Mail Size

What to Do if Outlook Always Fails to Send/Receive

Outlook is prone to error. Thus, it is not uncommon to fail in sending/receiving emails. So how can you deal with this kind of issue? Generally speaking, you can first contact your server admin to ask if something wrong occurs to the server. If nothing wrong, you ought to deal with the issue from your own client. As usual, it may occur from corrupted SRS files. You can delete the file and restart Outlook to recreate it. If errors persist, it is very likely that you encounter Outlook PST email error. You have no choice to utilize a potent repair tool, like DataNumen Outlook Repair.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including repair damaged mdf database and outlook repair software products. For more information visit www.datanumen.com

Comments are closed.