How to send a test message between the users in Exchange/Office 365?

You wish to send an email message from one user to another without accessing their mailboxes. It may be useful for you to test the working of email rules in your organization.

Resolution:

The usual procedure to send an email is to do it directly by logging into the mailbox. If you have admin privileges and the required permissions, you can handle it using the Send-MailMessage PowerShell command without knowing the mailbox credentials. Click on the links below to know how to run this command in various Exchange environments.

Microsoft On-Premises Exchange

Follow the steps below to send a test message from one user to another as an Exchange admin:

  1. Sign in to your Exchange server as an administrator with required permissions and open the Exchange Management Shell.
  2. Execute the following cmdlet:

Send-MailMessage -From "user-X@org.com" -To "admin@org.com" -Subject "Test Mail" -Body "This is a test mail." -SmtpServer $env:userdnsdomainCopy

Here, a message will be sent from User X to you (admin), with the subject: Test Mail and body: This is a test mail. The -Body parameter is optional. The -SmtpServer parameter is set to point to the user domain used to sign in to the Exchange server.

To know details about other parameters that can be used in the Send-MailMessage cmdlet, refer to this Microsoft article.

Office 365 (Exchange Online)

You must add the required permissions to your Office 365 (Exchange Online) admin account to send test emails between any mailboxes within your organization. Then, run the Send-MailMessage command to send the message.

Follow the steps below to complete the entire procedure.

  1. Connect to your Office 365 using Powershell.

    Run the below commands to connect to Office 365 using PowerShell(Run as Administrator)

    1. Change the Execution policy by executing the command below

      Set-ExecutionPolicy UnrestrictedCopy

    2. The Get-Credential command allows you to enter your credentials and login as an administrator. Enter the Username (SMTP) and Password of Office 365 account having Global Admin credentials.

      $LiveCred = Get-CredentialCopy

    3. The following command creates a new session and connects to the URL

      $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirectionCopy

    4. The following command creates a remote module

      Import-PSSession $SessionCopy

    5. Execute the following command and Ignore this result, if the error is "This operation is not required. Organization is already enabled for customization."

      Enable-OrganizationCustomizationCopy

    6. Set admin impersonation rights for your Office 365 account by executing this command where user@domain.com is your Office 365 admin email address.

      New-ManagementRoleAssignment -Role "ApplicationImpersonation" -User user@domain.comCopy

  2. Then, run the below command:

    Add-RecipientPermission "user-Y@org.com" -AccessRights SendAs -Trustee admin@org.comCopy

    With this command you are having the SendAs permission and specifying the target recipient (User Y).

  3. Execute the PowerShell command below to send emails from User Y to others (Let’s consider yourself):

    Send-MailMessage -From "user-Y@org.com" -To "admin@org.com" -Subject "Test Message" -Body "This is a test message." -SmtpServer "smtp.office365.com" -UseSsl -Port 587 -Credential $LiveCredCopy

    With this command, User Y sends a mail to You (admin), with the subject: Test Mail and body: This is a test mail.



Free On-demand Product Demo

Sigsync email signature service offers company-wide and centralized email signature
for Office 365 and Exchange. We can assist you in getting your signature ready effortlessly.