Skip to content

Commit afa4814

Browse files
committed
Add new SMT rule
1 parent 985bbe3 commit afa4814

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Alternatively, you can clone this repository, build the executable yourself and
5050
- HASS Events
5151
- LKYCIC
5252
- AI Research
53+
- SMT
5354

5455
### Rules
5556

@@ -70,6 +71,7 @@ Alternatively, you can clone this repository, build the executable yourself and
7071
- Filter and move all emails from [`hassevents@sutd.edu.sg`](mailto:hassevents@sutd.edu.sg) to the HASS Events folder.
7172
- Filter and move all emails from [`lkycic@sutd.edu.sg`](mailto:lkycic@sutd.edu.sg) to the LKYCIC folder.
7273
- Filter and move all emails from [`AI_RESEARCH@sutd.edu.sg`](mailto:AI_RESEARCH@sutd.edu.sg) to the AI Research folder.
74+
- Filter and move all emails from [`sci-math@sutd.edu.sg`](mailto:sci-math@sutd.edu.sg) to the SMT folder.
7375

7476
## Feedback
7577

SUTDigest/OutlookWrapper.cs

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

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.5</Version>
14+
<Version>1.0.6</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)