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