Outlook: Warn Before Sending from Wrong Account

If you use Microsoft Outlook as your e-mail program and have more than one account, than odds are roughly 100% that you have, on occasion, sent email from the wrong account. It can be embarrassing to send work email from your personal account, for example.

Here's a quick fix for that. You can create a macro that will fire before an email is sent. If the email is being sent from your personal account, you can display an "Are you sure?" popup dialog before firing off the email.

I'm using Outlook 2010; I haven't taken the time to investigate how this is done in other versions of Outlook. First, you'll need to ensure the Developer tab is displayed on the ribbon. From the File tab, click Options. Select "Customize Ribbon." In the right hand dropdown, ensure "Main Tabs" is selected, and check the "Develop" checkbox.

Click on the Developer tab of the ribbon. Click on the Visual Basic button to bring up the VBA editor. Add the following code:

1
2
3
4
5
6
7
8
9
10
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
     
If InStr(LCase(Item.SendUsingAccount), "bademail@example.com") Then
      Prompt$ = "You sending this from bademail@example.com. Are you sure you want to send it?"
       If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check Address") = vbNo Then
         Cancel = True
       End If
  End If
     
End Sub

That's all there is to it!