Skip to content

Commit f3fa5ce

Browse files
committed
Add new Wellbeing Services rule
1 parent afa4814 commit f3fa5ce

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Alternatively, you can clone this repository, build the executable yourself and
5151
- LKYCIC
5252
- AI Research
5353
- SMT
54+
- Wellbeing Services
5455

5556
### Rules
5657

@@ -72,6 +73,7 @@ Alternatively, you can clone this repository, build the executable yourself and
7273
- Filter and move all emails from [`lkycic@sutd.edu.sg`](mailto:lkycic@sutd.edu.sg) to the LKYCIC folder.
7374
- Filter and move all emails from [`AI_RESEARCH@sutd.edu.sg`](mailto:AI_RESEARCH@sutd.edu.sg) to the AI Research folder.
7475
- Filter and move all emails from [`sci-math@sutd.edu.sg`](mailto:sci-math@sutd.edu.sg) to the SMT folder.
76+
- Filter and move all emails from [`wellbeing@sutd.edu.sg`](mailto:wellbeing@sutd.edu.sg) to the Wellbeing Services folder.
7577

7678
## Feedback
7779

SUTDigest/OutlookWrapper.cs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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
{

SUTDigest/SUTDigest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Description>SUTD Outlook Mail Classifier/Organizer.</Description>
1212
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
1313
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
14-
<Version>1.0.6</Version>
14+
<Version>1.0.7</Version>
1515
<PackageTags></PackageTags>
1616
<RepositoryUrl>https://github.com/jamestiotio/SUTDigest</RepositoryUrl>
1717
<PackageProjectUrl>https://github.com/jamestiotio/SUTDigest</PackageProjectUrl>

0 commit comments

Comments
 (0)