IMAP::Shell(3)

πŸ‘‘ NAME πŸ‘‘

Cyrus::IMAP::Shell β€” it's literally the Perl glow-up of cyradm, no cap. That's the whole vibe. This page is IMAP::Shell(3) and bestie, we're about to read it together.


✨ SYNOPSIS ✨

okay so here's how you summon it, the classic way:

$ cyradm [--user authid] [--authz authzid] [--[no]rc] [--systemrc file] [--userrc file] \
> [--port n] [--auth mechanism] [--server] server

but possibly, like, the cooler way:

$ perl -MCyrus::IMAP::Shell -e 'run("myscript")'

or even β€” and I'm gonna hold your hand when I say this β€” not recommended:

use Cyrus::IMAP::Admin::Shell;

run('myscriptname');

πŸ’… DESCRIPTION πŸ’…

So this module implements cyradm in Perl. It's a shell wrapped around Cyrus::IMAP::Admin. Commands show up in both Tcl-compatible forms and GNU-style long option forms β€” we contain multitudes, bestie.

The cyradm utility is a simple command line for doing all the common admin tasks on a Cyrus IMAP server, and it's written in Perl. It's giving "I do it all myself."

The cyradm utility can either be run from a client where it's been installed and connect to the server via IMAP, or it can be run locally via a shell on the server itself. Your choice, main character energy either way.

cyradm understands /bin/sh-style redirection: any command can have its standard or error output redirected, and all sh-style redirections are supported β€” except \<\>. It does not currently understand pipes or backgrounding. So no | shenanigans, no & shenanigans, sorry gorgeous.

If the Term::Readline::Perl or Term::Readline::GNU modules are available, cyradm will use it. Fancy line editing when it can get it. πŸ’–


🌸 COMMAND-LINE ARGUMENTS 🌸

