Guide

Manage a Shared Mailbox from Terminal

Read, send, and manage shared mailbox email from the command line. Authenticate with the shared address, switch between personal and team grants, list messages, and reply on behalf of team aliases. Works with Microsoft 365, Google Workspace, and Exchange shared mailboxes.

Written by Caleb Geene Director, Site Reliability Engineering

VerifiedCLI 3.1.1 · Gmail, Outlook · last tested May 25, 2026

What is a shared mailbox?

A shared mailbox is an email address that multiple team members can read and send from without sharing a password. Microsoft 365 shared mailboxes are the most common implementation — Microsoft's documentation states that shared mailboxes don't require a separate license and support up to 50 GB of storage. Google Workspace uses delegated access or Google Groups for the same purpose. According to Microsoft's shared mailbox documentation, organizations use them for support@, info@, sales@, and other team-facing addresses.

Managing shared mailboxes from the terminal is harder than personal email. The Outlook web client handles shared mailboxes natively, but programmatic access requires Graph API with specific delegated or application permissions (Mail.Read.Shared, Mail.Send.Shared). The Nylas CLI simplifies this: authenticate the shared mailbox as a separate grant, switch to it, and use the same commands you use for personal email.

How do you add a shared mailbox grant?

The Nylas CLI treats each email address as a separate grant. Your personal email is one grant; the shared mailbox is another. Run nylas auth login with the shared address to authenticate it. For Microsoft 365 shared mailboxes, the OAuth flow prompts you to sign in with an account that has delegate access to the shared mailbox. The entire process takes under 60 seconds. Once authenticated, both grants are stored locally and you switch between them with a single command.

# Authenticate the shared mailbox (opens OAuth flow)
nylas auth login support@company.com

# Verify both grants are registered
nylas auth list

The nylas auth list output shows all authenticated accounts with their email address, provider, and grant ID. You'll see both your personal address and the shared mailbox listed.

Email                     Provider    Grant ID         Status
you@company.com           microsoft   grt_abc123...    active
support@company.com       microsoft   grt_def456...    active

How do you switch between personal and shared mailbox?

The nylas auth switch command changes the active grant for all subsequent commands. Pass either the email address or the grant ID. Switching is instant — no re-authentication required. The active grant persists across terminal sessions until you switch again. You can also pass a grant ID directly to any email command without switching, which is useful in scripts that operate on both mailboxes.

# Switch to the shared mailbox
nylas auth switch support@company.com

# Verify which account is active
nylas auth whoami

# Read shared mailbox inbox
nylas email list

# Switch back to personal
nylas auth switch you@company.com

How do you read and reply from the shared mailbox?

Once switched to the shared mailbox grant, all email commands operate on that mailbox. nylas email list shows the shared inbox, nylas email search queries it, and nylas email send sends from the shared address. Replies appear to come from support@company.com, not your personal address. This is the same behavior as clicking "Reply" in Outlook's shared mailbox view — the recipient sees the team address.

# List unread messages in the shared inbox
nylas email list --unread

# Search for tickets from a specific customer
nylas email search "invoice" --from "billing@customer.com"

# Reply from the shared address
nylas email send \
  --to "billing@customer.com" \
  --subject "Re: Invoice #4521" \
  --body "We've processed your payment. The updated invoice is attached."

How do you script shared mailbox operations?

Automated workflows often need to read from a shared mailbox and act on messages — routing support tickets, escalating urgent requests, or archiving resolved threads. The CLI supports passing a grant ID directly to any command with a positional argument, so scripts don't need to switch the global active grant. This lets a single script operate on multiple mailboxes in sequence without state management.

#!/bin/bash
# support-triage.sh — check shared mailbox and alert on urgent messages

SHARED_GRANT="grt_def456"
SLACK_WEBHOOK="https://hooks.slack.com/services/T00000/B00000/xxxx"

# List unread emails from the shared mailbox (pass grant ID directly)
URGENT=$(nylas email search "URGENT" "$SHARED_GRANT" --unread --json)
COUNT=$(echo "$URGENT" | jq length)

if [ "$COUNT" -gt 0 ]; then
  echo "$URGENT" | jq -c '.[]' | while read -r email; do
    SUBJECT=$(echo "$email" | jq -r '.subject')
    SENDER=$(echo "$email" | jq -r '.from[0].email')
    curl -s -X POST "$SLACK_WEBHOOK" \
      -H "Content-Type: application/json" \
      -d "{"text": "Urgent support email from $SENDER: $SUBJECT"}"
  done
fi

How does this work with Google Workspace?

Google Workspace handles shared access differently from Microsoft 365. Instead of a dedicated shared mailbox type, Google uses two patterns: delegated access (another user grants you access to their inbox) and Google Groups with a collaborative inbox. Both work with the Nylas CLI — authenticate the shared address with nylas auth login the same way. Google requires the delegating user to grant access in Gmail settings under "Accounts and Import > Grant access to your account." The OAuth flow for the shared address completes in under 30 seconds once delegation is configured.

For Google Groups collaborative inboxes, authenticate with a member account and use nylas email search filtered by the group address in the to field. Messages sent to the group land in the authenticated member's inbox with the group address visible in the headers.

Next steps

Get started with the installation and auth guide. For email-to-Slack alerting on shared mailbox messages, see email to Slack alerts. To build automated triage for support inboxes, check build an AI email triage agent. The full command reference covers all auth subcommands including switch, list, show, and scopes.