Skip to main content

Posts

Showing posts with the label Rules

Creating a sender domain auto reply rule for a mailbox with EWS and Powershell

This is a rewrite of an old CDO 1.2 rule.dll script back from 2006 http://gsexdev.blogspot.com.au/2006/10/creating-domain-based-auto-response.html . Creating a Domain based auto response rule allows you to have a custom auto-responder for an email based on the sender's email domain of any newly received email messages. This is useful when you need to cater for a number of different scenarios and where you want to add a more personal touch to these auto responders.  EWS allows you to create Inbox rules via the CreateRule Operation if your after the full spiel have a read of http://msdn.microsoft.com/en-us/library/exchange/hh298418%28v=exchg.140%29.aspx In this script it first uses a ContainsSenderStrings condition to filter on the domain you want the rule to apply to in my example yahoo.com $nrNewInboxRule.Conditions.ContainsSenderStrings.Add("@yahoo.com") Exceptions are created for any messages with subject prefixes of RE and FW to omit these message...
All sample scripts and source code is provided by for illustrative purposes only. All examples are untested in different environments and therefore, I cannot guarantee or imply reliability, serviceability, or function of these programs.

All code contained herein is provided to you "AS IS" without any warranties of any kind. The implied warranties of non-infringement, merchantability and fitness for a particular purpose are expressly disclaimed.