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