@@ -217,7 +217,8 @@ public void CreateFolders()
217217 intlRelationsFolder = null ,
218218 hassEventsFolder = null ,
219219 lkycicFolder = null ,
220- aiResearchFolder = null ;
220+ aiResearchFolder = null ,
221+ smtFolder = null ;
221222 Outlook . Folders rootFolderFolders = null ,
222223 othersSubfolders = null ;
223224
@@ -252,6 +253,7 @@ public void CreateFolders()
252253 hassEventsFolder = GetSubFolder ( @"HASS Events" , othersFolder , application ) ;
253254 lkycicFolder = GetSubFolder ( @"LKYCIC" , othersFolder , application ) ;
254255 aiResearchFolder = GetSubFolder ( @"AI Research" , othersFolder , application ) ;
256+ smtFolder = GetSubFolder ( @"SMT" , othersFolder , application ) ;
255257 }
256258 catch ( Exception ex )
257259 {
@@ -630,6 +632,30 @@ public void CreateRules()
630632
631633 rules . Save ( true ) ;
632634 }
635+
636+ string smtRuleName = "SMT Emails" ;
637+
638+ if ( ! RuleExist ( smtRuleName , rules ) )
639+ {
640+ Outlook . MAPIFolder destinationFolder = GetFolder ( rootFolder . FolderPath + @"\Others\SMT" , application ) ;
641+
642+ Outlook . Rule rule = rules . Create ( smtRuleName , Outlook . OlRuleType . olRuleReceive ) ;
643+ Outlook . RuleConditions ruleConditions = rule . Conditions ;
644+
645+ Outlook . ToOrFromRuleCondition senderAddressRuleCondition = ruleConditions . From ;
646+ senderAddressRuleCondition . Recipients . Add ( "sci-math@sutd.edu.sg" ) ;
647+ senderAddressRuleCondition . Recipients . ResolveAll ( ) ;
648+ senderAddressRuleCondition . Enabled = true ;
649+
650+ Outlook . RuleActions ruleActions = rule . Actions ;
651+ Outlook . MoveOrCopyRuleAction moveRuleAction = ruleActions . MoveToFolder ;
652+ moveRuleAction . Folder = destinationFolder ;
653+ moveRuleAction . Enabled = true ;
654+
655+ ruleActions . Stop . Enabled = true ;
656+
657+ rules . Save ( true ) ;
658+ }
633659 }
634660 catch ( Exception ex )
635661 {
0 commit comments