imap: accept Schwab subdomain senders (donotreply@mail.schwab.com)

Real Schwab trade-execution emails come from donotreply@mail.schwab.com,
not the root @schwab.com domain. The existing matcher's endswith("@schwab.com")
guard rejected these, silently skipping the May 2026 RSU vest's
same-day-sell confirmation. Extend the matcher to also accept any
*.schwab.com subdomain.

Added test_schwab_subdomain_sender_matches; full suite green.
This commit is contained in:
Viktor Barzin 2026-05-22 14:41:09 +00:00
parent 98c4729622
commit d860aef927
2 changed files with 20 additions and 1 deletions

View file

@ -163,7 +163,11 @@ def fetch_activities(creds: ImapCreds) -> list[Activity]:
if sender in _IE_SENDERS or sender.endswith("@investengine.com"):
out.extend(ie_parser.parse_invest_engine_email(raw))
ie_parsed += 1
elif sender in _SCHWAB_SENDERS or sender.endswith("@schwab.com"):
elif (
sender in _SCHWAB_SENDERS
or sender.endswith("@schwab.com")
or sender.endswith(".schwab.com") # e.g. donotreply@mail.schwab.com
):
html = _html_or_text(msg)
out.extend(parse_schwab_email(html))
schwab_parsed += 1