VBA Send Email From a Shared Mailbox in Outlook

VBA & macros · Updated November 18, 2026

Yes. In classic Outlook for Windows, VBA can create a message and set its SentOnBehalfOfName property to the shared mailbox address before sending it. The account must have the right Exchange permission, and the message’s displayed sender depends on whether that permission is Send As or Send on Behalf.

How sending from a shared mailbox works

A shared mailbox is an Exchange mailbox that multiple people can use, usually for an address such as support@contoso.com. It is not necessarily a separate sign-in or a separate sending account in Outlook. Outlook may display it automatically when an administrator grants Full Access, but being able to open and read the mailbox does not automatically mean you can send from it.

When VBA creates a message, it normally uses the current Outlook profile and its default sending account. To ask Outlook to represent the shared mailbox, code can set MailItem.SentOnBehalfOfName to that mailbox’s address. Exchange then checks the sender’s permissions and handles the message accordingly. The property does not grant permission by itself, and it cannot override a restriction imposed by the organization.

This is different from choosing a folder in the shared mailbox. Creating a message while viewing its Inbox does not necessarily change the sender account. Likewise, putting the shared address in the To field only sends the message to that address; it does not make the shared mailbox the sender.

Permissions to check first

Ask the Microsoft 365 or Exchange administrator which permission has been assigned to your user for the shared mailbox. The two commonly relevant permissions have different effects:

  • Send As: Recipients generally see the shared mailbox as the sender, without the delegate’s name appearing as the sender.
  • Send on Behalf: Recipients see that the delegate sent the message on behalf of the shared mailbox. The exact display may vary by mail client.
  • Full Access: Lets a user open and manage mailbox contents, but does not by itself grant permission to send from the mailbox.

Permission changes can take time to become effective and may require Outlook to restart or refresh its profile. If a message is rejected, ask an administrator to verify both the permission type and that it applies to the account you are using. Do not assume that automatic mailbox mapping proves you have Send As rights.

Excel VBA example using classic Outlook

This example is for Excel VBA on Windows controlling classic Outlook. It uses late binding, so you do not need to select an Outlook reference in the VBA editor. Replace the example addresses and message text before running it. The macro sends immediately; change .Send to .Display if you want to inspect the message in Outlook before sending it.

Sub SendSharedMailboxEmail()
    Dim outlookApp As Object
    Dim mail As Object
    Dim sharedAddress As String

    sharedAddress = "support@contoso.com"

    ' Get Outlook if it is already open; otherwise start it.
    On Error Resume Next
    Set outlookApp = GetObject(, "Outlook.Application")
    If outlookApp Is Nothing Then
        Set outlookApp = CreateObject("Outlook.Application")
    End If
    On Error GoTo 0

    If outlookApp Is Nothing Then
        MsgBox "Classic Outlook could not be started."
        Exit Sub
    End If

    Set mail = outlookApp.CreateItem(0)

    With mail
        .To = "recipient@example.com"
        .Subject = "Shared mailbox test"
        .Body = "This is a test message from the shared mailbox."
        .SentOnBehalfOfName = sharedAddress
        .Send
    End With

    Set mail = Nothing
    Set outlookApp = Nothing
End Sub

In Excel, press Alt+F11 on Windows to open the Visual Basic Editor, insert a standard module, and paste the code. Outlook’s own VBA editor can also run a version of this code; there, Outlook is already the host application, so you can use Application.CreateItem(0) instead of creating or retrieving an Outlook application object. If you are sending from a workbook, save a copy before running a macro. Macros cannot be undone with Ctrl+Z, and this one sends an email as soon as it reaches .Send.

Send As, Send on Behalf, and the From line

The example sets a requested sender identity; it does not choose a separate account from Outlook’s account list. Exchange permissions determine whether recipients see the message as sent by the mailbox or on behalf of it. Because organization settings and mailbox configuration can affect the result, send a test to an address you can check and inspect the sender shown on the received message.

Outlook’s SendUsingAccount property serves a different purpose: it selects an account that exists in the current Outlook profile’s accounts collection. A shared mailbox may not appear there as a sending account, even if it is visible in the folder list. Use that property when you genuinely need to choose a configured account; do not assume it is the solution for every shared mailbox.

Typing a shared address into Outlook’s visible From field is also not a substitute for permission. If Outlook accepts the address but Exchange does not authorize the sender, the message can be rejected or returned as undeliverable. Avoid relying on edits to low-level message properties as a workaround. Use the supported permission route and confirm the result with the administrator.

