Scroll to navigation

CHEWMAIL(1) User Contributed Perl Documentation CHEWMAIL(1)


chewmail - mail archiver


chewmail [OPTIONS] <MAILBOX> ...


chewmail is a program for archiving mail. It is inspired by the by the Python-based archivemail, but with more useful semantics. All mail is archived to the mailbox specified with the --output-box switch, in mbox format. It can read mailboxes in mbox, Maildir and MH formats.

Internally, chewmail uses Mail::Box, so it support file names and URLs supported by that module.


The mailbox to archive messages to. The mailbox is run through the Date::Format module, so it supports all it's conversion specifiers. The date and time is relative to the messages timestamp, or the current time if the timestamp is impossible to determine. A sample of the conversion specifiers follows:

    %%      PERCENT
    %b      month abbr
    %B      month
    %d      numeric day of the month, with leading zeros (eg 01..31)
    %e      numeric day of the month, without leading zeros (eg 1..31)
    %D      MM/DD/YY
    %G      GPS week number (weeks since January 6, 1980)
    %h      month abbr
    %H      hour, 24 hour clock, leading 0's)
    %I      hour, 12 hour clock, leading 0's)
    %j      day of the year
    %k      hour
    %l      hour, 12 hour clock
    %L      month number, starting with 1
    %m      month number, starting with 01
    %n      NEWLINE
    %o      ornate day of month -- "1st", "2nd", "25th", etc.
    %t      TAB
    %U      week number, Sunday as first day of week
    %w      day of the week, numerically, Sunday == 0
    %W      week number, Monday as first day of week
    %x      date format: 11/19/94
    %y      year (2 digits)
    %Y      year (4 digits)
Only archive messages older than than this many days.
Only archive messages old than this date. The date can be any date understood by Perl's Date::Parse module.
Only archive messages that are marked seen or read.
Synchonize the mailboxes after every message is moved. This will be substantially slower but may provide better recovery for some mailbox formats in the event of a crash.
Preserve the atime and mtime of the input mailbox. This only affects file-based mailboxes, such as mbox.
Go through all the motions of archiving the mail, but don't actually change any mailboxes.
Output more informational messages. Use multiple times for more verbosity.
Don't output any messages other than error messages.
Print the version number then exit.
Print usage information then exit.


Archive two day old messages in inbox to inbox-old:

  chewmail --days 2 -o inbox-old inbox

Archive read messages to a mailbox named the year-month of the message:

  chewmail --only-read -o %Y-%m inbox


archivemail(1), Date::Parse, Date::Format, Mail::Box


Eric Dorland <>

2021-01-06 perl v5.32.0