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:

[cc lang="vb"]

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

[/cc]

That's all there is to it!

4 thoughts on “Outlook: Warn Before Sending from Wrong Account”

  1. I would like to see if a modification to the above macro is possible.

    I would like to receive a warning message if an email is not sent from a specific email id or default profile and is being sent from another one.

    Is this possible?

  2. In Outlook 2013 you also need to enable Macros:

    To enable macros
    – On the File tab, choose Outlook Options to open the Outlook Options dialog box, and then click Trust Center.

    – Click Trust Center Settings, and then the Macro Settings option on the left.

    – Select Notifications for all macros and then click OK. The option allows macros to run in Outlook, but before the macro runs, Outlook prompts you to verify that you want to run the macro.

    – Restart Outlook for the configuration change to take effect.

  3. Thank you for taking the time and sharing this Matthew! This code works for when you have not added the mailboxes as shared mailboxes and are listed a additional accounts. I wish there was a way that you could add code to list the mailboxes available and that you could be given the addresses list to choose from.

Leave a Reply

Your email address will not be published. Required fields are marked *


*