common

package
v0.8.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteMessage

func DeleteMessage(graphAppHelper *graphapphelper.GraphAppHelper, message models.Messageable)

DeleteMessage deletes an email

func Diagnose added in v0.8.6

func Diagnose()

Diagnose runs gomail in read-only diagnostic mode: it lists every folder (including children) with their item counts, prints the loaded rule summary, and reports whether the critical folders are present. It deliberately skips the auto-create of "News" so the raw mailbox state is visible.

func DisplayAccessToken

func DisplayAccessToken(graphapphelper *graphapphelper.GraphAppHelper)

DisplayAccessToken displays the access token for debugging

func EmailAction

func EmailAction(graphAppHelper *graphapphelper.GraphAppHelper, message models.Messageable)

EmailAction processes a single email based on rules

func GetGraphAppHelper

func GetGraphAppHelper() *graphapphelper.GraphAppHelper

GetGraphAppHelper creates and initializes a new GraphAppHelper

func IsBrieflyMatch added in v0.8.6

func IsBrieflyMatch(graphAppHelper *graphapphelper.GraphAppHelper, message models.Messageable) bool

IsBrieflyMatch checks if an email matches any briefly rule (regardless of delay). Rules can match on subject, sender, or both.

func IsBrieflyReady added in v0.8.6

func IsBrieflyReady(graphAppHelper *graphapphelper.GraphAppHelper, message models.Messageable) bool

IsBrieflyReady checks if an email matches a briefly rule and is old enough to move to News. Emails matching a briefly rule stay in the inbox for delay_days before being moved.

func IsDelete

func IsDelete(graphAppHelper *graphapphelper.GraphAppHelper, message models.Messageable) bool

IsDelete checks if an email should be deleted

func IsMaybe

func IsMaybe(graphAppHelper *graphapphelper.GraphAppHelper, message models.Messageable) bool

IsMaybe checks if an email should be moved to the "maybe" folder. Also checks learned senders from AddToNews.

func IsNewsReady

func IsNewsReady(graphAppHelper *graphapphelper.GraphAppHelper, message models.Messageable) bool

IsNewsReady checks if an email is from a news sender and old enough to move to News

func ListMyFolders

func ListMyFolders(graphapphelper *graphapphelper.GraphAppHelper)

ListMyFolders lists all mail folders for the user

func ListUsers

func ListUsers(graphapphelper *graphapphelper.GraphAppHelper)

ListUsers lists all users in the system

func LoadEnvironment

func LoadEnvironment()

LoadEnvironment loads environment variables from .env files

func LoadEnvironmentWithValidation

func LoadEnvironmentWithValidation()

LoadEnvironmentWithValidation loads environment variables and validates required ones

func LogRuleSummary added in v0.8.6

func LogRuleSummary(rules *graphapphelper.GoMailRules, learned *graphapphelper.LearnedRules)

LogRuleSummary logs a summary of loaded rules, showing up to maxExamples of each type.

func MoveToFolder

func MoveToFolder(graphAppHelper *graphapphelper.GraphAppHelper, message models.Messageable, destFolderName string)

MoveToFolder moves an email to a specified folder

func OtherMessage

func OtherMessage(message models.Messageable)

OtherMessage handles emails that don't match any specific rules

func ProcessAddToNews

func ProcessAddToNews(graphAppHelper *graphapphelper.GraphAppHelper)

ProcessAddToNews moves all emails from AddToNews folder to News and auto-learns the senders for future sorting

func ProcessNewsRetention

func ProcessNewsRetention(graphAppHelper *graphapphelper.GraphAppHelper)

ProcessNewsRetention deletes emails from News folder older than retention period

func SetupGraphHelper

func SetupGraphHelper(graphapphelper *graphapphelper.GraphAppHelper, emailAddress string)

SetupGraphHelper initializes the Graph helper with authentication and user settings

func SortEmails

func SortEmails()

SortEmails processes all emails in inbox, AddToNews, and News folders

Types

type Email

type Email struct {
	Subject string `json:"subject"`
	From    struct {
		EmailAddress struct {
			Address string `json:"address"`
			Name    string `json:"name"`
		} `json:"emailAddress"`
	} `json:"from"`
	BodyPreview string `json:"bodyPreview"`
}

Email structure for JSON parsing (if needed)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL