Forum Discussion
AndreRadtke
Feb 21, 2025Brass Contributor
Configure autoreply with rules via PowerShell
Hello, I need a solution where I can set the autoreply agent in outlook with a rule via powershell. I am using exchange online. In the outlook client on my laptop I can activate the autoreply age...
Ankido
Feb 21, 2025Iron Contributor
Hi AndreRadtke,
1- First, we enable the auto-reply for the user.
# Enable Auto-Reply for a user
Set-MailboxAutoReplyConfiguration -Identity "email address removed for privacy reasons" `
-AutoReplyState Enabled `
-InternalMessage "I am out of the office and will return soon." `
-ExternalMessage "I am out of the office and will return soon." `
-ExternalAudience All2- Then, we create a transport rule to block emails marked as "Private", "Personal", or "CompanyConfidential" from triggering the auto-reply.
# Create a transport rule that blocks emails with specific sensitive labels
New-TransportRule -Name "Block Sensitive Emails from Auto-Reply" `
-SentTo "email address removed for privacy reasons" `
-SentFromScope NotInOrganization `
-HeaderContainsMessageHeader "Sensitivity" `
-HeaderContainsWords "Private", "Personal", "CompanyConfidential" `
-RejectMessageReasonText "We cannot send an auto-reply for sensitive emails."
Feel free to reach out