1/*
2Command mox is a modern, secure, full-featured, open source mail server for
3low-maintenance self-hosted email.
4
5Mox is started with the "serve" subcommand, but mox also has many other
6subcommands.
7
8Many of those commands talk to a running mox instance, through the ctl file in
9the data directory. Specify the configuration file (that holds the path to the
10data directory) through the -config flag or MOXCONF environment variable.
11
12Commands that don't talk to a running mox instance are often for
13testing/debugging email functionality. For example for parsing an email message,
14or looking up SPF/DKIM/DMARC records.
15
16Below is the usage information as printed by the command when started without
17any parameters. Followed by the help and usage information for each command.
18
19# Usage
20
21 mox [-config config/mox.conf] [-pedantic] ...
22 mox serve
23 mox quickstart [-skipdial] [-existing-webserver] [-hostname host] user@domain [user | uid]
24 mox stop
25 mox setaccountpassword account
26 mox setadminpassword
27 mox loglevels [level [pkg]]
28 mox queue holdrules list
29 mox queue holdrules add [ruleflags]
30 mox queue holdrules remove ruleid
31 mox queue list [filtersortflags]
32 mox queue hold [filterflags]
33 mox queue unhold [filterflags]
34 mox queue schedule [filterflags] [-now] duration
35 mox queue transport [filterflags] transport
36 mox queue requiretls [filterflags] {yes | no | default}
37 mox queue fail [filterflags]
38 mox queue drop [filterflags]
39 mox queue dump id
40 mox queue retired list [filtersortflags]
41 mox queue retired print id
42 mox queue suppress list [-account account]
43 mox queue suppress add account address
44 mox queue suppress remove account address
45 mox queue suppress lookup [-account account] address
46 mox queue webhook list [filtersortflags]
47 mox queue webhook schedule [filterflags] duration
48 mox queue webhook cancel [filterflags]
49 mox queue webhook print id
50 mox queue webhook retired list [filtersortflags]
51 mox queue webhook retired print id
52 mox import maildir accountname mailboxname maildir
53 mox import mbox accountname mailboxname mbox
54 mox export maildir [-single] dst-dir account-path [mailbox]
55 mox export mbox [-single] dst-dir account-path [mailbox]
56 mox localserve
57 mox help [command ...]
58 mox backup dest-dir
59 mox verifydata data-dir
60 mox config test
61 mox config dnscheck domain
62 mox config dnsrecords domain
63 mox config describe-domains >domains.conf
64 mox config describe-static >mox.conf
65 mox config account add account address
66 mox config account rm account
67 mox config address add address account
68 mox config address rm address
69 mox config domain add domain account [localpart]
70 mox config domain rm domain
71 mox config alias list domain
72 mox config alias print alias
73 mox config alias add alias@domain rcpt1@domain ...
74 mox config alias update alias@domain [-postpublic false|true -listmembers false|true -allowmsgfrom false|true]
75 mox config alias rm alias@domain
76 mox config alias addaddr alias@domain rcpt1@domain ...
77 mox config alias rmaddr alias@domain rcpt1@domain ...
78 mox config describe-sendmail >/etc/moxsubmit.conf
79 mox config printservice >mox.service
80 mox config ensureacmehostprivatekeys
81 mox config example [name]
82 mox checkupdate
83 mox cid cid
84 mox clientconfig domain
85 mox dane dial host:port
86 mox dane dialmx domain [destination-host]
87 mox dane makerecord usage selector matchtype [certificate.pem | publickey.pem | privatekey.pem]
88 mox dns lookup [ptr | mx | cname | ips | a | aaaa | ns | txt | srv | tlsa] name
89 mox dkim gened25519 >$selector._domainkey.$domain.ed25519.privatekey.pkcs8.pem
90 mox dkim genrsa >$selector._domainkey.$domain.rsa2048.privatekey.pkcs8.pem
91 mox dkim lookup selector domain
92 mox dkim txt <$selector._domainkey.$domain.key.pkcs8.pem
93 mox dkim verify message
94 mox dkim sign message
95 mox dmarc lookup domain
96 mox dmarc parsereportmsg message ...
97 mox dmarc verify remoteip mailfromaddress helodomain < message
98 mox dmarc checkreportaddrs domain
99 mox dnsbl check zone ip
100 mox dnsbl checkhealth zone
101 mox mtasts lookup domain
102 mox retrain accountname
103 mox sendmail [-Fname] [ignoredflags] [-t] [<message]
104 mox spf check domain ip
105 mox spf lookup domain
106 mox spf parse txtrecord
107 mox tlsrpt lookup domain
108 mox tlsrpt parsereportmsg message ...
109 mox version
110 mox webapi [method [baseurl-with-credentials]
111 mox example [name]
112 mox bumpuidvalidity account [mailbox]
113 mox reassignuids account [mailboxid]
114 mox fixuidmeta account
115 mox fixmsgsize [account]
116 mox reparse [account]
117 mox ensureparsed account
118 mox recalculatemailboxcounts account
119 mox message parse message.eml
120 mox reassignthreads [account]
121
122# mox serve
123
124Start mox, serving SMTP/IMAP/HTTPS.
125
126Incoming email is accepted over SMTP. Email can be retrieved by users using
127IMAP. HTTP listeners are started for the admin/account web interfaces, and for
128automated TLS configuration. Missing essential TLS certificates are immediately
129requested, other TLS certificates are requested on demand.
130
131Only implemented on unix systems, not Windows.
132
133 usage: mox serve
134
135# mox quickstart
136
137Quickstart generates configuration files and prints instructions to quickly set up a mox instance.
138
139Quickstart writes configuration files, prints initial admin and account
140passwords, DNS records you should create. If you run it on Linux it writes a
141systemd service file and prints commands to enable and start mox as service.
142
143The user or uid is optional, defaults to "mox", and is the user or uid/gid mox
144will run as after initialization.
145
146Quickstart assumes mox will run on the machine you run quickstart on and uses
147its host name and public IPs. On many systems the hostname is not a fully
148qualified domain name, but only the first dns "label", e.g. "mail" in case of
149"mail.example.org". If so, quickstart does a reverse DNS lookup to find the
150hostname, and as fallback uses the label plus the domain of the email address
151you specified. Use flag -hostname to explicitly specify the hostname mox will
152run on.
153
154Mox is by far easiest to operate if you let it listen on port 443 (HTTPS) and
15580 (HTTP). TLS will be fully automatic with ACME with Let's Encrypt.
156
157You can run mox along with an existing webserver, but because of MTA-STS and
158autoconfig, you'll need to forward HTTPS traffic for two domains to mox. Run
159"mox quickstart -existing-webserver ..." to generate configuration files and
160instructions for configuring mox along with an existing webserver.
161
162But please first consider configuring mox on port 443. It can itself serve
163domains with HTTP/HTTPS, including with automatic TLS with ACME, is easily
164configured through both configuration files and admin web interface, and can act
165as a reverse proxy (and static file server for that matter), so you can forward
166traffic to your existing backend applications. Look for "WebHandlers:" in the
167output of "mox config describe-domains" and see the output of
168"mox config example webhandlers".
169
170 usage: mox quickstart [-skipdial] [-existing-webserver] [-hostname host] user@domain [user | uid]
171 -existing-webserver
172 use if a webserver is already running, so mox won't listen on port 80 and 443; you'll have to provide tls certificates/keys, and configure the existing webserver as reverse proxy, forwarding requests to mox.
173 -hostname string
174 hostname mox will run on, by default the hostname of the machine quickstart runs on; if specified, the IPs for the hostname are configured for the public listener
175 -skipdial
176 skip check for outgoing smtp (port 25) connectivity
177
178# mox stop
179
180Shut mox down, giving connections maximum 3 seconds to stop before closing them.
181
182While shutting down, new IMAP and SMTP connections will get a status response
183indicating temporary unavailability. Existing connections will get a 3 second
184period to finish their transaction and shut down. Under normal circumstances,
185only IMAP has long-living connections, with the IDLE command to get notified of
186new mail deliveries.
187
188 usage: mox stop
189
190# mox setaccountpassword
191
192Set new password an account.
193
194The password is read from stdin. Secrets derived from the password, but not the
195password itself, are stored in the account database. The stored secrets are for
196authentication with: scram-sha-256, scram-sha-1, cram-md5, plain text (bcrypt
197hash).
198
199The parameter is an account name, as configured under Accounts in domains.conf
200and as present in the data/accounts/ directory, not a configured email address
201for an account.
202
203 usage: mox setaccountpassword account
204
205# mox setadminpassword
206
207Set a new admin password, for the web interface.
208
209The password is read from stdin. Its bcrypt hash is stored in a file named
210"adminpasswd" in the configuration directory.
211
212 usage: mox setadminpassword
213
214# mox loglevels
215
216Print the log levels, or set a new default log level, or a level for the given package.
217
218By default, a single log level applies to all logging in mox. But for each
219"pkg", an overriding log level can be configured. Examples of packages:
220smtpserver, smtpclient, queue, imapserver, spf, dkim, dmarc, junk, message,
221etc.
222
223Specify a pkg and an empty level to clear the configured level for a package.
224
225Valid labels: error, info, debug, trace, traceauth, tracedata.
226
227 usage: mox loglevels [level [pkg]]
228
229# mox queue holdrules list
230
231List hold rules for the delivery queue.
232
233Messages submitted to the queue that match a hold rule will be marked as on hold
234and not scheduled for delivery.
235
236 usage: mox queue holdrules list
237
238# mox queue holdrules add
239
240Add hold rule for the delivery queue.
241
242Add a hold rule to mark matching newly submitted messages as on hold. Set the
243matching rules with the flags. Don't specify any flags to match all submitted
244messages.
245
246 usage: mox queue holdrules add [ruleflags]
247 -account string
248 account submitting the message
249 -recipientdom string
250 recipient domain
251 -senderdom string
252 sender domain
253
254# mox queue holdrules remove
255
256Remove hold rule for the delivery queue.
257
258Remove a hold rule by its id.
259
260 usage: mox queue holdrules remove ruleid
261
262# mox queue list
263
264List matching messages in the delivery queue.
265
266Prints the message with its ID, last and next delivery attempts, last error.
267
268 usage: mox queue list [filtersortflags]
269 -account string
270 account that queued the message
271 -asc
272 sort ascending instead of descending (default)
273 -from string
274 from address of message, use "@example.com" to match all messages for a domain
275 -hold value
276 true or false, whether to match only messages that are (not) on hold
277 -ids value
278 comma-separated list of message IDs
279 -n int
280 number of messages to return
281 -nextattempt string
282 filter by time of next delivery attempt relative to now, value must start with "<" (before now) or ">" (after now)
283 -sort value
284 field to sort by, "nextattempt" (default) or "queued"
285 -submitted string
286 filter by time of submission relative to now, value must start with "<" (before now) or ">" (after now)
287 -to string
288 recipient address of message, use "@example.com" to match all messages for a domain
289 -transport value
290 transport to use for messages, empty string sets the default behaviour
291
292# mox queue hold
293
294Mark matching messages on hold.
295
296Messages that are on hold are not delivered until marked as off hold again, or
297otherwise handled by the admin.
298
299 usage: mox queue hold [filterflags]
300 -account string
301 account that queued the message
302 -from string
303 from address of message, use "@example.com" to match all messages for a domain
304 -hold value
305 true or false, whether to match only messages that are (not) on hold
306 -ids value
307 comma-separated list of message IDs
308 -n int
309 number of messages to return
310 -nextattempt string
311 filter by time of next delivery attempt relative to now, value must start with "<" (before now) or ">" (after now)
312 -submitted string
313 filter by time of submission relative to now, value must start with "<" (before now) or ">" (after now)
314 -to string
315 recipient address of message, use "@example.com" to match all messages for a domain
316 -transport value
317 transport to use for messages, empty string sets the default behaviour
318
319# mox queue unhold
320
321Mark matching messages off hold.
322
323Once off hold, messages can be delivered according to their current next
324delivery attempt. See the "queue schedule" command.
325
326 usage: mox queue unhold [filterflags]
327 -account string
328 account that queued the message
329 -from string
330 from address of message, use "@example.com" to match all messages for a domain
331 -hold value
332 true or false, whether to match only messages that are (not) on hold
333 -ids value
334 comma-separated list of message IDs
335 -n int
336 number of messages to return
337 -nextattempt string
338 filter by time of next delivery attempt relative to now, value must start with "<" (before now) or ">" (after now)
339 -submitted string
340 filter by time of submission relative to now, value must start with "<" (before now) or ">" (after now)
341 -to string
342 recipient address of message, use "@example.com" to match all messages for a domain
343 -transport value
344 transport to use for messages, empty string sets the default behaviour
345
346# mox queue schedule
347
348Change next delivery attempt for matching messages.
349
350The next delivery attempt is adjusted by the duration parameter. If the -now
351flag is set, the new delivery attempt is set to the duration added to the
352current time, instead of added to the current scheduled time.
353
354Schedule immediate delivery with "mox queue schedule -now 0".
355
356 usage: mox queue schedule [filterflags] [-now] duration
357 -account string
358 account that queued the message
359 -from string
360 from address of message, use "@example.com" to match all messages for a domain
361 -hold value
362 true or false, whether to match only messages that are (not) on hold
363 -ids value
364 comma-separated list of message IDs
365 -n int
366 number of messages to return
367 -nextattempt string
368 filter by time of next delivery attempt relative to now, value must start with "<" (before now) or ">" (after now)
369 -now
370 schedule for duration relative to current time instead of relative to current next delivery attempt for messages
371 -submitted string
372 filter by time of submission relative to now, value must start with "<" (before now) or ">" (after now)
373 -to string
374 recipient address of message, use "@example.com" to match all messages for a domain
375 -transport value
376 transport to use for messages, empty string sets the default behaviour
377
378# mox queue transport
379
380Set transport for matching messages.
381
382By default, the routing rules determine how a message is delivered. The default
383and common case is direct delivery with SMTP. Messages can get a previously
384configured transport assigned to use for delivery, e.g. using submission to
385another mail server or with connections over a SOCKS proxy.
386
387 usage: mox queue transport [filterflags] transport
388 -account string
389 account that queued the message
390 -from string
391 from address of message, use "@example.com" to match all messages for a domain
392 -hold value
393 true or false, whether to match only messages that are (not) on hold
394 -ids value
395 comma-separated list of message IDs
396 -n int
397 number of messages to return
398 -nextattempt string
399 filter by time of next delivery attempt relative to now, value must start with "<" (before now) or ">" (after now)
400 -submitted string
401 filter by time of submission relative to now, value must start with "<" (before now) or ">" (after now)
402 -to string
403 recipient address of message, use "@example.com" to match all messages for a domain
404 -transport value
405 transport to use for messages, empty string sets the default behaviour
406
407# mox queue requiretls
408
409Set TLS requirements for delivery of matching messages.
410
411Value "yes" is handled as if the RequireTLS extension was specified during
412submission.
413
414Value "no" is handled as if the message has a header "TLS-Required: No". This
415header is not added by the queue. If messages without this header are relayed
416through other mail servers they will apply their own default TLS policy.
417
418Value "default" is the default behaviour, currently for unverified opportunistic
419TLS.
420
421 usage: mox queue requiretls [filterflags] {yes | no | default}
422 -account string
423 account that queued the message
424 -from string
425 from address of message, use "@example.com" to match all messages for a domain
426 -hold value
427 true or false, whether to match only messages that are (not) on hold
428 -ids value
429 comma-separated list of message IDs
430 -n int
431 number of messages to return
432 -nextattempt string
433 filter by time of next delivery attempt relative to now, value must start with "<" (before now) or ">" (after now)
434 -submitted string
435 filter by time of submission relative to now, value must start with "<" (before now) or ">" (after now)
436 -to string
437 recipient address of message, use "@example.com" to match all messages for a domain
438 -transport value
439 transport to use for messages, empty string sets the default behaviour
440
441# mox queue fail
442
443Fail delivery of matching messages, delivering DSNs.
444
445Failing a message is handled similar to how delivery is given up after all
446delivery attempts failed. The DSN (delivery status notification) message
447contains a line saying the message was canceled by the admin.
448
449 usage: mox queue fail [filterflags]
450 -account string
451 account that queued the message
452 -from string
453 from address of message, use "@example.com" to match all messages for a domain
454 -hold value
455 true or false, whether to match only messages that are (not) on hold
456 -ids value
457 comma-separated list of message IDs
458 -n int
459 number of messages to return
460 -nextattempt string
461 filter by time of next delivery attempt relative to now, value must start with "<" (before now) or ">" (after now)
462 -submitted string
463 filter by time of submission relative to now, value must start with "<" (before now) or ">" (after now)
464 -to string
465 recipient address of message, use "@example.com" to match all messages for a domain
466 -transport value
467 transport to use for messages, empty string sets the default behaviour
468
469# mox queue drop
470
471Remove matching messages from the queue.
472
473Dangerous operation, this completely removes the message. If you want to store
474the message, use "queue dump" before removing.
475
476 usage: mox queue drop [filterflags]
477 -account string
478 account that queued the message
479 -from string
480 from address of message, use "@example.com" to match all messages for a domain
481 -hold value
482 true or false, whether to match only messages that are (not) on hold
483 -ids value
484 comma-separated list of message IDs
485 -n int
486 number of messages to return
487 -nextattempt string
488 filter by time of next delivery attempt relative to now, value must start with "<" (before now) or ">" (after now)
489 -submitted string
490 filter by time of submission relative to now, value must start with "<" (before now) or ">" (after now)
491 -to string
492 recipient address of message, use "@example.com" to match all messages for a domain
493 -transport value
494 transport to use for messages, empty string sets the default behaviour
495
496# mox queue dump
497
498Dump a message from the queue.
499
500The message is printed to stdout and is in standard internet mail format.
501
502 usage: mox queue dump id
503
504# mox queue retired list
505
506List matching messages in the retired queue.
507
508Prints messages with their ID and results.
509
510 usage: mox queue retired list [filtersortflags]
511 -account string
512 account that queued the message
513 -asc
514 sort ascending instead of descending (default)
515 -from string
516 from address of message, use "@example.com" to match all messages for a domain
517 -ids value
518 comma-separated list of retired message IDs
519 -lastactivity string
520 filter by time of last activity relative to now, value must start with "<" (before now) or ">" (after now)
521 -n int
522 number of messages to return
523 -result value
524 "success" or "failure" as result of delivery
525 -sort value
526 field to sort by, "lastactivity" (default) or "queued"
527 -submitted string
528 filter by time of submission relative to now, value must start with "<" (before now) or ">" (after now)
529 -to string
530 recipient address of message, use "@example.com" to match all messages for a domain
531 -transport value
532 transport to use for messages, empty string sets the default behaviour
533
534# mox queue retired print
535
536Print a message from the retired queue.
537
538Prints a JSON representation of the information from the retired queue.
539
540 usage: mox queue retired print id
541
542# mox queue suppress list
543
544Print addresses in suppression list.
545
546 usage: mox queue suppress list [-account account]
547 -account string
548 only show suppression list for this account
549
550# mox queue suppress add
551
552Add address to suppression list for account.
553
554 usage: mox queue suppress add account address
555
556# mox queue suppress remove
557
558Remove address from suppression list for account.
559
560 usage: mox queue suppress remove account address
561
562# mox queue suppress lookup
563
564Check if address is present in suppression list, for any or specific account.
565
566 usage: mox queue suppress lookup [-account account] address
567 -account string
568 only check address in specified account
569
570# mox queue webhook list
571
572List matching webhooks in the queue.
573
574Prints list of webhooks, their IDs and basic information.
575
576 usage: mox queue webhook list [filtersortflags]
577 -account string
578 account that queued the message/webhook
579 -asc
580 sort ascending instead of descending (default)
581 -event value
582 event this webhook is about: incoming, delivered, suppressed, delayed, failed, relayed, expanded, canceled, unrecognized
583 -ids value
584 comma-separated list of webhook IDs
585 -n int
586 number of webhooks to return
587 -nextattempt string
588 filter by time of next delivery attempt relative to now, value must start with "<" (before now) or ">" (after now)
589 -sort value
590 field to sort by, "nextattempt" (default) or "queued"
591 -submitted string
592 filter by time of submission relative to now, value must start with "<" (before now) or ">" (after now)
593
594# mox queue webhook schedule
595
596Change next delivery attempt for matching webhooks.
597
598The next delivery attempt is adjusted by the duration parameter. If the -now
599flag is set, the new delivery attempt is set to the duration added to the
600current time, instead of added to the current scheduled time.
601
602Schedule immediate delivery with "mox queue schedule -now 0".
603
604 usage: mox queue webhook schedule [filterflags] duration
605 -account string
606 account that queued the message/webhook
607 -event value
608 event this webhook is about: incoming, delivered, suppressed, delayed, failed, relayed, expanded, canceled, unrecognized
609 -ids value
610 comma-separated list of webhook IDs
611 -n int
612 number of webhooks to return
613 -nextattempt string
614 filter by time of next delivery attempt relative to now, value must start with "<" (before now) or ">" (after now)
615 -now
616 schedule for duration relative to current time instead of relative to current next delivery attempt for webhooks
617 -submitted string
618 filter by time of submission relative to now, value must start with "<" (before now) or ">" (after now)
619
620# mox queue webhook cancel
621
622Fail delivery of matching webhooks.
623
624 usage: mox queue webhook cancel [filterflags]
625 -account string
626 account that queued the message/webhook
627 -event value
628 event this webhook is about: incoming, delivered, suppressed, delayed, failed, relayed, expanded, canceled, unrecognized
629 -ids value
630 comma-separated list of webhook IDs
631 -n int
632 number of webhooks to return
633 -nextattempt string
634 filter by time of next delivery attempt relative to now, value must start with "<" (before now) or ">" (after now)
635 -submitted string
636 filter by time of submission relative to now, value must start with "<" (before now) or ">" (after now)
637
638# mox queue webhook print
639
640Print details of a webhook from the queue.
641
642The webhook is printed to stdout as JSON.
643
644 usage: mox queue webhook print id
645
646# mox queue webhook retired list
647
648List matching webhooks in the retired queue.
649
650Prints list of retired webhooks, their IDs and basic information.
651
652 usage: mox queue webhook retired list [filtersortflags]
653 -account string
654 account that queued the message/webhook
655 -asc
656 sort ascending instead of descending (default)
657 -event value
658 event this webhook is about: incoming, delivered, suppressed, delayed, failed, relayed, expanded, canceled, unrecognized
659 -ids value
660 comma-separated list of retired webhook IDs
661 -lastactivity string
662 filter by time of last activity relative to now, value must start with "<" (before now) or ">" (after now)
663 -n int
664 number of webhooks to return
665 -sort value
666 field to sort by, "lastactivity" (default) or "queued"
667 -submitted string
668 filter by time of submission relative to now, value must start with "<" (before now) or ">" (after now)
669
670# mox queue webhook retired print
671
672Print details of a webhook from the retired queue.
673
674The retired webhook is printed to stdout as JSON.
675
676 usage: mox queue webhook retired print id
677
678# mox import maildir
679
680Import a maildir into an account.
681
682The mbox/maildir archive is accessed and imported by the running mox process, so
683it must have access to the archive files. The default suggested systemd service
684file isolates mox from most of the file system, with only the "data/" directory
685accessible, so you may want to put the mbox/maildir archive files in a
686directory like "data/import/" to make it available to mox.
687
688By default, messages will train the junk filter based on their flags and, if
689"automatic junk flags" configuration is set, based on mailbox naming.
690
691If the destination mailbox is the Sent mailbox, the recipients of the messages
692are added to the message metadata, causing later incoming messages from these
693recipients to be accepted, unless other reputation signals prevent that.
694
695Users can also import mailboxes/messages through the account web page by
696uploading a zip or tgz file with mbox and/or maildirs.
697
698Messages are imported even if already present. Importing messages twice will
699result in duplicate messages.
700
701Mailbox flags, like "seen", "answered", will be imported. An optional
702dovecot-keywords file can specify additional flags, like Forwarded/Junk/NotJunk.
703
704 usage: mox import maildir accountname mailboxname maildir
705
706# mox import mbox
707
708Import an mbox into an account.
709
710Using mbox is not recommended, maildir is a better defined format.
711
712The mbox/maildir archive is accessed and imported by the running mox process, so
713it must have access to the archive files. The default suggested systemd service
714file isolates mox from most of the file system, with only the "data/" directory
715accessible, so you may want to put the mbox/maildir archive files in a
716directory like "data/import/" to make it available to mox.
717
718By default, messages will train the junk filter based on their flags and, if
719"automatic junk flags" configuration is set, based on mailbox naming.
720
721If the destination mailbox is the Sent mailbox, the recipients of the messages
722are added to the message metadata, causing later incoming messages from these
723recipients to be accepted, unless other reputation signals prevent that.
724
725Users can also import mailboxes/messages through the account web page by
726uploading a zip or tgz file with mbox and/or maildirs.
727
728Messages are imported even if already present. Importing messages twice will
729result in duplicate messages.
730
731 usage: mox import mbox accountname mailboxname mbox
732
733# mox export maildir
734
735Export one or all mailboxes from an account in maildir format.
736
737Export bypasses a running mox instance. It opens the account mailbox/message
738database file directly. This may block if a running mox instance also has the
739database open, e.g. for IMAP connections. To export from a running instance, use
740the accounts web page or webmail.
741
742 usage: mox export maildir [-single] dst-dir account-path [mailbox]
743 -single
744 export single mailbox, without any children. disabled if mailbox isn't specified.
745
746# mox export mbox
747
748Export messages from one or all mailboxes in an account in mbox format.
749
750Using mbox is not recommended. Maildir is a better format.
751
752Export bypasses a running mox instance. It opens the account mailbox/message
753database file directly. This may block if a running mox instance also has the
754database open, e.g. for IMAP connections. To export from a running instance, use
755the accounts web page or webmail.
756
757For mbox export, "mboxrd" is used where message lines starting with the magic
758"From " string are escaped by prepending a >. All ">*From " are escaped,
759otherwise reconstructing the original could lose a ">".
760
761 usage: mox export mbox [-single] dst-dir account-path [mailbox]
762 -single
763 export single mailbox, without any children. disabled if mailbox isn't specified.
764
765# mox localserve
766
767Start a local SMTP/IMAP server that accepts all messages, useful when testing/developing software that sends email.
768
769Localserve starts mox with a configuration suitable for local email-related
770software development/testing. It listens for SMTP/Submission(s), IMAP(s) and
771HTTP(s), on the regular port numbers + 1000.
772
773Data is stored in the system user's configuration directory under
774"mox-localserve", e.g. $HOME/.config/mox-localserve/ on linux, but can be
775overridden with the -dir flag. If the directory does not yet exist, it is
776automatically initialized with configuration files, an account with email
777address mox@localhost and password moxmoxmox, and a newly generated self-signed
778TLS certificate.
779
780Incoming messages are delivered as normal, falling back to accepting and
781delivering to the mox account for unknown addresses.
782Submitted messages are added to the queue, which delivers by ignoring the
783destination servers, always connecting to itself instead.
784
785Recipient addresses with the following localpart suffixes are handled specially:
786
787- "temperror": fail with a temporary error code
788- "permerror": fail with a permanent error code
789- [45][0-9][0-9]: fail with the specific error code
790- "timeout": no response (for an hour)
791
792If the localpart begins with "mailfrom" or "rcptto", the error is returned
793during those commands instead of during "data".
794
795 usage: mox localserve
796 -dir string
797 configuration storage directory (default "$userconfigdir/mox-localserve")
798 -initonly
799 write configuration files and exit
800 -ip string
801 serve on this ip instead of default 127.0.0.1 and ::1. only used when writing configuration, at first launch.
802
803# mox help
804
805Prints help about matching commands.
806
807If multiple commands match, they are listed along with the first line of their help text.
808If a single command matches, its usage and full help text is printed.
809
810 usage: mox help [command ...]
811
812# mox backup
813
814Creates a backup of the data directory.
815
816Backup creates consistent snapshots of the databases and message files and
817copies other files in the data directory. Empty directories are not copied.
818These files can then be stored elsewhere for long-term storage, or used to fall
819back to should an upgrade fail. Simply copying files in the data directory
820while mox is running can result in unusable database files.
821
822Message files never change (they are read-only, though can be removed) and are
823hard-linked so they don't consume additional space. If hardlinking fails, for
824example when the backup destination directory is on a different file system, a
825regular copy is made. Using a destination directory like "data/tmp/backup"
826increases the odds hardlinking succeeds: the default systemd service file
827specifically mounts the data directory, causing attempts to hardlink outside it
828to fail with an error about cross-device linking.
829
830All files in the data directory that aren't recognized (i.e. other than known
831database files, message files, an acme directory, the "tmp" directory, etc),
832are stored, but with a warning.
833
834Remove files in the destination directory before doing another backup. The
835backup command will not overwrite files, but print and return errors.
836
837Exit code 0 indicates the backup was successful. A clean successful backup does
838not print any output, but may print warnings. Use the -verbose flag for
839details, including timing.
840
841To restore a backup, first shut down mox, move away the old data directory and
842move an earlier backed up directory in its place, run "mox verifydata",
843possibly with the "-fix" option, and restart mox. After the restore, you may
844also want to run "mox bumpuidvalidity" for each account for which messages in a
845mailbox changed, to force IMAP clients to synchronize mailbox state.
846
847Before upgrading, to check if the upgrade will likely succeed, first make a
848backup, then use the new mox binary to run "mox verifydata" on the backup. This
849can change the backup files (e.g. upgrade database files, move away
850unrecognized message files), so you should make a new backup before actually
851upgrading.
852
853 usage: mox backup dest-dir
854 -verbose
855 print progress
856
857# mox verifydata
858
859Verify the contents of a data directory, typically of a backup.
860
861Verifydata checks all database files to see if they are valid BoltDB/bstore
862databases. It checks that all messages in the database have a corresponding
863on-disk message file and there are no unrecognized files. If option -fix is
864specified, unrecognized message files are moved away. This may be needed after
865a restore, because messages enqueued or delivered in the future may get those
866message sequence numbers assigned and writing the message file would fail.
867Consistency of message/mailbox UID, UIDNEXT and UIDVALIDITY is verified as
868well.
869
870Because verifydata opens the database files, schema upgrades may automatically
871be applied. This can happen if you use a new mox release. It is useful to run
872"mox verifydata" with a new binary before attempting an upgrade, but only on a
873copy of the database files, as made with "mox backup". Before upgrading, make a
874new backup again since "mox verifydata" may have upgraded the database files,
875possibly making them potentially no longer readable by the previous version.
876
877 usage: mox verifydata data-dir
878 -fix
879 fix fixable problems, such as moving away message files not referenced by their database
880 -skip-size-check
881 skip the check for message size
882
883# mox config test
884
885Parses and validates the configuration files.
886
887If valid, the command exits with status 0. If not valid, all errors encountered
888are printed.
889
890 usage: mox config test
891
892# mox config dnscheck
893
894Check the DNS records with the configuration for the domain, and print any errors/warnings.
895
896 usage: mox config dnscheck domain
897
898# mox config dnsrecords
899
900Prints annotated DNS records as zone file that should be created for the domain.
901
902The zone file can be imported into existing DNS software. You should review the
903DNS records, especially if your domain previously/currently has email
904configured.
905
906 usage: mox config dnsrecords domain
907
908# mox config describe-domains
909
910Prints an annotated empty configuration for use as domains.conf.
911
912The domains configuration file contains the domains and their configuration,
913and accounts and their configuration. This includes the configured email
914addresses. The mox admin web interface, and the mox command line interface, can
915make changes to this file. Mox automatically reloads this file when it changes.
916
917Like the static configuration, the example domains.conf printed by this command
918needs modifications to make it valid.
919
920 usage: mox config describe-domains >domains.conf
921
922# mox config describe-static
923
924Prints an annotated empty configuration for use as mox.conf.
925
926The static configuration file cannot be reloaded while mox is running. Mox has
927to be restarted for changes to the static configuration file to take effect.
928
929This configuration file needs modifications to make it valid. For example, it
930may contain unfinished list items.
931
932 usage: mox config describe-static >mox.conf
933
934# mox config account add
935
936Add an account with an email address and reload the configuration.
937
938Email can be delivered to this address/account. A password has to be configured
939explicitly, see the setaccountpassword command.
940
941 usage: mox config account add account address
942
943# mox config account rm
944
945Remove an account and reload the configuration.
946
947Email addresses for this account will also be removed, and incoming email for
948these addresses will be rejected.
949
950All data for the account will be removed.
951
952 usage: mox config account rm account
953
954# mox config address add
955
956Adds an address to an account and reloads the configuration.
957
958If address starts with a @ (i.e. a missing localpart), this is a catchall
959address for the domain.
960
961 usage: mox config address add address account
962
963# mox config address rm
964
965Remove an address and reload the configuration.
966
967Incoming email for this address will be rejected after removing an address.
968
969 usage: mox config address rm address
970
971# mox config domain add
972
973Adds a new domain to the configuration and reloads the configuration.
974
975The account is used for the postmaster mailboxes the domain, including as DMARC and
976TLS reporting. Localpart is the "username" at the domain for this account. If
977must be set if and only if account does not yet exist.
978
979 usage: mox config domain add domain account [localpart]
980
981# mox config domain rm
982
983Remove a domain from the configuration and reload the configuration.
984
985This is a dangerous operation. Incoming email delivery for this domain will be
986rejected.
987
988 usage: mox config domain rm domain
989
990# mox config alias list
991
992List aliases for domain.
993
994 usage: mox config alias list domain
995
996# mox config alias print
997
998Print settings and members of alias.
999
1000 usage: mox config alias print alias
1001
1002# mox config alias add
1003
1004Add new alias with one or more addresses.
1005
1006 usage: mox config alias add alias@domain rcpt1@domain ...
1007
1008# mox config alias update
1009
1010Update alias configuration.
1011
1012 usage: mox config alias update alias@domain [-postpublic false|true -listmembers false|true -allowmsgfrom false|true]
1013 -allowmsgfrom string
1014 whether alias address can be used in message from header
1015 -listmembers string
1016 whether list members can list members
1017 -postpublic string
1018 whether anyone or only list members can post
1019
1020# mox config alias rm
1021
1022Remove alias.
1023
1024 usage: mox config alias rm alias@domain
1025
1026# mox config alias addaddr
1027
1028Add addresses to alias.
1029
1030 usage: mox config alias addaddr alias@domain rcpt1@domain ...
1031
1032# mox config alias rmaddr
1033
1034Remove addresses from alias.
1035
1036 usage: mox config alias rmaddr alias@domain rcpt1@domain ...
1037
1038# mox config describe-sendmail
1039
1040Describe configuration for mox when invoked as sendmail.
1041
1042 usage: mox config describe-sendmail >/etc/moxsubmit.conf
1043
1044# mox config printservice
1045
1046Prints a systemd unit service file for mox.
1047
1048This is the same file as generated using quickstart. If the systemd service file
1049has changed with a newer version of mox, use this command to generate an up to
1050date version.
1051
1052 usage: mox config printservice >mox.service
1053
1054# mox config ensureacmehostprivatekeys
1055
1056Ensure host private keys exist for TLS listeners with ACME.
1057
1058In mox.conf, each listener can have TLS configured. Long-lived private key files
1059can be specified, which will be used when requesting ACME certificates.
1060Configuring these private keys makes it feasible to publish DANE TLSA records
1061for the corresponding public keys in DNS, protected with DNSSEC, allowing TLS
1062certificate verification without depending on a list of Certificate Authorities
1063(CAs). Previous versions of mox did not pre-generate private keys for use with
1064ACME certificates, but would generate private keys on-demand. By explicitly
1065configuring private keys, they will not change automatedly with new
1066certificates, and the DNS TLSA records stay valid.
1067
1068This command looks for listeners in mox.conf with TLS with ACME configured. For
1069each missing host private key (of type rsa-2048 and ecdsa-p256) a key is written
1070to config/hostkeys/. If a certificate exists in the ACME "cache", its private
1071key is copied. Otherwise a new private key is generated. Snippets for manually
1072updating/editing mox.conf are printed.
1073
1074After running this command, and updating mox.conf, run "mox config dnsrecords"
1075for a domain and create the TLSA DNS records it suggests to enable DANE.
1076
1077 usage: mox config ensureacmehostprivatekeys
1078
1079# mox config example
1080
1081List available config examples, or print a specific example.
1082
1083 usage: mox config example [name]
1084
1085# mox checkupdate
1086
1087Check if a newer version of mox is available.
1088
1089A single DNS TXT lookup to _updates.xmox.nl tells if a new version is
1090available. If so, a changelog is fetched from https://updates.xmox.nl, and the
1091individual entries verified with a builtin public key. The changelog is
1092printed.
1093
1094 usage: mox checkupdate
1095
1096# mox cid
1097
1098Turn an ID from a Received header into a cid, for looking up in logs.
1099
1100A cid is essentially a connection counter initialized when mox starts. Each log
1101line contains a cid. Received headers added by mox contain a unique ID that can
1102be decrypted to a cid by admin of a mox instance only.
1103
1104 usage: mox cid cid
1105
1106# mox clientconfig
1107
1108Print the configuration for email clients for a domain.
1109
1110Sending email is typically not done on the SMTP port 25, but on submission
1111ports 465 (with TLS) and 587 (without initial TLS, but usually added to the
1112connection with STARTTLS). For IMAP, the port with TLS is 993 and without is
1113143.
1114
1115Without TLS/STARTTLS, passwords are sent in clear text, which should only be
1116configured over otherwise secured connections, like a VPN.
1117
1118 usage: mox clientconfig domain
1119
1120# mox dane dial
1121
1122Dial the address using TLS with certificate verification using DANE.
1123
1124Data is copied between connection and stdin/stdout until either side closes the
1125connection.
1126
1127 usage: mox dane dial host:port
1128 -usages string
1129 allowed usages for dane, comma-separated list (default "pkix-ta,pkix-ee,dane-ta,dane-ee")
1130
1131# mox dane dialmx
1132
1133Connect to MX server for domain using STARTTLS verified with DANE.
1134
1135If no destination host is specified, regular delivery logic is used to find the
1136hosts to attempt delivery too. This involves following CNAMEs for the domain,
1137looking up MX records, and possibly falling back to the domain name itself as
1138host.
1139
1140If a destination host is specified, that is the only candidate host considered
1141for dialing.
1142
1143With a list of destinations gathered, each is dialed until a successful SMTP
1144session verified with DANE has been initialized, including EHLO and STARTTLS
1145commands.
1146
1147Once connected, data is copied between connection and stdin/stdout, until
1148either side closes the connection.
1149
1150This command follows the same logic as delivery attempts made from the queue,
1151sharing most of its code.
1152
1153 usage: mox dane dialmx domain [destination-host]
1154 -ehlohostname string
1155 hostname to send in smtp ehlo command (default "localhost")
1156
1157# mox dane makerecord
1158
1159Print TLSA record for given certificate/key and parameters.
1160
1161Valid values:
1162- usage: pkix-ta (0), pkix-ee (1), dane-ta (2), dane-ee (3)
1163- selector: cert (0), spki (1)
1164- matchtype: full (0), sha2-256 (1), sha2-512 (2)
1165
1166Common DANE TLSA record parameters are: dane-ee spki sha2-256, or 3 1 1,
1167followed by a sha2-256 hash of the DER-encoded "SPKI" (subject public key info)
1168from the certificate. An example DNS zone file entry:
1169
1170 _25._tcp.example.com. TLSA 3 1 1 133b919c9d65d8b1488157315327334ead8d83372db57465ecabf53ee5748aee
1171
1172The first usable information from the pem file is used to compose the TLSA
1173record. In case of selector "cert", a certificate is required. Otherwise the
1174"subject public key info" (spki) of the first certificate or public or private
1175key (pkcs#8, pkcs#1 or ec private key) is used.
1176
1177 usage: mox dane makerecord usage selector matchtype [certificate.pem | publickey.pem | privatekey.pem]
1178
1179# mox dns lookup
1180
1181Lookup DNS name of given type.
1182
1183Lookup always prints whether the response was DNSSEC-protected.
1184
1185Examples:
1186
1187mox dns lookup ptr 1.1.1.1
1188mox dns lookup mx xmox.nl
1189mox dns lookup txt _dmarc.xmox.nl.
1190mox dns lookup tlsa _25._tcp.xmox.nl
1191
1192 usage: mox dns lookup [ptr | mx | cname | ips | a | aaaa | ns | txt | srv | tlsa] name
1193
1194# mox dkim gened25519
1195
1196Generate a new ed25519 key for use with DKIM.
1197
1198Ed25519 keys are much smaller than RSA keys of comparable cryptographic
1199strength. This is convenient because of maximum DNS message sizes. At the time
1200of writing, not many mail servers appear to support ed25519 DKIM keys though,
1201so it is recommended to sign messages with both RSA and ed25519 keys.
1202
1203 usage: mox dkim gened25519 >$selector._domainkey.$domain.ed25519.privatekey.pkcs8.pem
1204
1205# mox dkim genrsa
1206
1207Generate a new 2048 bit RSA private key for use with DKIM.
1208
1209The generated file is in PEM format, and has a comment it is generated for use
1210with DKIM, by mox.
1211
1212 usage: mox dkim genrsa >$selector._domainkey.$domain.rsa2048.privatekey.pkcs8.pem
1213
1214# mox dkim lookup
1215
1216Lookup and print the DKIM record for the selector at the domain.
1217
1218 usage: mox dkim lookup selector domain
1219
1220# mox dkim txt
1221
1222Print a DKIM DNS TXT record with the public key derived from the private key read from stdin.
1223
1224The DNS should be configured as a TXT record at $selector._domainkey.$domain.
1225
1226 usage: mox dkim txt <$selector._domainkey.$domain.key.pkcs8.pem
1227
1228# mox dkim verify
1229
1230Verify the DKIM signatures in a message and print the results.
1231
1232The message is parsed, and the DKIM-Signature headers are validated. Validation
1233of older messages may fail because the DNS records have been removed or changed
1234by now, or because the signature header may have specified an expiration time
1235that was passed.
1236
1237 usage: mox dkim verify message
1238
1239# mox dkim sign
1240
1241Sign a message, adding DKIM-Signature headers based on the domain in the From header.
1242
1243The message is parsed, the domain looked up in the configuration files, and
1244DKIM-Signature headers generated. The message is printed with the DKIM-Signature
1245headers prepended.
1246
1247 usage: mox dkim sign message
1248
1249# mox dmarc lookup
1250
1251Lookup dmarc policy for domain, a DNS TXT record at _dmarc.<domain>, validate and print it.
1252
1253 usage: mox dmarc lookup domain
1254
1255# mox dmarc parsereportmsg
1256
1257Parse a DMARC report from an email message, and print its extracted details.
1258
1259DMARC reports are periodically mailed, if requested in the DMARC DNS record of
1260a domain. Reports are sent by mail servers that received messages with our
1261domain in a From header. This may or may not be legatimate email. DMARC reports
1262contain summaries of evaluations of DMARC and DKIM/SPF, which can help
1263understand email deliverability problems.
1264
1265 usage: mox dmarc parsereportmsg message ...
1266
1267# mox dmarc verify
1268
1269Parse an email message and evaluate it against the DMARC policy of the domain in the From-header.
1270
1271mailfromaddress and helodomain are used for SPF validation. If both are empty,
1272SPF validation is skipped.
1273
1274mailfromaddress should be the address used as MAIL FROM in the SMTP session.
1275For DSN messages, that address may be empty. The helo domain was specified at
1276the beginning of the SMTP transaction that delivered the message. These values
1277can be found in message headers.
1278
1279 usage: mox dmarc verify remoteip mailfromaddress helodomain < message
1280
1281# mox dmarc checkreportaddrs
1282
1283For each reporting address in the domain's DMARC record, check if it has opted into receiving reports (if needed).
1284
1285A DMARC record can request reports about DMARC evaluations to be sent to an
1286email/http address. If the organizational domains of that of the DMARC record
1287and that of the report destination address do not match, the destination
1288address must opt-in to receiving DMARC reports by creating a DMARC record at
1289<dmarcdomain>._report._dmarc.<reportdestdomain>.
1290
1291 usage: mox dmarc checkreportaddrs domain
1292
1293# mox dnsbl check
1294
1295Test if IP is in the DNS blocklist of the zone, e.g. bl.spamcop.net.
1296
1297If the IP is in the blocklist, an explanation is printed. This is typically a
1298URL with more information.
1299
1300 usage: mox dnsbl check zone ip
1301
1302# mox dnsbl checkhealth
1303
1304Check the health of the DNS blocklist represented by zone, e.g. bl.spamcop.net.
1305
1306The health of a DNS blocklist can be checked by querying for 127.0.0.1 and
1307127.0.0.2. The second must and the first must not be present.
1308
1309 usage: mox dnsbl checkhealth zone
1310
1311# mox mtasts lookup
1312
1313Lookup the MTASTS record and policy for the domain.
1314
1315MTA-STS is a mechanism for a domain to specify if it requires TLS connections
1316for delivering email. If a domain has a valid MTA-STS DNS TXT record at
1317_mta-sts.<domain> it signals it implements MTA-STS. A policy can then be
1318fetched at https://mta-sts.<domain>/.well-known/mta-sts.txt. The policy
1319specifies the mode (enforce, testing, none), which MX servers support TLS and
1320should be used, and how long the policy can be cached.
1321
1322 usage: mox mtasts lookup domain
1323
1324# mox retrain
1325
1326Recreate and retrain the junk filter for the account.
1327
1328Useful after having made changes to the junk filter configuration, or if the
1329implementation has changed.
1330
1331 usage: mox retrain accountname
1332
1333# mox sendmail
1334
1335Sendmail is a drop-in replacement for /usr/sbin/sendmail to deliver emails sent by unix processes like cron.
1336
1337If invoked as "sendmail", it will act as sendmail for sending messages. Its
1338intention is to let processes like cron send emails. Messages are submitted to
1339an actual mail server over SMTP. The destination mail server and credentials are
1340configured in /etc/moxsubmit.conf, see mox config describe-sendmail. The From
1341message header is rewritten to the configured address. When the addressee
1342appears to be a local user, because without @, the message is sent to the
1343configured default address.
1344
1345If submitting an email fails, it is added to a directory moxsubmit.failures in
1346the user's home directory.
1347
1348Most flags are ignored to fake compatibility with other sendmail
1349implementations. A single recipient or the -t flag with a To-header is required.
1350With the -t flag, Cc and Bcc headers are not handled specially, so Bcc is not
1351removed and the addresses do not receive the email.
1352
1353/etc/moxsubmit.conf should be group-readable and not readable by others and this
1354binary should be setgid that group:
1355
1356 groupadd moxsubmit
1357 install -m 2755 -o root -g moxsubmit mox /usr/sbin/sendmail
1358 touch /etc/moxsubmit.conf
1359 chown root:moxsubmit /etc/moxsubmit.conf
1360 chmod 640 /etc/moxsubmit.conf
1361 # edit /etc/moxsubmit.conf
1362
1363
1364 usage: mox sendmail [-Fname] [ignoredflags] [-t] [<message]
1365
1366# mox spf check
1367
1368Check the status of IP for the policy published in DNS for the domain.
1369
1370IPs may be allowed to send for a domain, or disallowed, and several shades in
1371between. If not allowed, an explanation may be provided by the policy. If so,
1372the explanation is printed. The SPF mechanism that matched (if any) is also
1373printed.
1374
1375 usage: mox spf check domain ip
1376
1377# mox spf lookup
1378
1379Lookup the SPF record for the domain and print it.
1380
1381 usage: mox spf lookup domain
1382
1383# mox spf parse
1384
1385Parse the record as SPF record. If valid, nothing is printed.
1386
1387 usage: mox spf parse txtrecord
1388
1389# mox tlsrpt lookup
1390
1391Lookup the TLSRPT record for the domain.
1392
1393A TLSRPT record typically contains an email address where reports about TLS
1394connectivity should be sent. Mail servers attempting delivery to our domain
1395should attempt to use TLS. TLSRPT lets them report how many connection
1396successfully used TLS, and how what kind of errors occurred otherwise.
1397
1398 usage: mox tlsrpt lookup domain
1399
1400# mox tlsrpt parsereportmsg
1401
1402Parse and print the TLSRPT in the message.
1403
1404The report is printed in formatted JSON.
1405
1406 usage: mox tlsrpt parsereportmsg message ...
1407
1408# mox version
1409
1410Prints this mox version.
1411
1412 usage: mox version
1413
1414# mox webapi
1415
1416Lists available methods, prints request/response parameters for method, or calls a method with a request read from standard input.
1417
1418 usage: mox webapi [method [baseurl-with-credentials]
1419
1420# mox example
1421
1422List available examples, or print a specific example.
1423
1424 usage: mox example [name]
1425
1426# mox bumpuidvalidity
1427
1428Change the IMAP UID validity of the mailbox, causing IMAP clients to refetch messages.
1429
1430This can be useful after manually repairing metadata about the account/mailbox.
1431
1432Opens account database file directly. Ensure mox does not have the account
1433open, or is not running.
1434
1435 usage: mox bumpuidvalidity account [mailbox]
1436
1437# mox reassignuids
1438
1439Reassign UIDs in one mailbox or all mailboxes in an account and bump UID validity, causing IMAP clients to refetch messages.
1440
1441Opens account database file directly. Ensure mox does not have the account
1442open, or is not running.
1443
1444 usage: mox reassignuids account [mailboxid]
1445
1446# mox fixuidmeta
1447
1448Fix inconsistent UIDVALIDITY and UIDNEXT in messages/mailboxes/account.
1449
1450The next UID to use for a message in a mailbox should always be higher than any
1451existing message UID in the mailbox. If it is not, the mailbox UIDNEXT is
1452updated.
1453
1454Each mailbox has a UIDVALIDITY sequence number, which should always be lower
1455than the per-account next UIDVALIDITY to use. If it is not, the account next
1456UIDVALIDITY is updated.
1457
1458Opens account database file directly. Ensure mox does not have the account
1459open, or is not running.
1460
1461 usage: mox fixuidmeta account
1462
1463# mox fixmsgsize
1464
1465Ensure message sizes in the database matching the sum of the message prefix length and on-disk file size.
1466
1467Messages with an inconsistent size are also parsed again.
1468
1469If an inconsistency is found, you should probably also run "mox
1470bumpuidvalidity" on the mailboxes or entire account to force IMAP clients to
1471refetch messages.
1472
1473 usage: mox fixmsgsize [account]
1474
1475# mox reparse
1476
1477Parse all messages in the account or all accounts again.
1478
1479Can be useful after upgrading mox with improved message parsing. Messages are
1480parsed in batches, so other access to the mailboxes/messages are not blocked
1481while reparsing all messages.
1482
1483 usage: mox reparse [account]
1484
1485# mox ensureparsed
1486
1487Ensure messages in the database have a pre-parsed MIME form in the database.
1488
1489 usage: mox ensureparsed account
1490 -all
1491 store new parsed message for all messages
1492
1493# mox recalculatemailboxcounts
1494
1495Recalculate message counts for all mailboxes in the account, and total message size for quota.
1496
1497When a message is added to/removed from a mailbox, or when message flags change,
1498the total, unread, unseen and deleted messages are accounted, the total size of
1499the mailbox, and the total message size for the account. In case of a bug in
1500this accounting, the numbers could become incorrect. This command will find, fix
1501and print them.
1502
1503 usage: mox recalculatemailboxcounts account
1504
1505# mox message parse
1506
1507Parse message, print JSON representation.
1508
1509 usage: mox message parse message.eml
1510 -smtputf8
1511 check if message needs smtputf8
1512
1513# mox reassignthreads
1514
1515Reassign message threads.
1516
1517For all accounts, or optionally only the specified account.
1518
1519Threading for all messages in an account is first reset, and new base subject
1520and normalized message-id saved with the message. Then all messages are
1521evaluated and matched against their parents/ancestors.
1522
1523Messages are matched based on the References header, with a fall-back to an
1524In-Reply-To header, and if neither is present/valid, based only on base
1525subject.
1526
1527A References header typically points to multiple previous messages in a
1528hierarchy. From oldest ancestor to most recent parent. An In-Reply-To header
1529would have only a message-id of the parent message.
1530
1531A message is only linked to a parent/ancestor if their base subject is the
1532same. This ensures unrelated replies, with a new subject, are placed in their
1533own thread.
1534
1535The base subject is lower cased, has whitespace collapsed to a single
1536space, and some components removed: leading "Re:", "Fwd:", "Fw:", or bracketed
1537tag (that mailing lists often add, e.g. "[listname]"), trailing "(fwd)", or
1538enclosing "[fwd: ...]".
1539
1540Messages are linked to all their ancestors. If an intermediate parent/ancestor
1541message is deleted in the future, the message can still be linked to the earlier
1542ancestors. If the direct parent already wasn't available while matching, this is
1543stored as the message having a "missing link" to its stored ancestors.
1544
1545 usage: mox reassignthreads [account]
1546*/
1547package main
1548
1549// NOTE: DO NOT EDIT, this file is generated by gendoc.sh.
1550