- Microsoft Graph: A single (PowerShell) API for Microsoft’s cloud services - Tue, Aug 23 2022
- Exchange impersonation: Grant permissions to service accounts - Mon, Aug 8 2022
- Send Microsoft Teams meeting invitations in multiple languages - Thu, Jul 21 2022
This function is used when employees are not present in the company, due, for example, to vacation, illness, or other reasons, and cannot be reached by email during this time.
The automatic reply can be configured both in the Outlook client and via OWA. The user writes the text, which can be different for internal and external recipients. These replies can be limited to a certain period of time. Rules can also be configured, for example, to forward incoming mail.
To avoid an email loop, the automatic reply only responds once per sender. Hence, a sender who sends a message to a mailbox with an out-of-office reply will receive only one reply.
Setting up automatic replies for users
In some cases, the Exchange administrator or the service desk has to activate an automatic reply for a user. This is the case, for example, when the OWA is not accessible from outside the company, and the user cannot access their mailbox from home.
The easiest and fastest way is for you, the administrator, to access the user's mailbox via the Exchange ECP by selecting Another user from the dropdown menu in the upper right corner.
Select the user for whom you want to set the automatic reply. The user's mailbox options are displayed. Here, you can set up the out-of-office reply on the right side under Set up an automatic reply message.
Set up the automatic reply via PowerShell
Another possibility would be to configure the automatic reply via PowerShell. The Set-MailboxAutoreplyConfiguration cmdlet is provided for this purpose.
A simple command looks like this:
Set-MailboxAutoReplyConfiguration -Identity $mailbox -AutoReplyState Enabled \` -InternalMessage $Emailbody -ExternalMessage $Emailbody
The parameters Identity, InternalMessage, and ExternalMessage get their values from variables in our example. We used the same message text for internal and external recipients. This is defined by a Here-string in PowerShell:
$EmailBody = @" <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body style="font-family: Calibri;"> Dear Sir or Madam,<br/><br/> Thank you for your message.<br/><br/> I will be back in the office on ddmmyyyy. Your email will not be forwarded.<br/><br/> Please contact email@example.com if the matter is urgent.<br/><br/> Best regards<br/><br/> $($\_.Name) </body></html> "@
In addition, you can use the Starttime and Endtime parameters to specify the period during which the out-of-office message should be valid. To do this, however, you have to invoke the AutoReplyState parameter with the scheduled option.
An already configured automatic reply can be read using Get-MailboxAutoReplyConfiguration.
Redirecting a mailbox as an additional option
The only drawback with both ECP and PowerShell is that apparently, rules cannot be edited or created in the automatic reply. For example, to redirect the mailbox via ECP or PowerShell, you could issue the following PowerShell command:
Set-Mailbox $Identity -ForwardingAddress $ForwardAddress -DeliverToMailboxAndForward ($false/$true)
This command would correspond to the following setting in the user mailbox in the ECP:
Subscribe to 4sysops newsletter!
The disadvantage of such a separate redirection is that the user himself cannot switch off the mail forwarding, so you, as the administrator, have to keep it in mind.