No description
  • Go 99.2%
  • Dockerfile 0.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Humphrey Drummond ea745167f3 Add HTTP config endpoints and gomail-backup cmd
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 11:00:11 +01:00
.claude more complex rules 2026-03-16 21:15:55 +00:00
cmd Add HTTP config endpoints and gomail-backup cmd 2026-05-10 11:00:11 +01:00
common Replace per-folder retention keys with generic retention list 2026-04-26 19:56:37 +01:00
docs more complex rules 2026-03-16 21:15:55 +00:00
graphapphelper Add HTTP config endpoints and gomail-backup cmd 2026-05-10 11:00:11 +01:00
graphhelper Request 100 mail folders per page in GetFolders 2026-04-26 13:00:22 +01:00
.gitignore updating gitignore 2026-04-06 23:49:46 +01:00
CHANGELOG.md Add HTTP config endpoints and gomail-backup cmd 2026-05-10 11:00:11 +01:00
Dockerfile adding main prog 2024-10-11 10:19:06 +01:00
Dockerfile.multistage adding main prog 2024-10-11 10:19:06 +01:00
go.mod Migrate module path from github.com to codeberg.org 2026-03-26 23:05:09 +00:00
go.sum feat:Add delete 2025-07-11 12:10:49 +01:00
gomail more complex rules 2026-03-16 21:15:55 +00:00
gomail.go Add HTTP config endpoints and gomail-backup cmd 2026-05-10 11:00:11 +01:00
gomail_test.go Add HTTP config endpoints and gomail-backup cmd 2026-05-10 11:00:11 +01:00
gomaild more complex rules 2026-03-16 21:15:55 +00:00
index.md more complex rules 2026-03-16 21:15:55 +00:00
LICENSE Initial commit 2023-08-08 20:35:14 +01:00
README.md Replace per-folder retention keys with generic retention list 2026-04-26 19:56:37 +01:00
task-plus.yml more complex rules 2026-03-16 21:15:55 +00:00
Taskfile.yml Add HTTP config endpoints and gomail-backup cmd 2026-05-10 11:00:11 +01:00
TODO.md feat:Add delete 2025-07-11 12:10:49 +01:00

gomail

Go email sorter to help me keep on top of my emails.

I currently have my emails in Microsoft 365. So I am using the Microsoft Graph API to update and query my emails. I have added the name to the list of approved apps that can access my account.

Docker file

I originally deployed this my Synology NAS. But I have since moved it to Gokrazy on a Raspberry Pi 5.

Gokrazy build

I have added a top level program to run and added tags to the build.

in the directory ~/gokrazy/hello just run gok update and it should rebuild.

In the cmd directory there is a gomail.yaml file that needs to be updated.

gomail.yaml Configuration

The gomail.yaml file defines email sorting rules. Emails are processed in priority order: delete, maybe, news, briefly. The first matching rule wins.

delete

List of sender address patterns. Matching emails are deleted immediately.

delete:
  - spam@example.com

maybe

List of sender address patterns. Matching emails are moved to the News folder immediately (no delay).

maybe:
  - messages-noreply@linkedin.com
  - donotreply@amazon.com

news

Sender-based rules with a delay. Emails from matching senders stay in the inbox for delay_days before being moved to News. This lets you see them briefly before they're filed away.

news:
  - sender: ebay@ebay.co.uk
    delay_days: 2
  - sender: publications@understandingwar.org
    delay_days: 1

briefly

Rules with a delay. Emails matching the rule stay in the inbox for delay_days before being moved to News. Each rule can match on subject, sender, or both (all specified fields must match). Matching is case-insensitive partial (substring) match.

briefly:
  - subject: "ISW Publications"
    delay_days: 1
  - sender: "notifications@example.com"
    delay_days: 2
  - subject: "Weekly Digest"
    sender: "news@example.com"
    delay_days: 1

Retention sweeps

Each entry under retention: sweeps the named folder on every sort, deleting messages older than days. action defaults to soft_delete (move to Deleted Items); hard_delete bypasses recovery. Omit a rule (or set days: 0) to disable.

retention:
  - name: news
    folder: News
    days: 14                 # soft-delete after 14 days
  - name: unsubscribe_recent
    folder: Unsubscribe/Recent
    days: 90
  - name: deleted_items
    folder: deleteditems
    days: 180
    action: hard_delete

add_to_briefly_default_delay_days

Default delay_days applied to senders learned via the AddToBriefly folder (default: 1).

Learning folders

Move an email to one of these folders to teach gomail a new rule. The sender is added to gomail.yaml automatically and the email is moved on.

Folder Effect
AddToNews Sender appended to learned:; treated like maybe.
AddToBriefly Sender appended to briefly: with add_to_briefly_default_delay_days.
Unsubscribe/Done After you manually click unsubscribe, drop the email here. Sender is appended to unsubscribed: with today's date and the email is soft-deleted. Future emails from that sender route to Unsubscribe/Recent (swept by the matching retention rule).

Auto-managed YAML keys

Gomail rewrites gomail.yaml to append entries to learned: and unsubscribed:. Comments and key order in your hand-edited sections are preserved. The legacy gomail-learned.yaml is migrated into gomail.yaml on first run and renamed .bak.

Documentation https://h3-gomail.statichost.page/
Source (Codeberg) https://codeberg.org/hum3/gomail
Mirror (GitHub) https://github.com/drummonds/gomail