@@ -218,7 +218,8 @@ public void CreateFolders()
218218 hassEventsFolder = null ,
219219 lkycicFolder = null ,
220220 aiResearchFolder = null ,
221- smtFolder = null ;
221+ smtFolder = null ,
222+ wellbeingFolder = null ;
222223 Outlook . Folders rootFolderFolders = null ,
223224 othersSubfolders = null ;
224225
@@ -254,6 +255,7 @@ public void CreateFolders()
254255 lkycicFolder = GetSubFolder ( @"LKYCIC" , othersFolder , application ) ;
255256 aiResearchFolder = GetSubFolder ( @"AI Research" , othersFolder , application ) ;
256257 smtFolder = GetSubFolder ( @"SMT" , othersFolder , application ) ;
258+ wellbeingFolder = GetSubFolder ( @"Wellbeing Services" , othersFolder , application ) ;
257259 }
258260 catch ( Exception ex )
259261 {
@@ -280,6 +282,8 @@ public void CreateFolders()
280282 ReleaseComObject ( hassEventsFolder ) ;
281283 ReleaseComObject ( lkycicFolder ) ;
282284 ReleaseComObject ( aiResearchFolder ) ;
285+ ReleaseComObject ( smtFolder ) ;
286+ ReleaseComObject ( wellbeingFolder ) ;
283287 ReleaseComObject ( store ) ;
284288 ReleaseComObject ( session ) ;
285289 }
@@ -656,6 +660,30 @@ public void CreateRules()
656660
657661 rules . Save ( true ) ;
658662 }
663+
664+ string wellbeingRuleName = "Wellbeing Services Emails" ;
665+
666+ if ( ! RuleExist ( wellbeingRuleName , rules ) )
667+ {
668+ Outlook . MAPIFolder destinationFolder = GetFolder ( rootFolder . FolderPath + @"\Others\Wellbeing Services" , application ) ;
669+
670+ Outlook . Rule rule = rules . Create ( wellbeingRuleName , Outlook . OlRuleType . olRuleReceive ) ;
671+ Outlook . RuleConditions ruleConditions = rule . Conditions ;
672+
673+ Outlook . ToOrFromRuleCondition senderAddressRuleCondition = ruleConditions . From ;
674+ senderAddressRuleCondition . Recipients . Add ( "wellbeing@sutd.edu.sg" ) ;
675+ senderAddressRuleCondition . Recipients . ResolveAll ( ) ;
676+ senderAddressRuleCondition . Enabled = true ;
677+
678+ Outlook . RuleActions ruleActions = rule . Actions ;
679+ Outlook . MoveOrCopyRuleAction moveRuleAction = ruleActions . MoveToFolder ;
680+ moveRuleAction . Folder = destinationFolder ;
681+ moveRuleAction . Enabled = true ;
682+
683+ ruleActions . Stop . Enabled = true ;
684+
685+ rules . Save ( true ) ;
686+ }
659687 }
660688 catch ( Exception ex )
661689 {
0 commit comments