these are your flags, bestie, learn them, love them:

  • --u, --user user β€” authenticate with the username you specified. Say who you are, periodt.
  • --authz user β€” authorize the connection as being that specified username.
  • --norc, --rc β€” (don't) load the configuration files. --norc = skip 'em, --rc = load 'em.
  • --systemrc file β€” use the system configuration file you specified.
  • --userrc file β€” use the user configuration file you specified.
  • --port port β€” connect to the server specified, on the port specified.
  • --auth mechanism β€” use the mechanism specified to authenticate. One of PLAIN, LOGIN, etc.
  • --help β€” show a help message about these command-line options. It's giving helpful.
  • --version β€” display the version of Cyrus IMAP that the current cyradm command is a part of.
  • --server server β€” the server address to connect to.
lowkey the move is: know your flags, respect your flags, and you'll never get stuck at the auth prompt wondering what went wrong 🫢

✨ COMMANDS ✨

πŸ” authenticate

authenticate ["--minssf" N] ["--maxssf" N] ["--mechanisms" list]
["--service" name] ["--tlskey" keyfile] ["--notls"] ["--cafile"
cacertfile] ["--capath" cacertdir] user

Okay bestie, this is how you authenticate to the server. You must already be connected, and Cyrus imapd will refuse to let you re-authenticate once you've authenticated once. So like, one shot, no take-backs. πŸ’…

aliases: "auth", "login"


πŸ“ chdir

chdir directory

Change directory. A pwd builtin is not provided, but the default command action will run pwd from a shell if invoked. So if you're nosy about where you are, just type pwd and the shell's got you. 🐚

aliases: "cd"


πŸ“¬ createmailbox

createmailbox ["--partition" partition] ["--specialuse" specialuse]
mailbox

createmailbox ["--specialuse" specialuse] mailbox partition

Create a mailbox on the default or a specified partition. Both old-style and getopt-style usages are accepted (combining them will produce an error β€” don't be messy). Optionally assign a special use to the mailbox.

New mailboxes inherit the ACL permissions of their parent mailbox, except for top-level mailboxes such as the user's INBOX. Mailboxes that are the user's INBOX are assigned all to the corresponding user. So your inbox is literally all yours, periodt. πŸ‘‘

Example Usage

localhost> :command:`cm user.john`
localhost> :command:`lm`
user.john (\HasNoChildren)
localhost> :command:`lam user.john`
john lrswipkxtecda
Note that in the above example, the "unixhierarchysep" setting in imapd.conf is set to 0. When using the UNIX hierarchy separator, the "/" (forward slash) character would be used as the hierarchy separator, and the example would look as follows:

Example Usage with "unixhierarchysep: 1"

localhost> :command:`cm user/john`
localhost> :command:`lm`
user/john (\HasNoChildren)
localhost> :command:`lam user/john`
john lrswipkxtecda
Note The above examples use the unqualified, shorthand user identifier john as the mailbox name. With the use of virtual domains, controlled through the "virtdomains" setting in imapd.conf(5).

aliases: "cm", "create"


πŸ—‘οΈ deleteaclmailbox

deleteaclmailbox mailbox id [...]

Remove ACLs from the specified mailbox. Bye-bye permissions, hope you didn't need them. πŸ’€

aliases: "delteacl", "dam"


πŸ—‘οΈ deletemailbox

deletemailbox mailbox

Delete the specified mailbox. Poof, gone. ✨

Administrators do not have implicit delete rights on mailboxes. Use the "setaclmailbox" command to grant the "x" permission to your principal if you need to delete a mailbox you do not own. So like, you can't just waltz in and delete stuff, okay? Ask nicely with ACLs.

aliases: "delete", "dm"


πŸ”Œ disconnect

disconnect

Disconnect from the current server. The prompt will revert to "cyradm>". This does not quit cyradm. So you're still in the driver's seat, just unplugged. πŸš—

aliases: "disc"


πŸšͺ exit

exit [number]

Exit "cyradm", optionally with a specific exit status; the exit status of the last command will be used if one is not specified. So you can leave with drama or just slip out quietly. πŸšͺπŸ’¨

aliases: "quit"


❓ help

help [command]

Show help for "command" or all commands. The ? alias is giving main character energy. πŸ™‹β€β™€οΈ

aliases: "?"


🏷️ getmetadata

getmetadata [mailbox]

Display mailbox/server metadata. It's like snooping but, like, authorized. πŸ‘€

aliases: "getmd"


ℹ️ info

info [mailbox]

Display the mailbox/server annotations.


πŸ“‹ listaclmailbox

listaclmailbox mailbox

List ACLs on the specified mailbox. See who can do what. Nosy but useful. πŸ•΅οΈβ€β™€οΈ

aliases: "lam", "listacl"


πŸ“‚ listmailbox

listmailbox ["--subscribed"] ["--specialuse"] [pattern [reference]]

List all, or all subscribed or special-use, mailboxes matching the specified pattern. The pattern may have embedded wildcards '*' or '%', which match anything or anything except the separator character, respectively. So * is the "anything goes" wildcard, and % is the "anything but the separator" wildcard. Slay. 🌟

Mailboxes returned will be relative to the specified reference if one is specified. This allows a mailbox list to be limited to a particular hierarchy. Like zooming in on a specific folder tree. 🌳

In some cases when the '%' wildcard is used to end a pattern, it may match an entry which is not a mailbox but which contains other mailboxes. In this case, the entry will be parenthesized to indicate that it is a root for other mailboxes, as opposed to a mailbox itself. So if you see parentheses, it's a parent, not a mailbox. πŸ’…

aliases: "list", "lm"


πŸ“Š listquota

listquota root

List quotas on specified root. If the specified mailbox path does not have a quota assigned, an error will be raised; see "listquotaroot" for a way to find the quota root for a mailbox. So if you get an error, don't panic, just use listquotaroot. πŸ§˜β€β™€οΈ

aliases: "lq"


πŸ“Š listquotaroot

listquotaroot mailbox

Show quota roots and quotas for mailbox. Quota detective, at your service. πŸ”

aliases: "lqm", "lqr"


βš™οΈ mboxconfig

mboxconfig ["--private"] mailbox attribute value

Set mailbox metadata, optionally set the private instead of the shared version of the metadata. A value of "none" will remove the attribute. So none is the delete button, basically. πŸ—‘οΈ

The currently supported attributes are:

  • "comment" description β€” Sets a comment or description associated with the mailbox.
  • "expire" days β€” Sets the number of days after which messages will be expired from the mailbox.
  • "news2mail" address β€” Sets an email address to which messages injected into the server via NNTP will be sent.
  • "pop3showafter" time β€” Sets a time (in RFC3501 format, for example "6-Jan-2011 11:45:32 +1100") which specifies a cutoff date such that POP3 fetching of the folder does not see messages whose internaldate is before or equal to the date.
  • "sharedseen" true|false β€” Enables the use of a shared \Seen flag on messages rather than a per-user \Seen flag. The 's' right in the mailbox ACL still controls whether a user can set the shared \Seen flag.
  • "sieve" scriptname β€” Indicates the name of the global sieve script that should be run when a message is delivered to the shared mailbox (not used for personal mailboxes).
  • "squat" true|false β€” Indicates that the mailbox should have a squat index created for it.

aliases: "mboxcfg"


πŸ”¨ reconstruct

reconstruct ["-r"] mailbox

Reconstruct the specified mailbox, optionally recursing and reconstructing child mailboxes if the "-r" flag is given. Like a glow-up for your mailbox. πŸ’…

For more information see reconstruct(8).


✏️ renamemailbox

renamemailbox ["--partition" partition] oldname newname

renamemailbox oldname newname [partition]

Rename the specified mailbox, optionally moving it to a different partition. Both old-style and getopt-style usages are accepted; combining them will produce an error. So pick a lane, bestie. πŸ›£οΈ

aliases: "rename", "renm"


πŸ–₯️ server

server

server [--noauthenticate] [server]

With no arguments, show the current server. With an argument, connect to that server. It will prompt for automatic login unless the "--noauthenticate" option is specified. (This may change; in particular, either automatic authentication will be removed or all "authenticate" options will be added.) So stay tuned, I guess. πŸ“‘

When connected to a server, cyradm's prompt changes from "cyradm>" to "servername>", where servername is the fully qualified domain name of the connected server. So your prompt is literally telling you where you are. Iconic. πŸ‘‘

aliases: "connect", "servername"


πŸ” setaclmailbox

setaclmailbox mailbox id rights [id rights ...]

Set ACLs on a mailbox. The ACL may be one of the special strings "none", "read" ("lrs"), "post" ("lrsp"), "append" ("lrsip"), "write" ("lrswipkxte"), "delete" ("lrxte"), or "all" ("lrswipkxte"), or any combinations of the ACL codes:

  • l β€” Lookup (mailbox is visible to LIST/LSUB, SUBSCRIBE mailbox)
  • r β€” Read (SELECT/EXAMINE the mailbox, perform STATUS)
  • s β€” Seen (set/clear \SEEN flag via STORE, also set \SEEN flag during APPEND/COPY/FETCH BODY[...])
  • w β€” Write flags other than \SEEN and \DELETED
  • i β€” Insert (APPEND, COPY destination)
  • p β€” Post (send mail to mailbox)
  • k β€” Create mailbox (CREATE new sub-mailboxes, parent for new mailbox in RENAME)
  • x β€” Delete mailbox (DELETE mailbox, old mailbox name in RENAME)
  • t β€” Delete messages (set/clear \DELETED flag via STORE, also set \DELETED flag during APPEND/COPY)
  • e β€” Perform EXPUNGE and expunge as part of CLOSE
  • a β€” Administer (SETACL/DELETEACL/GETACL/LISTRIGHTS)

aliases: "setacl", "sam"


πŸ“ setinfo

setinfo attribute value

Set server metadata. A value of "none" will remove the attribute. The currently supported attributes are:

  • "motd" message β€” Sets a "message of the day". The message gets displayed as an ALERT upon connection.
  • "comment" note β€” Sets a comment or description associated with the server.
  • "admin" address β€” Sets the administrator email address for the server.
  • "shutdown" message β€” Sets a shutdown message. The message gets displayed as an ALERT and all users are disconnected from the server (subsequent logins are disallowed).
  • "expire" days β€” Sets the number of days after which messages will be expired from the server (unless overridden by a mailbox annotation).
  • "squat" true|false β€” Indicates that all mailboxes should have squat indexes created for them (unless overridden by a mailbox annotation).

🏷️ setmetadata

setmetadata [--private] mailbox [annotation] value

Set metadata on mailbox, where annotation is one of [comment|expire|news2mail|pop3showafter|sharedseen|sieve|specialuse|squat|/<explicit annotation>].

Note that value with a leading backslash must be escaped with an additional backslash. For example:

setmetadata --private Spam specialuse "\\Junk"

Note, too, that "private" annotations are private to the user currently authenticated as, not necessarily the owner of the mailbox. To set annotations for another user you must authorize as that user.

In addition to the use of optional flag --private, one may use a more explicit syntax, prefixing the annotation with /shared/ or /private/ as in this example:

setmetadata Spam /private/specialuse "\\Junk"

aliases: "setmd"


πŸ“Š setquota

setquota root resource value [resource value ...]

Set a quota on the specified root, which may or may not be an actual mailbox. The resources understood by Cyrus are "STORAGE", "MESSAGE", "X-NUM-FOLDERS" and "X-ANNOTATION-STORAGE". The storage units are, as defined in RFC 2087, groups of 1024 octets (i.e. Kilobytes). The value may be the special string "none" which will remove the quota. So none is the "never mind" button. πŸ™…β€β™€οΈ

aliases: "sq"


πŸ”” subscribe

subscribe mailbox

Subscribe to the given mailbox. Join the club. πŸŽ‰


πŸ”• unsubscribe

unsubscribe mailbox

Unsubscribe to the given mailbox. Leave the club. No hard feelings. ✌️


πŸ“Œ version

version

Display the version info of the current server. Know your server's era. πŸ’β€β™€οΈ

aliases: "ver"


🚚 xfermailbox

xfermailbox ["--partition" partition] mailbox server

xfermailbox mailbox server [partition]

Transfer (relocate) the specified mailbox to a different server. Both old-style and getopt-style usages are accepted; combining them will produce an error. So don't mix and match, okay? 🚚✨

aliases: "xfer"

πŸ’­ NOTES πŸ’­

ok so before you go off and start typing, bestie, there's some lore you gotta know 🫢

  • GNU-style long options? they have to be given in their entirety. no shortcuts, no abbreviations, no half-sending the vibe. <hotpink>spell it all the way out.</hotpink>
  • Tcl-style options can be abbreviated. but like… πŸ‘€
  • Tcl-style options are provided as a compatibility feature. They will probably go away in the future. so don't get too attached, they're giving guest-star energy, not main-character.
  • You can stack multiple commands on one line, separated by ; characters. periodt.
  • All commands set an exit status, which at present is not useful. like it's there, it's doing its little thing, we're not using it for anything. 😭
  • Unknown commands are passed to a subshell for execution. so if you type nonsense, the shell gets handed the nonsense. iconic delegation honestly.
  • The Tcl version of cyradm is used for scripting as well as interactively. While this is possible to a limited extent by use of the "run" method, scripting would normally be done with "Cyrus::IMAP::Admin", which is far more flexible than either interactive "cyradm" or the Tcl scripting mechanism for Cyrus. so like β€” yes you can script with it a bit, but there's a whole better tool for that and it's not even close πŸ’…
  • cyradm understands /bin/sh-style redirection: any command can have its standard or error output redirected, with all sh-style redirections (except "<>") supported. It does not currently understand pipes or backgrounding. so <cyan>redirect away, but no |and no&` β€” that's just not in the building yet πŸ™ˆ
  • If the "Term::Readline::Perl" or "Term::Readline::GNU" modules are available, cyradm will use it. fancy line-editing if you've got the goods ✨
  • An alias facility is implemented internally, but no access is currently provided to it. This will change, if only to allow some of the predefined aliases to be removed if they conflict with useful shell commands. so it's there, it's real, you just can't touch it yet. someday πŸ₯²

πŸ‘‘ AUTHOR πŸ‘‘

Brandon S. Allbery, allbery@ece.cmu.edu

give them their flowers, fr fr 🌸


πŸ” SEE ALSO πŸ”

go read those too, iykyk πŸ¦‹


and that's the whole page, bestie!! πŸ’– this one came from perl v5.42.3 and it's dated 2026-09-11 β€” so go forth, cyradm responsibly, and remember: every option, every caveat, every deprecated little Tcl ghost is still in here exactly where it belongs. slay πŸŽ€βœ¨

πŸ“¦ where this page comes from