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
698Mailbox flags, like "seen", "answered", will be imported. An optional
699dovecot-keywords file can specify additional flags, like Forwarded/Junk/NotJunk.
700
701 usage: mox import maildir accountname mailboxname maildir
702
703# mox import mbox
704
705Import an mbox into an account.
706
707Using mbox is not recommended, maildir is a better defined format.
708
709The mbox/maildir archive is accessed and imported by the running mox process, so
710it must have access to the archive files. The default suggested systemd service
711file isolates mox from most of the file system, with only the "data/" directory
712accessible, so you may want to put the mbox/maildir archive files in a
713directory like "data/import/" to make it available to mox.
714
715By default, messages will train the junk filter based on their flags and, if
716"automatic junk flags" configuration is set, based on mailbox naming.
717
718If the destination mailbox is the Sent mailbox, the recipients of the messages
719are added to the message metadata, causing later incoming messages from these
720recipients to be accepted, unless other reputation signals prevent that.
721
722Users can also import mailboxes/messages through the account web page by
723uploading a zip or tgz file with mbox and/or maildirs.
724
725 usage: mox import mbox accountname mailboxname mbox
726
727# mox export maildir
728
729Export one or all mailboxes from an account in maildir format.
730
731Export bypasses a running mox instance. It opens the account mailbox/message
732database file directly. This may block if a running mox instance also has the
733database open, e.g. for IMAP connections. To export from a running instance, use
734the accounts web page or webmail.
735
736 usage: mox export maildir [-single] dst-dir account-path [mailbox]
737 -single
738 export single mailbox, without any children. disabled if mailbox isn't specified.
739
740# mox export mbox
741
742Export messages from one or all mailboxes in an account in mbox format.
743
744Using mbox is not recommended. Maildir is a better format.
745
746Export bypasses a running mox instance. It opens the account mailbox/message
747database file directly. This may block if a running mox instance also has the
748database open, e.g. for IMAP connections. To export from a running instance, use
749the accounts web page or webmail.
750
751For mbox export, "mboxrd" is used where message lines starting with the magic
752"From " string are escaped by prepending a >. All ">*From " are escaped,
753otherwise reconstructing the original could lose a ">".
754
755 usage: mox export mbox [-single] dst-dir account-path [mailbox]
756 -single
757 export single mailbox, without any children. disabled if mailbox isn't specified.
758
759# mox localserve
760
761Start a local SMTP/IMAP server that accepts all messages, useful when testing/developing software that sends email.
762
763Localserve starts mox with a configuration suitable for local email-related
764software development/testing. It listens for SMTP/Submission(s), IMAP(s) and
765HTTP(s), on the regular port numbers + 1000.
766
767Data is stored in the system user's configuration directory under
768"mox-localserve", e.g. $HOME/.config/mox-localserve/ on linux, but can be
769overridden with the -dir flag. If the directory does not yet exist, it is
770automatically initialized with configuration files, an account with email
771address mox@localhost and password moxmoxmox, and a newly generated self-signed
772TLS certificate.
773
774Incoming messages are delivered as normal, falling back to accepting and
775delivering to the mox account for unknown addresses.
776Submitted messages are added to the queue, which delivers by ignoring the
777destination servers, always connecting to itself instead.
778
779Recipient addresses with the following localpart suffixes are handled specially:
780
781- "temperror": fail with a temporary error code
782- "permerror": fail with a permanent error code
783- [45][0-9][0-9]: fail with the specific error code
784- "timeout": no response (for an hour)
785
786If the localpart begins with "mailfrom" or "rcptto", the error is returned
787during those commands instead of during "data".
788
789 usage: mox localserve
790 -dir string
791 configuration storage directory (default "$userconfigdir/mox-localserve")
792 -initonly
793 write configuration files and exit
794 -ip string
795 serve on this ip instead of default 127.0.0.1 and ::1. only used when writing configuration, at first launch.
796
797# mox help
798
799Prints help about matching commands.
800
801If multiple commands match, they are listed along with the first line of their help text.
802If a single command matches, its usage and full help text is printed.
803
804 usage: mox help [command ...]
805
806# mox backup
807
808Creates a backup of the data directory.
809
810Backup creates consistent snapshots of the databases and message files and
811copies other files in the data directory. Empty directories are not copied.
812These files can then be stored elsewhere for long-term storage, or used to fall
813back to should an upgrade fail. Simply copying files in the data directory
814while mox is running can result in unusable database files.
815
816Message files never change (they are read-only, though can be removed) and are
817hard-linked so they don't consume additional space. If hardlinking fails, for
818example when the backup destination directory is on a different file system, a
819regular copy is made. Using a destination directory like "data/tmp/backup"
820increases the odds hardlinking succeeds: the default systemd service file
821specifically mounts the data directory, causing attempts to hardlink outside it
822to fail with an error about cross-device linking.
823
824All files in the data directory that aren't recognized (i.e. other than known
825database files, message files, an acme directory, the "tmp" directory, etc),
826are stored, but with a warning.
827
828A clean successful backup does not print any output by default. Use the
829-verbose flag for details, including timing.
830
831To restore a backup, first shut down mox, move away the old data directory and
832move an earlier backed up directory in its place, run "mox verifydata",
833possibly with the "-fix" option, and restart mox. After the restore, you may
834also want to run "mox bumpuidvalidity" for each account for which messages in a
835mailbox changed, to force IMAP clients to synchronize mailbox state.
836
837Before upgrading, to check if the upgrade will likely succeed, first make a
838backup, then use the new mox binary to run "mox verifydata" on the backup. This
839can change the backup files (e.g. upgrade database files, move away
840unrecognized message files), so you should make a new backup before actually
841upgrading.
842
843 usage: mox backup dest-dir
844 -verbose
845 print progress
846
847# mox verifydata
848
849Verify the contents of a data directory, typically of a backup.
850
851Verifydata checks all database files to see if they are valid BoltDB/bstore
852databases. It checks that all messages in the database have a corresponding
853on-disk message file and there are no unrecognized files. If option -fix is
854specified, unrecognized message files are moved away. This may be needed after
855a restore, because messages enqueued or delivered in the future may get those
856message sequence numbers assigned and writing the message file would fail.
857Consistency of message/mailbox UID, UIDNEXT and UIDVALIDITY is verified as
858well.
859
860Because verifydata opens the database files, schema upgrades may automatically
861be applied. This can happen if you use a new mox release. It is useful to run
862"mox verifydata" with a new binary before attempting an upgrade, but only on a
863copy of the database files, as made with "mox backup". Before upgrading, make a
864new backup again since "mox verifydata" may have upgraded the database files,
865possibly making them potentially no longer readable by the previous version.
866
867 usage: mox verifydata data-dir
868 -fix
869 fix fixable problems, such as moving away message files not referenced by their database
870 -skip-size-check
871 skip the check for message size
872
873# mox config test
874
875Parses and validates the configuration files.
876
877If valid, the command exits with status 0. If not valid, all errors encountered
878are printed.
879
880 usage: mox config test
881
882# mox config dnscheck
883
884Check the DNS records with the configuration for the domain, and print any errors/warnings.
885
886 usage: mox config dnscheck domain
887
888# mox config dnsrecords
889
890Prints annotated DNS records as zone file that should be created for the domain.
891
892The zone file can be imported into existing DNS software. You should review the
893DNS records, especially if your domain previously/currently has email
894configured.
895
896 usage: mox config dnsrecords domain
897
898# mox config describe-domains
899
900Prints an annotated empty configuration for use as domains.conf.
901
902The domains configuration file contains the domains and their configuration,
903and accounts and their configuration. This includes the configured email
904addresses. The mox admin web interface, and the mox command line interface, can
905make changes to this file. Mox automatically reloads this file when it changes.
906
907Like the static configuration, the example domains.conf printed by this command
908needs modifications to make it valid.
909
910 usage: mox config describe-domains >domains.conf
911
912# mox config describe-static
913
914Prints an annotated empty configuration for use as mox.conf.
915
916The static configuration file cannot be reloaded while mox is running. Mox has
917to be restarted for changes to the static configuration file to take effect.
918
919This configuration file needs modifications to make it valid. For example, it
920may contain unfinished list items.
921
922 usage: mox config describe-static >mox.conf
923
924# mox config account add
925
926Add an account with an email address and reload the configuration.
927
928Email can be delivered to this address/account. A password has to be configured
929explicitly, see the setaccountpassword command.
930
931 usage: mox config account add account address
932
933# mox config account rm
934
935Remove an account and reload the configuration.
936
937Email addresses for this account will also be removed, and incoming email for
938these addresses will be rejected.
939
940 usage: mox config account rm account
941
942# mox config address add
943
944Adds an address to an account and reloads the configuration.
945
946If address starts with a @ (i.e. a missing localpart), this is a catchall
947address for the domain.
948
949 usage: mox config address add address account
950
951# mox config address rm
952
953Remove an address and reload the configuration.
954
955Incoming email for this address will be rejected after removing an address.
956
957 usage: mox config address rm address
958
959# mox config domain add
960
961Adds a new domain to the configuration and reloads the configuration.
962
963The account is used for the postmaster mailboxes the domain, including as DMARC and
964TLS reporting. Localpart is the "username" at the domain for this account. If
965must be set if and only if account does not yet exist.
966
967 usage: mox config domain add domain account [localpart]
968
969# mox config domain rm
970
971Remove a domain from the configuration and reload the configuration.
972
973This is a dangerous operation. Incoming email delivery for this domain will be
974rejected.
975
976 usage: mox config domain rm domain
977
978# mox config alias list
979
980List aliases for domain.
981
982 usage: mox config alias list domain
983
984# mox config alias print
985
986Print settings and members of alias.
987
988 usage: mox config alias print alias
989
990# mox config alias add
991
992Add new alias with one or more addresses.
993
994 usage: mox config alias add alias@domain rcpt1@domain ...
995
996# mox config alias update
997
998Update alias configuration.
999
1000 usage: mox config alias update alias@domain [-postpublic false|true -listmembers false|true -allowmsgfrom false|true]
1001 -allowmsgfrom string
1002 whether alias address can be used in message from header
1003 -listmembers string
1004 whether list members can list members
1005 -postpublic string
1006 whether anyone or only list members can post
1007
1008# mox config alias rm
1009
1010Remove alias.
1011
1012 usage: mox config alias rm alias@domain
1013
1014# mox config alias addaddr
1015
1016Add addresses to alias.
1017
1018 usage: mox config alias addaddr alias@domain rcpt1@domain ...
1019
1020# mox config alias rmaddr
1021
1022Remove addresses from alias.
1023
1024 usage: mox config alias rmaddr alias@domain rcpt1@domain ...
1025
1026# mox config describe-sendmail
1027
1028Describe configuration for mox when invoked as sendmail.
1029
1030 usage: mox config describe-sendmail >/etc/moxsubmit.conf
1031
1032# mox config printservice
1033
1034Prints a systemd unit service file for mox.
1035
1036This is the same file as generated using quickstart. If the systemd service file
1037has changed with a newer version of mox, use this command to generate an up to
1038date version.
1039
1040 usage: mox config printservice >mox.service
1041
1042# mox config ensureacmehostprivatekeys
1043
1044Ensure host private keys exist for TLS listeners with ACME.
1045
1046In mox.conf, each listener can have TLS configured. Long-lived private key files
1047can be specified, which will be used when requesting ACME certificates.
1048Configuring these private keys makes it feasible to publish DANE TLSA records
1049for the corresponding public keys in DNS, protected with DNSSEC, allowing TLS
1050certificate verification without depending on a list of Certificate Authorities
1051(CAs). Previous versions of mox did not pre-generate private keys for use with
1052ACME certificates, but would generate private keys on-demand. By explicitly
1053configuring private keys, they will not change automatedly with new
1054certificates, and the DNS TLSA records stay valid.
1055
1056This command looks for listeners in mox.conf with TLS with ACME configured. For
1057each missing host private key (of type rsa-2048 and ecdsa-p256) a key is written
1058to config/hostkeys/. If a certificate exists in the ACME "cache", its private
1059key is copied. Otherwise a new private key is generated. Snippets for manually
1060updating/editing mox.conf are printed.
1061
1062After running this command, and updating mox.conf, run "mox config dnsrecords"
1063for a domain and create the TLSA DNS records it suggests to enable DANE.
1064
1065 usage: mox config ensureacmehostprivatekeys
1066
1067# mox config example
1068
1069List available config examples, or print a specific example.
1070
1071 usage: mox config example [name]
1072
1073# mox checkupdate
1074
1075Check if a newer version of mox is available.
1076
1077A single DNS TXT lookup to _updates.xmox.nl tells if a new version is
1078available. If so, a changelog is fetched from https://updates.xmox.nl, and the
1079individual entries verified with a builtin public key. The changelog is
1080printed.
1081
1082 usage: mox checkupdate
1083
1084# mox cid
1085
1086Turn an ID from a Received header into a cid, for looking up in logs.
1087
1088A cid is essentially a connection counter initialized when mox starts. Each log
1089line contains a cid. Received headers added by mox contain a unique ID that can
1090be decrypted to a cid by admin of a mox instance only.
1091
1092 usage: mox cid cid
1093
1094# mox clientconfig
1095
1096Print the configuration for email clients for a domain.
1097
1098Sending email is typically not done on the SMTP port 25, but on submission
1099ports 465 (with TLS) and 587 (without initial TLS, but usually added to the
1100connection with STARTTLS). For IMAP, the port with TLS is 993 and without is
1101143.
1102
1103Without TLS/STARTTLS, passwords are sent in clear text, which should only be
1104configured over otherwise secured connections, like a VPN.
1105
1106 usage: mox clientconfig domain
1107
1108# mox dane dial
1109
1110Dial the address using TLS with certificate verification using DANE.
1111
1112Data is copied between connection and stdin/stdout until either side closes the
1113connection.
1114
1115 usage: mox dane dial host:port
1116 -usages string
1117 allowed usages for dane, comma-separated list (default "pkix-ta,pkix-ee,dane-ta,dane-ee")
1118
1119# mox dane dialmx
1120
1121Connect to MX server for domain using STARTTLS verified with DANE.
1122
1123If no destination host is specified, regular delivery logic is used to find the
1124hosts to attempt delivery too. This involves following CNAMEs for the domain,
1125looking up MX records, and possibly falling back to the domain name itself as
1126host.
1127
1128If a destination host is specified, that is the only candidate host considered
1129for dialing.
1130
1131With a list of destinations gathered, each is dialed until a successful SMTP
1132session verified with DANE has been initialized, including EHLO and STARTTLS
1133commands.
1134
1135Once connected, data is copied between connection and stdin/stdout, until
1136either side closes the connection.
1137
1138This command follows the same logic as delivery attempts made from the queue,
1139sharing most of its code.
1140
1141 usage: mox dane dialmx domain [destination-host]
1142 -ehlohostname string
1143 hostname to send in smtp ehlo command (default "localhost")
1144
1145# mox dane makerecord
1146
1147Print TLSA record for given certificate/key and parameters.
1148
1149Valid values:
1150- usage: pkix-ta (0), pkix-ee (1), dane-ta (2), dane-ee (3)
1151- selector: cert (0), spki (1)
1152- matchtype: full (0), sha2-256 (1), sha2-512 (2)
1153
1154Common DANE TLSA record parameters are: dane-ee spki sha2-256, or 3 1 1,
1155followed by a sha2-256 hash of the DER-encoded "SPKI" (subject public key info)
1156from the certificate. An example DNS zone file entry:
1157
1158 _25._tcp.example.com. TLSA 3 1 1 133b919c9d65d8b1488157315327334ead8d83372db57465ecabf53ee5748aee
1159
1160The first usable information from the pem file is used to compose the TLSA
1161record. In case of selector "cert", a certificate is required. Otherwise the
1162"subject public key info" (spki) of the first certificate or public or private
1163key (pkcs#8, pkcs#1 or ec private key) is used.
1164
1165 usage: mox dane makerecord usage selector matchtype [certificate.pem | publickey.pem | privatekey.pem]
1166
1167# mox dns lookup
1168
1169Lookup DNS name of given type.
1170
1171Lookup always prints whether the response was DNSSEC-protected.
1172
1173Examples:
1174
1175mox dns lookup ptr 1.1.1.1
1176mox dns lookup mx xmox.nl
1177mox dns lookup txt _dmarc.xmox.nl.
1178mox dns lookup tlsa _25._tcp.xmox.nl
1179
1180 usage: mox dns lookup [ptr | mx | cname | ips | a | aaaa | ns | txt | srv | tlsa] name
1181
1182# mox dkim gened25519
1183
1184Generate a new ed25519 key for use with DKIM.
1185
1186Ed25519 keys are much smaller than RSA keys of comparable cryptographic
1187strength. This is convenient because of maximum DNS message sizes. At the time
1188of writing, not many mail servers appear to support ed25519 DKIM keys though,
1189so it is recommended to sign messages with both RSA and ed25519 keys.
1190
1191 usage: mox dkim gened25519 >$selector._domainkey.$domain.ed25519.privatekey.pkcs8.pem
1192
1193# mox dkim genrsa
1194
1195Generate a new 2048 bit RSA private key for use with DKIM.
1196
1197The generated file is in PEM format, and has a comment it is generated for use
1198with DKIM, by mox.
1199
1200 usage: mox dkim genrsa >$selector._domainkey.$domain.rsa2048.privatekey.pkcs8.pem
1201
1202# mox dkim lookup
1203
1204Lookup and print the DKIM record for the selector at the domain.
1205
1206 usage: mox dkim lookup selector domain
1207
1208# mox dkim txt
1209
1210Print a DKIM DNS TXT record with the public key derived from the private key read from stdin.
1211
1212The DNS should be configured as a TXT record at $selector._domainkey.$domain.
1213
1214 usage: mox dkim txt <$selector._domainkey.$domain.key.pkcs8.pem
1215
1216# mox dkim verify
1217
1218Verify the DKIM signatures in a message and print the results.
1219
1220The message is parsed, and the DKIM-Signature headers are validated. Validation
1221of older messages may fail because the DNS records have been removed or changed
1222by now, or because the signature header may have specified an expiration time
1223that was passed.
1224
1225 usage: mox dkim verify message
1226
1227# mox dkim sign
1228
1229Sign a message, adding DKIM-Signature headers based on the domain in the From header.
1230
1231The message is parsed, the domain looked up in the configuration files, and
1232DKIM-Signature headers generated. The message is printed with the DKIM-Signature
1233headers prepended.
1234
1235 usage: mox dkim sign message
1236
1237# mox dmarc lookup
1238
1239Lookup dmarc policy for domain, a DNS TXT record at _dmarc.<domain>, validate and print it.
1240
1241 usage: mox dmarc lookup domain
1242
1243# mox dmarc parsereportmsg
1244
1245Parse a DMARC report from an email message, and print its extracted details.
1246
1247DMARC reports are periodically mailed, if requested in the DMARC DNS record of
1248a domain. Reports are sent by mail servers that received messages with our
1249domain in a From header. This may or may not be legatimate email. DMARC reports
1250contain summaries of evaluations of DMARC and DKIM/SPF, which can help
1251understand email deliverability problems.
1252
1253 usage: mox dmarc parsereportmsg message ...
1254
1255# mox dmarc verify
1256
1257Parse an email message and evaluate it against the DMARC policy of the domain in the From-header.
1258
1259mailfromaddress and helodomain are used for SPF validation. If both are empty,
1260SPF validation is skipped.
1261
1262mailfromaddress should be the address used as MAIL FROM in the SMTP session.
1263For DSN messages, that address may be empty. The helo domain was specified at
1264the beginning of the SMTP transaction that delivered the message. These values
1265can be found in message headers.
1266
1267 usage: mox dmarc verify remoteip mailfromaddress helodomain < message
1268
1269# mox dmarc checkreportaddrs
1270
1271For each reporting address in the domain's DMARC record, check if it has opted into receiving reports (if needed).
1272
1273A DMARC record can request reports about DMARC evaluations to be sent to an
1274email/http address. If the organizational domains of that of the DMARC record
1275and that of the report destination address do not match, the destination
1276address must opt-in to receiving DMARC reports by creating a DMARC record at
1277<dmarcdomain>._report._dmarc.<reportdestdomain>.
1278
1279 usage: mox dmarc checkreportaddrs domain
1280
1281# mox dnsbl check
1282
1283Test if IP is in the DNS blocklist of the zone, e.g. bl.spamcop.net.
1284
1285If the IP is in the blocklist, an explanation is printed. This is typically a
1286URL with more information.
1287
1288 usage: mox dnsbl check zone ip
1289
1290# mox dnsbl checkhealth
1291
1292Check the health of the DNS blocklist represented by zone, e.g. bl.spamcop.net.
1293
1294The health of a DNS blocklist can be checked by querying for 127.0.0.1 and
1295127.0.0.2. The second must and the first must not be present.
1296
1297 usage: mox dnsbl checkhealth zone
1298
1299# mox mtasts lookup
1300
1301Lookup the MTASTS record and policy for the domain.
1302
1303MTA-STS is a mechanism for a domain to specify if it requires TLS connections
1304for delivering email. If a domain has a valid MTA-STS DNS TXT record at
1305_mta-sts.<domain> it signals it implements MTA-STS. A policy can then be
1306fetched at https://mta-sts.<domain>/.well-known/mta-sts.txt. The policy
1307specifies the mode (enforce, testing, none), which MX servers support TLS and
1308should be used, and how long the policy can be cached.
1309
1310 usage: mox mtasts lookup domain
1311
1312# mox retrain
1313
1314Recreate and retrain the junk filter for the account.
1315
1316Useful after having made changes to the junk filter configuration, or if the
1317implementation has changed.
1318
1319 usage: mox retrain accountname
1320
1321# mox sendmail
1322
1323Sendmail is a drop-in replacement for /usr/sbin/sendmail to deliver emails sent by unix processes like cron.
1324
1325If invoked as "sendmail", it will act as sendmail for sending messages. Its
1326intention is to let processes like cron send emails. Messages are submitted to
1327an actual mail server over SMTP. The destination mail server and credentials are
1328configured in /etc/moxsubmit.conf, see mox config describe-sendmail. The From
1329message header is rewritten to the configured address. When the addressee
1330appears to be a local user, because without @, the message is sent to the
1331configured default address.
1332
1333If submitting an email fails, it is added to a directory moxsubmit.failures in
1334the user's home directory.
1335
1336Most flags are ignored to fake compatibility with other sendmail
1337implementations. A single recipient or the -t flag with a To-header is required.
1338With the -t flag, Cc and Bcc headers are not handled specially, so Bcc is not
1339removed and the addresses do not receive the email.
1340
1341/etc/moxsubmit.conf should be group-readable and not readable by others and this
1342binary should be setgid that group:
1343
1344 groupadd moxsubmit
1345 install -m 2755 -o root -g moxsubmit mox /usr/sbin/sendmail
1346 touch /etc/moxsubmit.conf
1347 chown root:moxsubmit /etc/moxsubmit.conf
1348 chmod 640 /etc/moxsubmit.conf
1349 # edit /etc/moxsubmit.conf
1350
1351
1352 usage: mox sendmail [-Fname] [ignoredflags] [-t] [<message]
1353
1354# mox spf check
1355
1356Check the status of IP for the policy published in DNS for the domain.
1357
1358IPs may be allowed to send for a domain, or disallowed, and several shades in
1359between. If not allowed, an explanation may be provided by the policy. If so,
1360the explanation is printed. The SPF mechanism that matched (if any) is also
1361printed.
1362
1363 usage: mox spf check domain ip
1364
1365# mox spf lookup
1366
1367Lookup the SPF record for the domain and print it.
1368
1369 usage: mox spf lookup domain
1370
1371# mox spf parse
1372
1373Parse the record as SPF record. If valid, nothing is printed.
1374
1375 usage: mox spf parse txtrecord
1376
1377# mox tlsrpt lookup
1378
1379Lookup the TLSRPT record for the domain.
1380
1381A TLSRPT record typically contains an email address where reports about TLS
1382connectivity should be sent. Mail servers attempting delivery to our domain
1383should attempt to use TLS. TLSRPT lets them report how many connection
1384successfully used TLS, and how what kind of errors occurred otherwise.
1385
1386 usage: mox tlsrpt lookup domain
1387
1388# mox tlsrpt parsereportmsg
1389
1390Parse and print the TLSRPT in the message.
1391
1392The report is printed in formatted JSON.
1393
1394 usage: mox tlsrpt parsereportmsg message ...
1395
1396# mox version
1397
1398Prints this mox version.
1399
1400 usage: mox version
1401
1402# mox webapi
1403
1404Lists available methods, prints request/response parameters for method, or calls a method with a request read from standard input.
1405
1406 usage: mox webapi [method [baseurl-with-credentials]
1407
1408# mox example
1409
1410List available examples, or print a specific example.
1411
1412 usage: mox example [name]
1413
1414# mox bumpuidvalidity
1415
1416Change the IMAP UID validity of the mailbox, causing IMAP clients to refetch messages.
1417
1418This can be useful after manually repairing metadata about the account/mailbox.
1419
1420Opens account database file directly. Ensure mox does not have the account
1421open, or is not running.
1422
1423 usage: mox bumpuidvalidity account [mailbox]
1424
1425# mox reassignuids
1426
1427Reassign UIDs in one mailbox or all mailboxes in an account and bump UID validity, causing IMAP clients to refetch messages.
1428
1429Opens account database file directly. Ensure mox does not have the account
1430open, or is not running.
1431
1432 usage: mox reassignuids account [mailboxid]
1433
1434# mox fixuidmeta
1435
1436Fix inconsistent UIDVALIDITY and UIDNEXT in messages/mailboxes/account.
1437
1438The next UID to use for a message in a mailbox should always be higher than any
1439existing message UID in the mailbox. If it is not, the mailbox UIDNEXT is
1440updated.
1441
1442Each mailbox has a UIDVALIDITY sequence number, which should always be lower
1443than the per-account next UIDVALIDITY to use. If it is not, the account next
1444UIDVALIDITY is updated.
1445
1446Opens account database file directly. Ensure mox does not have the account
1447open, or is not running.
1448
1449 usage: mox fixuidmeta account
1450
1451# mox fixmsgsize
1452
1453Ensure message sizes in the database matching the sum of the message prefix length and on-disk file size.
1454
1455Messages with an inconsistent size are also parsed again.
1456
1457If an inconsistency is found, you should probably also run "mox
1458bumpuidvalidity" on the mailboxes or entire account to force IMAP clients to
1459refetch messages.
1460
1461 usage: mox fixmsgsize [account]
1462
1463# mox reparse
1464
1465Parse all messages in the account or all accounts again.
1466
1467Can be useful after upgrading mox with improved message parsing. Messages are
1468parsed in batches, so other access to the mailboxes/messages are not blocked
1469while reparsing all messages.
1470
1471 usage: mox reparse [account]
1472
1473# mox ensureparsed
1474
1475Ensure messages in the database have a pre-parsed MIME form in the database.
1476
1477 usage: mox ensureparsed account
1478 -all
1479 store new parsed message for all messages
1480
1481# mox recalculatemailboxcounts
1482
1483Recalculate message counts for all mailboxes in the account, and total message size for quota.
1484
1485When a message is added to/removed from a mailbox, or when message flags change,
1486the total, unread, unseen and deleted messages are accounted, the total size of
1487the mailbox, and the total message size for the account. In case of a bug in
1488this accounting, the numbers could become incorrect. This command will find, fix
1489and print them.
1490
1491 usage: mox recalculatemailboxcounts account
1492
1493# mox message parse
1494
1495Parse message, print JSON representation.
1496
1497 usage: mox message parse message.eml
1498 -smtputf8
1499 check if message needs smtputf8
1500
1501# mox reassignthreads
1502
1503Reassign message threads.
1504
1505For all accounts, or optionally only the specified account.
1506
1507Threading for all messages in an account is first reset, and new base subject
1508and normalized message-id saved with the message. Then all messages are
1509evaluated and matched against their parents/ancestors.
1510
1511Messages are matched based on the References header, with a fall-back to an
1512In-Reply-To header, and if neither is present/valid, based only on base
1513subject.
1514
1515A References header typically points to multiple previous messages in a
1516hierarchy. From oldest ancestor to most recent parent. An In-Reply-To header
1517would have only a message-id of the parent message.
1518
1519A message is only linked to a parent/ancestor if their base subject is the
1520same. This ensures unrelated replies, with a new subject, are placed in their
1521own thread.
1522
1523The base subject is lower cased, has whitespace collapsed to a single
1524space, and some components removed: leading "Re:", "Fwd:", "Fw:", or bracketed
1525tag (that mailing lists often add, e.g. "[listname]"), trailing "(fwd)", or
1526enclosing "[fwd: ...]".
1527
1528Messages are linked to all their ancestors. If an intermediate parent/ancestor
1529message is deleted in the future, the message can still be linked to the earlier
1530ancestors. If the direct parent already wasn't available while matching, this is
1531stored as the message having a "missing link" to its stored ancestors.
1532
1533 usage: mox reassignthreads [account]
1534*/
1535package main
1536
1537// NOTE: DO NOT EDIT, this file is generated by gendoc.sh.
1538