Test high volume email by using the Send-MailMessage cmdlet

Important

The high volume email (HVE) service is currently in public preview and subject to change. We reserve the right to suspend or disable the service at any time if we detect any misuse or abuse of the service by any user. We appreciate your understanding and cooperation in this matter.

The high volume email (HVE) feature is primarily designed for internal mass communication. However, there are instances where an administrator needs to verify whether the HVE account and setup are correctly configured using a simple and straightforward method. This article explains how to test HVE using the Send-MailMessage cmdlet.

Prerequisites

  • A computer that can connect externally through port 587.
  • PowerShell 5.1 or a later version installed. As a best practice, install the latest version of PowerShell.
  • ExchangeOnlineManagement module 3.0 or a later version installed.

Create an HVE account

  1. Create an HVE account by using one of the following methods:

    1. Create an HVE account in the Exchange admin center (EAC)
    2. Create an HVE account by using PowerShell
  2. Verify that you can send an email message using your HVE account credentials. For example, use the following information to send an email message in Power Automate:

    1. The email address and password that you selected when you created the HVE account
    2. SMTP Server address: smtp-hve.office365.com
    3. Server port: 587

Test high volume email

  1. Connect to Exchange Online PowerShell.

  2. Run the following commands in an admin PowerShell session to test HVE:

    param ( 
    
        [Parameter(Mandatory = $true)] 
    
        [string]$senderEmailAddress, 
    
        [Parameter(Mandatory = $true)] 
    
        [string]$recipientEmailAddresses, 
    
        [Parameter(Mandatory = $true)] 
    
        [string]$subject, 
    
        [Parameter(Mandatory = $true)] 
    
        [string]$body 
    
    ) 
    
    $smtpServer = "smtp-hve.office365.com" 
    
    $smtpPort = "587" 
    
    # Prompt user for sender credentials 
    
    $credentials = Get-Credential -UserName $senderEmailAddress -Message "Enter sender credentials" 
    
    # Test HVE account 
    
    Send-MailMessage -From $senderEmailAddress -To $recipientEmailAddresses -Subject $subject -Body $body -SmtpServer $smtpServer -Port $smtpPort -UseSsl -Credential $credentials
    
    

    The Send-MailMessage cmdlet output indicates whether the email is sent. If you encounter errors, see Fix issues with high volume email for Microsoft 365.

Related article

Manage high volume emails for Microsoft 365 in Exchange Online Public preview