Skip to content

EmailOS Unsubscribe Command Documentation ​

The mailos unsubscribe command finds and manages unsubscribe links in your email messages, helping you efficiently unsubscribe from unwanted mailing lists.

Basic Usage ​

bash
mailos unsubscribe [flags]

Searches through your emails to find unsubscribe links and provides options to manage them.

Command-Line Flags ​

Basic Options ​

FlagShortTypeDefaultDescriptionExample
--accountstringEmail account to usemailos unsubscribe --account value
--fromstringFind unsubscribe links from sender(s) - comma-separated for batch processingmailos unsubscribe --from value
--number-nint10Number of emails to check per sendermailos unsubscribe --number value
--subjectstringFind unsubscribe links by subjectmailos unsubscribe --subject value

Advanced Options ​

FlagShortTypeDefaultDescriptionExample
--auto-openboolfalseAutomatically open unsubscribe link without promptingmailos unsubscribe --auto-open
--deleteboolfalseDelete emails after finding unsubscribe linksmailos unsubscribe --delete
--move-to-folderboolfalseMove emails with unsubscribe links to dedicated IMAP foldermailos unsubscribe --move-to-folder
--openboolfalseOpen the first unsubscribe link in browsermailos unsubscribe --open
--quiet-qboolfalseMinimal output - only show count of emails foundmailos unsubscribe --quiet

Output Options ​

FlagShortTypeDefaultDescriptionExample
--dry-runboolfalseShow what would be deleted without actually deletingmailos unsubscribe --dry-run
--jsonboolfalseOutput results as JSON for programmatic usemailos unsubscribe --json

Features ​

The command uses multiple detection methods to find unsubscribe links:

  • Header-based: Checks RFC 2369/8058 List-Unsubscribe headers
  • URL patterns: Searches for common unsubscribe URL patterns
  • Link text analysis: Finds links with unsubscribe-related text
  • Service-specific: Recognizes patterns from popular email services (MailChimp, SendGrid, etc.)

Supported Email Services ​

Optimized detection for major email marketing platforms:

  • Beehiiv
  • MailChimp
  • SendGrid
  • ConvertKit
  • Constant Contact
  • Campaign Monitor
  • AWeber
  • GetResponse
  • ActiveCampaign
  • HubSpot
  • Pardot
  • Marketo

Usage Examples ​

bash
# Find unsubscribe links in last 10 emails
mailos unsubscribe

# Check more emails
mailos unsubscribe --number 50
bash
# Find links from specific sender
mailos unsubscribe --from "newsletter@company.com"

# Search by subject pattern
mailos unsubscribe --subject "Weekly Update"

Email Management ​

bash
# Move emails with unsubscribe links to dedicated folder
mailos unsubscribe --move-to-folder

# Automatically open first unsubscribe link found
mailos unsubscribe --auto-open

Combined Operations ​

bash
# Find, organize, and open unsubscribe links
mailos unsubscribe --from "[MARKETING_SENDER]" --move-to-folder --open

Output Format ​

The command provides a detailed report showing:

  • Email sender and subject
  • All unsubscribe links found
  • Count of emails processed

Example output:

Searching for unsubscribe links...

Found unsubscribe links in 3 emails:

1. From: newsletter@example.com
   Subject: Weekly Newsletter - October 2024
   Unsubscribe links:
   - https://example.com/unsubscribe?id=12345
   - https://example.com/preferences?email=user@domain.com

2. From: [MARKETING_SENDER]
   Subject: Special Offer Inside!
   Unsubscribe links:
   - https://store.com/opt-out?token=abcdef

Folder Management ​

When using --move-to-folder, the command:

  • Creates an "Unsubscribe" folder if it doesn't exist
  • Moves all emails containing unsubscribe links to this folder
  • Provides feedback on the number of emails moved

Safety and Privacy ​

  • Read-only scanning: The command only reads email content for analysis
  • No automatic actions: Requires explicit flags for actions like opening links or moving emails
  • User confirmation: Interactive prompts for potentially destructive actions
  • Clean URL extraction: Removes tracking parameters and validates URLs

Integration with Other Commands ​

The unsubscribe command works well with other EmailOS features:

bash
# First search and organize
mailos unsubscribe --move-to-folder

# Then read the organized emails
mailos read --folder "Unsubscribe"

# Generate statistics on unsubscribe patterns
mailos stats --folder "Unsubscribe"

Tips and Best Practices ​

  1. Regular cleanup: Run mailos unsubscribe --move-to-folder regularly to keep your inbox organized
  2. Bulk processing: Use higher --number values for thorough cleanup sessions
  3. Targeted cleanup: Use --from filters when dealing with specific senders
  4. Safe browsing: Review unsubscribe links before opening them, especially from unknown senders

Troubleshooting ​

  • Try increasing --number to check more emails
  • Use --from or --subject filters to target specific emails
  • Some emails may use non-standard unsubscribe methods

Browser Opening Issues ​

  • Ensure your system has a default web browser configured
  • Use --open for interactive confirmation instead of --auto-open
  • Copy and paste links manually if automatic opening fails

IMAP Folder Issues ​

  • Verify your email provider supports IMAP folder creation
  • Check that you have write permissions for your email account
  • Some providers may have folder name restrictions

Released under the MIT License.