Sending from Outlook VBA versus Excel VBA

The mail-item properties are the same whether the macro runs in Outlook or Excel, but the way the macro obtains Outlook differs. In Outlook VBA, Application already refers to Outlook. In Excel VBA, the example first connects to a running Outlook instance or starts one through Windows COM automation. If Outlook is unavailable, blocked by policy, or not installed as classic Outlook, that automation cannot proceed.

This code is not for the new Outlook for Windows, which does not support Outlook VBA or the classic Outlook COM automation model. It also is not a cross-platform solution: Excel for Mac cannot use the Windows Outlook COM approach shown here, and Outlook for Mac does not provide the same VBA automation environment. If users work on Mac or use new Outlook, consider an approved alternative such as Microsoft Graph or a server-side workflow.

Common errors and practical troubleshooting

If the macro runs but the message does not arrive, first test with .Display rather than .Send. This lets you check the recipient, subject, body, and sender before sending. Then test a single message manually from classic Outlook using the same mailbox. If manual sending also fails, the cause is more likely permission, account, or Exchange configuration than the VBA code.

  • Permission denied or undeliverable notice: Ask the administrator to confirm Send As or Send on Behalf for your user and mailbox. Full Access alone is not enough.
  • The wrong sender appears: Confirm the address assigned to SentOnBehalfOfName, check which permission type you have, and examine the received message rather than only the draft.
  • The mailbox is missing in Outlook: Confirm that it is added to the profile or that you have the required access. A mailbox appearing in the folder pane is not proof of sending rights.
  • Outlook cannot be created: Check that classic Outlook is installed and that your organization allows COM automation. New Outlook does not provide this automation path.
  • Messages appear in the user’s Sent Items: Sent-item storage for shared mailboxes can depend on Exchange settings. Ask the administrator whether copies should be saved in the shared mailbox’s Sent Items folder.

Outlook or organization security controls may also warn about programmatic sending or restrict it. Do not try to evade those controls; ask IT which approved method is available. For a production macro, add error handling, validate the recipient and message content, and log a useful status without recording sensitive message contents unnecessarily.

Safety, volume, and message handling

A macro that calls .Send can send to the wrong person just as quickly as it can send to the right one. Start with a test recipient, use .Display while developing, and avoid looping over a large contact list until the addressing and permission behavior are confirmed. Outlook and Exchange may enforce sending limits or anti-abuse controls; VBA does not remove them.

Consider how replies and follow-up work, too. A shared mailbox is often used so that a team can see correspondence, but a message appearing in a person’s Sent Items may be less useful to colleagues. Confirm where sent copies are stored and whether the shared mailbox is monitored. Do not put passwords, access tokens, or confidential data into code or workbook cells unless the organization has approved that handling.

Alternatives for automated or unattended mail

Outlook VBA is most suitable for a user-triggered task on a Windows computer with classic Outlook and an interactive profile. It is a poor fit for a scheduled job that must run when nobody is signed in, a process used by many people across operating systems, or a high-volume application.

For those situations, an administrator or developer can evaluate Microsoft Graph with the appropriate application or delegated permissions, or use a managed workflow such as Power Automate where it meets the requirements. These options need their own authorization, configuration, and security review; they are not permission bypasses. The right choice depends on whether a person must approve each message, where the process runs, audit requirements, and how credentials are managed.

Frequently Asked Questions

Can VBA send an email from a shared mailbox?
Yes, in classic Outlook for Windows, provided the user has the required Exchange sending permission. VBA can set SentOnBehalfOfName to the shared mailbox address, but that setting does not grant permission.

Does Full Access let me send from a shared mailbox?
No. Full Access generally allows you to open and manage the mailbox. Sending requires Send As or Send on Behalf permission as well.

Why does the email say “on behalf of”?
That usually indicates the account has Send on Behalf permission rather than Send As, or that Exchange is handling the message with that sender representation. Ask your administrator to confirm the assigned permission and test the received message.

Can this macro run in new Outlook or Outlook for Mac?
No. The example relies on classic Outlook’s Windows COM automation. New Outlook does not support this VBA route, and the Windows COM code will not run from Excel for Mac.

Can I use SendUsingAccount for the shared mailbox?
Only when the mailbox is actually configured as a sending account in the Outlook profile and is available in its accounts collection. For a shared mailbox that is merely added as a mailbox, setting SentOnBehalfOfName is the more relevant Outlook Object Model approach.

Related

Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.

More in VBA & macros

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.