1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
.Dd August 27, 2026
.Dt MAILWEB 1
.Os
.Sh NAME
.Nm mailweb
.Nd read-only IMAP web frontend backed by a local SQLite mirror
.Sh SYNOPSIS
.Nm
.Fl -imap-host Ar host
.Fl -imap-user Ar user
.Pq Fl -imap-pass Ar password | Fl -imap-pass-cmd Ar command
.Op Fl -imap-port Ar port
.Op Fl -smtp-host Ar host
.Op Fl -smtp-port Ar port
.Op Fl -smtp-user Ar user
.Op Fl -smtp-pass Ar password
.Op Fl -smtp-pass-cmd Ar command
.Op Fl -from Ar address
.Op Fl -my-address Ar address ...
.Op Fl -account-name Ar label
.Op Fl -sent-mailbox Ar name
.Op Fl -db Ar path
.Op Fl -listen Ar host:port
.Op Fl -mailbox Ar name ...
.Op Fl -mailweb-folder Ar name
.Op Fl -pdfjs-update Ns = Ns Ar bool
.Nm
.Fl -list-mailboxes
.Fl -imap-host Ar host
.Fl -imap-user Ar user
.Pq Fl -imap-pass Ar password | Fl -imap-pass-cmd Ar command
.Nm
.Fl -analyze
.Fl -imap-host Ar host
.Fl -imap-user Ar user
.Pq Fl -imap-pass Ar password | Fl -imap-pass-cmd Ar command
.Op Fl -db Ar path
.Sh DESCRIPTION
.Nm
mirrors an IMAP account into a local SQLite database and serves it over HTTP as
a plain web interface: server-rendered HTML, no framework, and no script in the
part that matters \(en a message body never executes anything.
.Pp
Four properties decide nearly everything else about it.
This page is the reference;
.Xr mailweb 7
is why each of them is the way it is.
.Bl -bullet -compact
.It
.Em The mirror stores headers only .
A body is fetched the first time it is displayed, and only the one MIME part
chosen for display is kept, so a multi-year archive costs megabytes.
.It
.Em Mailboxes are selected read-only .
Nothing is ever deleted, moved or re-flagged on the server.
The only writes are
.Cm APPEND Ns s
of mail
.Nm
sent itself.
Deletion on the server
.Em is
followed: an expunged message is dropped locally too.
.It
.Em One process serves one account .
A second account is a second process with its own database and listen address.
.It
.Em Nothing leaves this machine without a person .
Composing a reply, assigning a name and flagging a contact are inert and may be
driven by anything that can reach the listen address.
Sending mail, filing a spam report and unsubscribing are not, and are only ever
reached from a page a person is looking at.
.El
.Pp
There is no authentication of any kind; see
.Sx CAVEATS
before changing
.Fl -listen .
.Sh OPTIONS
.Bl -tag -width Ds
.It Fl -imap-host Ar host
IMAP server hostname.
Required.
The connection always uses implicit TLS.
.It Fl -imap-port Ar port
IMAP server port.
Defaults to
.Ar 993 .
.It Fl -imap-user Ar user
IMAP username.
Required.
Also the default SMTP username, the default
.Fl -from
address, the default
.Fl -my-address
and the default
.Fl -account-name .
.It Fl -imap-pass Ar password
IMAP password, given literally.
Exactly one of
.Fl -imap-pass
and
.Fl -imap-pass-cmd
must be set; setting both is an error.
See
.Sx CAVEATS .
.It Fl -imap-pass-cmd Ar command
Shell command whose standard output is the IMAP password, e.g.
.Dq pass email/mailbox.org .
Trailing newlines are stripped.
.It Fl -smtp-host Ar host
SMTP server hostname.
Optional \(en its presence is what enables all sending functionality
.Pq Pa /send , replies, unsubscribe mails, spam reports .
Without it those routes answer 503 and do nothing.
.It Fl -smtp-port Ar port
SMTP server port.
Defaults to
.Ar 465
.Pq implicit TLS .
.It Fl -smtp-user Ar user
SMTP username.
Defaults to the value of
.Fl -imap-user .
.It Fl -smtp-pass Ar password
SMTP password, given literally.
.It Fl -smtp-pass-cmd Ar command
Shell command whose standard output is the SMTP password.
As with IMAP, exactly one of the two forms may be given, and only when
.Fl -smtp-host
is set.
.It Fl -from Ar address
Envelope and header
.Li From
address for sent mail.
Defaults to the value of
.Fl -imap-user .
Its domain is also the right-hand side of every
.Li Message-ID
.Nm
generates.
.It Fl -my-address Ar address
An address belonging to this account.
Such an address is excluded from the contacts listing, is offered no spam report
link, and is removed from the recipients of a reply.
Mail this account sent to nobody but itself is the exception to the first and
the third: there the account is the whole of the correspondence, so it is listed
as a contact and a reply to it is addressed back to the account.
One other recipient anywhere in
.Li To ,
.Li Cc
or
.Li Bcc
makes it an ordinary thread again, and the subtraction applies as usual.
Defaults to the value of
.Fl -imap-user ,
which is the address for most accounts; set it where the login name and the
address mail arrives at differ.
.Pp
May be repeated, because a mailbox commonly receives at more than one address.
The first given is the primary one and is what mail is sent from; the rest are
recognised as this account but never used as a sender.
Naming every alias matters: an alias
.Nm
does not know about survives the reply-all filter, so the reply is addressed
back to the mailbox it came from, in a header everyone on the thread sees.
.Pp
Naming an address that is
.Em not
this account is the opposite mistake and is quieter.
Such an address is hidden from the contacts listing and subtracted from the
recipients of every reply, so a real correspondent stops being listed and mail
meant for them stops being addressed to them, with nothing reporting either.
The test is whether this mailbox sends
.Em as
the address, not whether mail addressed to it arrives here: an address that
appears only ever as a recipient is a correspondent, not an alias.
.It Fl -account-name Ar label
Short label naming this account in window titles and at the head of every text
rendering.
Defaults to the value of
.Fl -imap-user .
It is separate from
.Fl -my-address
because the two are read by different things: an address is matched against mail
and has to be exact, while a label is read by a person glancing at a browser
tab.
It is what tells two instances apart; see
.Sx ONE ACCOUNT PER PROCESS
in
.Xr mailweb 7 .
.It Fl -sent-mailbox Ar name
Name of the mailbox holding sent mail.
Defaults to
.Ar Sent .
.Pp
This is how the contact view tells outgoing mail from incoming, and servers do
not agree on the name:
.Li mailbox.org
says
.Ar Sent ,
.Li strato.de
says
.Ar Sent Items .
Getting it wrong is not cosmetic \(en an unrecognised mailbox makes every
message the account sent read as one the correspondent sent to it, which is
.Nm
asserting in its own voice that somebody wrote something they did not.
Confirm the name with
.Fl -list-mailboxes .
.Pp
Independent of the special-use detection used when appending sent mail, which
asks the server and needs no configuration.
.It Fl -db Ar path
Path to the SQLite database.
Defaults to
.Pa ./mailweb.db .
Created and migrated automatically if absent.
.It Fl -listen Ar host:port
HTTP listen address.
Defaults to
.Ar localhost:8080 .
See
.Sx CAVEATS
before changing this.
.It Fl -mailbox Ar name
Mailbox to sync and watch.
May be repeated.
If given at least once it replaces the default set entirely; the defaults are
used only when the flag is absent altogether.
The default set is
.Ar INBOX ,
.Ar Archive ,
.Ar Archive/2020 ,
.Ar IfBored ,
.Ar Scroll
and
.Ar MustRead .
.Pp
A named mailbox that does not exist on the server prevents startup; see
.Sx CAVEATS .
.It Fl -mailweb-folder Ar name
IMAP folder for synthetic action messages.
Defaults to
.Ar mailweb .
The folder is created at startup if missing and is always appended to the
watched set, in addition to any
.Fl -mailbox
flags.
.It Fl -pdfjs-update
Check GitHub at startup for a newer pdf.js and store it in the database.
On by default.
.Pp
The check runs in the background, so it never delays serving, and every failure
is logged and ignored: an unreachable GitHub leaves whatever was already stored,
and a database that has never had a viewer simply links PDFs instead of framing
them.
Setting it to
.Cm false
uses whatever is stored and contacts nobody, which is what a machine without
network wants.
.Pp
This downloads and runs third-party JavaScript without a person looking at it;
see
.Sx CAVEATS .
.It Fl -list-mailboxes
List every mailbox on the server, one per line, and exit.
Useful for discovering the exact names to pass to
.Fl -mailbox
and
.Fl -sent-mailbox .
.It Fl -analyze
Fetch
.Cm BODYSTRUCTURE
for every message whose MIME structure has not been examined, print a frequency
table of top-level MIME types, of the parts the selection algorithm picks and of
the attachment types found, and exit.
.Pp
This is also the backfill for the attachment listing: the same tree that names
the display part names everything else in the message, so the survey and the
backfill are one pass rather than two traversals of the whole archive.
Messages synced before attachments were recorded report them as unknown until
this has run over them, or until each is opened.
As a side effect the display part of every
.Li multipart/related
message is pre-fetched and cached.
.El
.Sh WEB INTERFACE
All pages are server-rendered HTML and every page has a plain-text rendering;
see
.Sx MACHINE INTERFACE .
Nothing needs script to work as a viewer: every listing, every message and every
action is a link or a form.
The little script there is lives in the outer page, never inside a message, and
only the block editor's absence costs anything \(en see
.Sx SCRIPT IN THE PAGES
in
.Xr mailweb 7 .
.Pp
A route that resolves nothing answers 404 rather than an empty page, because
these pages mint action links out of what they were handed.
.Ss Messages
Every view that shows a message states, beside it and outside the frame, what
is attached to it and roughly what it costs to read.
A calendar attachment additionally offers a summary of the event it describes;
see
.Pa /msg/{id}/attachment/{n}/calendar .
A message whose MIME structure has never been examined says that its attachments
are not yet known, rather than saying nothing \(en which would be
indistinguishable from a message that genuinely carries none.
Opening the message records the structure;
.Fl -analyze
does so for the whole archive.
.Bl -tag -width Ds
.It Pa /
The most recent messages, newest first, each framed in a sandboxed iframe.
Ten per page here against fifty in the text rendering.
.Bl -tag -width "?test=random" -compact
.It Ar ?limit= , ?offset=
Override the page size and position; carried across the paging links.
.It Ar ?since= , ?until=
Restrict to a date range.
Each takes an absolute
.Ar YYYY-MM-DD ,
the words
.Ar today
or
.Ar yesterday ,
or an offset into the past such as
.Ar -7d , -24h
or
.Ar -2w ;
the sign is optional.
Bounds are widened to whole days and the interval is half-open, so
.Ar ?since=today&until=today
is exactly today's mail.
An unparseable value, or an
.Ar until
before its
.Ar since ,
is an error rather than an unfiltered listing.
.It Ar ?test=random
Ten messages at random, for exercising the MIME renderer over the archive.
A single page with no paging links.
.El
.It Pa /msg/{id}
The body of one message as an HTML fragment, intended for framing.
Plain-text bodies have quoted passages collapsed into
.Li <details>
blocks; HTML bodies have their
.Li cid:\&
references rewritten to the part endpoint.
.Pp
This is the body and nothing else: no headers, no size and no attachment list.
Those belong to the page that frames it, never inside it \(en see
.Sx READING MAIL
in
.Xr mailweb 7 .
Opened by hand, use
.Pa /view .
.It Pa /msg/{id}/view
One message as a page of its own: subject, correspondents, date, size, what is
attached, and the body framed in the same sandbox the listings use.
This is what a message URL should be pasted as, and what every subject line in
a listing links to.
.Pp
A separate route rather than a content negotiation on
.Pa /msg/{id} :
what a URL returns does not depend on a request header, and the fragment keeps
its meaning for the listings that embed it.
.Ar ?view=llm
redirects to the text rendering of
.Pa /msg/{id} ,
which already carries the same headers and attachment list, rather than growing
a second one that could disagree with the first.
.It Pa /msg/{id}/part/{cid}
An inline part, by Content-ID.
Located in the message's
.Cm BODYSTRUCTURE
and fetched on demand; not cached.
.It Pa /msg/{id}/attachment/{n}
One attachment, addressed by its position in the message's attachment list,
counting from one \(en not by filename, which the sender chooses and may repeat
or omit.
The bytes are served exactly as they arrived, with the type the server reported,
and are not cached.
This route is always a faithful copy of the part; a rendering of one lives
beside it, never here.
.It Pa /msg/{id}/attachment/{n}/calendar
The summary of an
.Pa .ics
attachment, as a framed HTML fragment: what the event is called, when it is
\(en in the timezone its sender named, labelled with it and never converted
\(en where, whether it has been cancelled, and the sender's description.
404 for an attachment that is neither typed nor named as a calendar.
.Pp
Offered wherever attachments are listed, as a lazily-loaded frame, so a listing
fetches nothing until one is scrolled to.
An event that repeats shows its first occurrence and says so rather than
expanding the series.
See
.Sx READING MAIL
in
.Xr mailweb 7
for why each of those is the way it is.
.It Pa /msg/{id}/attachment/{n}/inline
The same part, served to be displayed rather than saved:
.Li Content-Type: application/pdf
and a disposition of
.Li inline ,
regardless of what the sender called it.
404 for a part whose bytes are not a PDF.
.Pp
A separate route from the bytes for the reason the calendar summary is one.
.Pa /msg/{id}/attachment/{n}
promises a faithful copy with the type the server reported, and that promise is
what makes it safe for every part whatever its type; this route overrides the
type and asks the browser to render, so it is a different URL that answers for a
narrow class of part.
The override is honest only because the bytes are checked: the part must begin
with
.Li %PDF- ,
which is also what reaches the PDFs whose senders labelled them
.Li application/octet-stream
\(en 47 of them on this account, and they are the scanned invoices.
.Pp
Nothing here parses the document.
The renderer is the browser's own, the same one that would open the file after a
download; what mailweb does is name the type and hand the bytes over.
The response carries
.Li X-Content-Type-Options: nosniff
and
.Li Content-Security-Policy: sandbox ,
so it is an opaque origin even opened as a page of its own.
.It Pa /static/pdfjs/{path}
One file of the vendored pdf.js viewer, from the live generation.
.Pp
The URL carries no generation, so what it returns changes when a new release is
stored and it must be revalidated rather than cached: each response carries a
strong
.Li ETag
built from the generation, and a conditional request is answered 304 without
reading the file.
A message page therefore costs a handful of small conditional requests rather
than the 6.5MB it would otherwise re-send.
.Pp
404 when nothing has been stored yet, which is the state of a database whose
first update has not run or has not succeeded.
.El
.Pp
A PDF small enough is additionally drawn on
.Pa /msg/{id}/view ,
below the message body, in that viewer.
Above 5 MiB only the link is offered, since an attachment is never cached and
the page would otherwise wait on the fetch; and nothing is framed at all until a
viewer has been stored, when the attachment row's link is the whole feature.
.Pp
The frame is granted
.Li allow-scripts
\(en a PDF viewer is script, and nothing renders without it \(en and refused
.Li allow-same-origin ,
which makes it an opaque origin that cannot reach mailweb.
The browser's own viewer cannot be used for this: Chromium declines to
instantiate it inside any sandboxed frame whatever tokens are granted.
See
.Sx READING MAIL
in
.Xr mailweb 7 .
.Ss Contacts
A contact is an address and nothing else; contacts are not stored but derived
per request.
Petnames are the one name here that is not a stranger's claim: see
.Sx PETNAMES
in
.Xr mailweb 7 .
.Bl -tag -width Ds
.It Pa /contacts
Every address ever seen in a
.Li From ,
.Li To ,
.Li Cc
or
.Li Bcc
field, with a message count and the date last seen.
Forge notifications and the account's own addresses are excluded \(en the
latter except where the account wrote to nobody but itself, which is counted
once, under the address that sent it.
Important contacts sort first, then by recency.
.Ar ?show=hidden
lists the hidden contacts instead.
.It Pa /contact/{addr}
The full conversation with one address: every message it appears in, in either
direction, plus any unsubscribe requests recorded against it.
Mail from
.Fl -sent-mailbox
is labelled outgoing.
404 for an address no message carries exactly.
.Pp
An address of this account is the one exception, because it appears in a header
of nearly every message in the mirror and the unrestricted listing is therefore
the archive rather than a conversation.
It shows the mail sent to nobody but this account \(en the notes to self \(en
and says so, with a link to the other listing.
.Ar ?all=1
gives the unrestricted one, and is ignored for any other address.
No spam report is offered here or on the settings page: a report is a complaint
filed with a third party about a stranger.
.It Pa /contact/{addr}/settings
.Pq GET
Everything
.Nm
stores about one address, and the only place in the browser where a petname is
assigned: both names, marked; the important, hidden and spam flags with the
controls that set them; the unsubscribe button where a header offers one; the
spam report link; and how much mail the contact accounts for.
Reached by the pencil beside a contact wherever one is listed.
404 for an address that names no contact.
.Ar ?return=
names the listing to link back to, and is ignored unless it is a path within
.Nm .
.It Pa /contact/{addr}/star , Pa /contact/{addr}/unstar
.Pq POST
Set or clear the
.Em important
flag, floating the contact to the top of the listing.
.It Pa /contact/{addr}/hide , Pa /contact/{addr}/unhide
.Pq POST
Set or clear the
.Em hidden
flag.
Always reversible via
.Pa /contacts?show=hidden .
.It Pa /contact/{addr}/petname
.Pq POST
Assign the name this account calls an address, from the form field
.Ar petname ;
an empty value clears it.
Unlike the routes above, any address is accepted, so an address can be named
before its first message arrives.
The form field
.Ar return ,
holding the literal
.Li settings ,
lands back on the settings page; absent, the route returns to
.Va Referer .
.It Pa /contact/{addr}/report-spam
.Pq GET
A form listing every message received from the address, each selectable for
inclusion in a spam report and unfoldable to show the message itself, with a
free-text description and a checkbox marking the content illegal rather than
merely unsolicited.
.Pp
The form can be handed a filled-in draft through the query string, so a report
may be composed somewhere other than the browser it is sent from.
Nothing is sent: the parameters seed the fields, and the submit button remains
the only thing that files a report.
.Bl -tag -width Ds -compact
.It Ar ?description= Ns Ar text
Seeds the description.
Never overwritten by a reason's canned text.
.It Ar &reason= Ns Ar label
Preselects one of the canned reasons by its exact label, e.g.
.Li Phishing .
This is the one parameter that needs script.
.It Ar &illegal=1
Ticks the illegal-content box, routing the report to
.Li besonderer-spam@
rather than
.Li allgemeiner-spam@ .
.It Ar &msg= Ns Ar id
Restricts the selection to the named messages; may be repeated.
Absent, all start selected.
An id that is not the contact's own selects nothing.
.El
.It Pa /contact/{addr}/report-spam
.Pq POST
Sends a report with each selected message attached verbatim as a base64-encoded
.Pa .eml ,
flags the senders of
.Em those messages
as spam and hidden, and files a copy in the sent mailbox.
A report that could attach no message is refused rather than sent.
The recipient and cover note are hardcoded; see
.Sx CAVEATS .
Nothing is recorded unless the report was handed over, and handed over is not
delivered \(en see
.Sx A sent report is not a delivered one .
.El
.Ss Forge notifications
Mail carrying an
.Li X-GitHub-Sender
header \(en which GitHub, Codeberg and other Forgejo/Gitea instances all emit
\(en is treated as forge traffic, excluded from the contacts view and presented
separately.
.Bl -tag -width Ds
.It Pa /forge
Repositories that have sent notifications, derived from the
.Li List-Id
header, ordered by most recent activity.
.It Pa /forge/{repo}
Notifications for one repository, grouped into threads by the issue or pull
request number in the subject, each thread linking back to the forge and
ordered by most recent message.
404 for a repository no message names.
.Pp
Each thread shows the highest level of personal involvement across its messages
and lists its participants, marking one
.Em new
when they had not posted in that repository for over 90 days.
The text rendering pages threads at 50 and additionally caps each thread at its
five most recent messages,
.Ar ?msgs=N
to change it, a negative value for no cap.
.El
.Ss Replies and drafts
A reply is written as a
.Em draft :
a stored object with its own URL, addressed by a random token, which sends
nothing until a person presses a button on its page.
What a draft holds is an ordered list of typed blocks, and whether it goes out
as
.Li text/plain
or
.Li multipart/alternative
is derived from those blocks rather than chosen.
See
.Sx DRAFTS
in
.Xr mailweb 7 .
.Bl -tag -width Ds
.It Pa /msg/{id}/reply
.Pq POST
Compose a reply and answer with the URL of the draft.
Optional
.Li application/x-www-form-urlencoded
fields
.Ar body
and
.Ar subject
fill in the reply and override the derived subject, so one request composes a
whole reply.
Nothing is sent.
A
.Li GET
is refused rather than answered with a form: a draft is created, not filled in,
and a
.Li GET
that created one would let any link or prefetch litter the database.
.It Pa /drafts
Every unsent draft, most recently edited first.
.It Pa /draft/{token}
One draft: what it says, what it will be sent as, and who it may be sent to.
The draft page ends in a list of recipient sets \(en the sender, everyone on the
thread, the mailing list \(en each naming everyone it reaches, ordered narrowest
first, none preselected.
.It Pa /draft/{token}/send
.Pq POST
Send the draft to one of its recipient sets, named by the form field
.Ar set .
This is the only route here that puts mail on the wire.
A set the draft does not offer is refused rather than defaulted; an
already-sent draft is refused with 409.
.It Pa /draft/{token}/discard
.Pq POST
Delete a draft.
Nothing is sent and nothing is kept.
.El
.Pp
The block editor in the browser talks to a small JSON API.
These write to tables on this machine and send nothing, so they may be driven by
anything that can reach the listen address.
Every mutation that can reorder answers with the whole block list; a sent draft
is read-only and refuses all of them with 409.
.Bl -tag -width Ds -compact
.It Pa /api/drafts/{token}
The draft as the editor reads it.
.Li PATCH
writes the subject.
.It Pa /api/drafts/{token}/blocks
.Pq POST
Add a block of kind
.Ar text ,
.Ar quote
or
.Ar code ,
after the position named by
.Ar after .
.It Pa /api/drafts/{token}/blocks/{id}
.Li PATCH
writes one block's content,
.Li DELETE
removes it, and
.Li POST
to
.Pa /move
puts it at another position.
.El
.Ss Sending directly
.Bl -tag -width Ds
.It Pa /send
.Pq POST
Send a message.
Form fields are
.Ar to ,
.Ar subject ,
.Ar body
and
.Ar bodytype
.Pq Li text/plain No or Li text/html , defaulting to plain .
On success the message is appended to the sent mailbox, located by its
.Li \eSent
special-use attribute with a fallback to the names
.Dq Sent
or
.Dq Sent Messages .
A failed append is logged but does not fail the request \(en the mail has
already gone out.
.It Pa /unsubscribe/{id}
.Pq POST
Act on the
.Li List-Unsubscribe
header of one message.
.It Pa /unsubscribe/contact/{addr}
.Pq POST
The same, using the most recent
.Li List-Unsubscribe
header seen from that address, preferring one that offers a
.Li mailto:\& .
The header must come from a message whose sender is
.Em exactly
this address; 404 when no such message carries one.
This header decides who receives mail sent under the account owner's name, and
unlike a spam report, which at least attaches the messages it is about, nothing
in the request resembles the recipient.
.El
.Pp
Both unsubscribe routes dispatch on what the header offers.
A
.Li mailto:\&
form produces a real unsubscribe mail, carrying the header's
.Ar ?subject=
token if present and an
.Li X-Mailweb-Unsubscribe
header naming the contact, so the request shows up in that contact's
conversation.
A URL-only form cannot be actioned without a browser, so a synthetic message
recording the intent \(en including the URL \(en is appended to the mailweb
folder instead, where it likewise surfaces in the contact's thread.
.Sh MACHINE INTERFACE
The HTML views are wasteful to read any other way: the index frames each body
separately, the contact listing runs to megabytes, and a message body is the
sender's own HTML.
Requesting any page with
.Li Accept: text/llm ,
or appending
.Ar ?view=llm
to its URL, returns the same information as plain text instead.
The renderings live in templates beside their HTML counterparts and are given
the same data by the same handlers, so the two cannot disagree.
.Pp
The rendering documents itself: every text response ends with the routes
reachable from it, so a client can navigate the whole interface starting from
.Pa / ,
and every HTML page advertises its alternate in a
.Li <link>
and a
.Li Link
header.
The inventory below is what those responses list.
.Bl -tag -width "POST /msg/{id}/reply" -compact
.It Pa /
recent messages;
.Ar ?limit= , ?offset= , ?since= , ?until= , ?test=random
.It Pa /msg/{id}
one message, headers and body as text
.It Pa /msg/{id}/attachment/{n}
one attachment, as the bytes it is
.It Pa /msg/{id}/attachment/{n}/inline
a PDF attachment, typed and dispositioned to be displayed
.It Pa /msg/{id}/part/{cid}
an inline part, by Content-ID
.It Pa /contacts
addresses seen;
.Ar ?limit= , ?offset= , ?show=hidden
.It Pa /contact/{addr}
the full conversation with one address
.It Pa /contact/{addr}/settings
what is stored about one address
.It Pa /forge
forge notifications by repository
.It Pa /forge/{repo}
one repository, its threads newest first;
.Ar ?msgs=N
.It Pa /drafts
replies being written, none of them sent
.It Pa /draft/{token}
one draft and its recipient sets
.El
.Pp
Of the routes that write, the text rendering advertises as actions only those
that are inert \(en
.Li POST /contact/{addr}/petname ,
the contact flags, and
.Li POST /msg/{id}/reply ,
which composes a draft and sends nothing.
Anything that hands mail to a third party is advertised as its
.Em form
and never as the request that performs it, so what passes to the reader is a
URL that can be looked at before it does anything.
See
.Sx COMPOSING WITHOUT COMMITTING
in
.Xr mailweb 7 .
.Pp
A route that takes fields carries them, and carries how to encode them:
.Bd -literal -offset indent
/msg/{id}/reply     POST (application/x-www-form-urlencoded)
                    fields: body     optional, the reply's text
                            subject  optional, overrides the derived one
.Ed
.Pp
Send the fields as
.Li application/x-www-form-urlencoded .
This is not a stylistic preference: a request whose body is JSON \(en the
obvious guess for a machine interface \(en parses without error and yields no
fields at all, so a reply composed with care would be stored as an empty draft
and the client told it had succeeded.
.Pp
Listings page at 50 entries, adjustable with
.Ar ?limit=
and
.Ar ?offset= ,
and print the URL of the next and previous page along with how many entries it
holds.
Paging is by whole entries, never by bytes.
Message bodies are never truncated; instead every link leading to one carries an
approximate size, and the client decides whether to follow it:
.Bd -literal -offset indent
read: /msg/28755 (~609K)
.Ed
.Pp
The figure is marked
.Sq ~
because it comes from
.Cm RFC822.SIZE ,
the whole message on the wire, whereas what is rendered is one part converted to
text; what it separates reliably is a small notification from a large digest.
A message with no recorded size, or whose structure has never been examined,
says so rather than reporting zero or nothing.
.Ss Saying who wrote what
Almost everything on a mail page was written by somebody else \(en the body, but
also the subject, the sender's display name and the
.Li List-Unsubscribe
value.
Every text rendering is therefore divided into regions introduced by a marker
line, with the message body enclosed between
.Li content
and
.Li "end content" :
.Bd -literal -offset indent
--- mailweb:PLTMe4uCBd0 metadata ---
--- mailweb:PLTMe4uCBd0 content ---
--- mailweb:PLTMe4uCBd0 end content ---
.Ed
.Pp
The regions are
.Li metadata ,
.Li attachments ,
.Li content
and
.Li routes .
The token is not a fixed string: each response draws 64 random bits, so a sender
cannot forge a marker by reading this manual.
The banner on the content region states in words that what follows is to be read
as data rather than obeyed as instruction.
.Pp
The same distinction is drawn field by field.
A name in
.Li ~tildes
was assigned by the reader; a name in
.Li \(dqquotes\(dq
was written by the sender and is not verified.
See
.Sx SAYING WHO WROTE WHAT
in
.Xr mailweb 7
for why the token is random and what it defends against, and
.Sx PETNAMES
there for what the two name forms mean.
.Sh SECURITY
Message bodies are attacker-controlled HTML and are treated as such.
Three independent layers apply, each sufficient on its own to stop scripts:
.Bl -bullet -compact
.It
A
.Li Content-Security-Policy
meta tag of
.Li script-src 'none'; img-src 'self' ,
blocking all scripting and all remote image loads.
Because remote images are blocked, opening a message cannot phone home to a
tracking pixel.
.It
An iframe
.Li sandbox
attribute that omits
.Li allow-scripts .
.It
.Li <base target="_blank"> ,
so every link in a message opens in a new tab and can never navigate the frame
itself.
.El
.Pp
The outer page grants the iframe
.Li allow-same-origin
purely so it can read the frame's height to size it; this is safe only because
.Li allow-scripts
is absent, and the two must never be granted together.
.Pp
A framed PDF is the one place
.Li allow-scripts
is granted, because a PDF viewer is script and nothing renders without it.
That frame therefore withholds
.Li allow-same-origin ,
which makes it an opaque origin: it cannot read this page, fetch from it, or
reach anything of the account's.
The rule is unchanged and the frames sit on opposite sides of it \(en a message
body gets the origin and no script, a PDF gets script and no origin.
.Pp
What the pairing costs was measured rather than assumed: a frame granted both
read the embedding page's title and fetched 4345 bytes of mailweb's own page
from inside itself.
Since mailweb has no authentication and no CSRF protection, script in its origin
is the whole archive plus the ability to send mail.
The consequence of withholding
.Li allow-same-origin
is that such a frame cannot be sized to its content, so a PDF frame has a fixed
height and scrolls within it.
.Sh FILES
.Bl -tag -width Ds
.It Pa ./mailweb.db
Default database location; override with
.Fl -db .
Opened in WAL mode with a 30 second busy timeout, through two pools: a
single-connection write pool for migrations, synchronisation and every mutation,
and an eight-connection
.Li mode=ro
read pool for everything that renders a page.
.El
.Pp
The schema is versioned and migrations are applied once, in order, inside a
transaction each:
.Bl -tag -width "mailbox_uidvalidity_log" -compact
.It Li schema_version
Applied migrations.
.It Li mailbox_uidvalidity_log
Every UIDVALIDITY ever seen per mailbox; a second row means the mailbox was
reconstructed.
.It Li messages
One row per message: envelope fields, the raw header block, the size reported by
the server, and the cached display part with its MIME type.
Keyed uniquely on
.Pq mailbox , uid , uidvalidity .
.It Li message_headers
One row per header field per message, name lower-cased, values unfolded and
encoded-word decoded, ordering preserved.
This is what the contacts, forge and unsubscribe features query.
.It Li contact_flags
Per-address flags:
.Li hidden ,
.Li important ,
.Li spam .
.It Li contact_petnames
The name the account owner assigned to an address.
Keyed by address alone, with no unique index on the name.
.It Li attachments
One row per attachment: position, IMAP section path, type, filename and size.
Whether it has been populated for a message is recorded on the message itself,
in
.Li bodystructure_scanned_at .
.It Li drafts
One row per reply being written, addressed by a random token.
.It Li draft_blocks
The ordered contents of a draft, one row per block.
.It Li draft_assets
Files attached to a draft, stored inline.
.It Li draft_recipients
Who a draft may be sent to, one row per address per named set, resolved when the
draft was created.
.It Li pdfjs_asset
The vendored pdf.js viewer, one row per file per generation.
.It Li pdfjs_head
Which generation is live and which upstream release it came from.
Exactly one row.
.El
.Pp
The four draft tables are the only ones holding anything that did not come off
the server, and nothing that reconciles the mirror touches them.
That is what lets a draft outlive the message it answers.
.Pp
The two
.Li pdfjs_
tables are the only ones holding anything that came from neither the server nor
this machine, and they sit oddly beside everything else here: the mirror stores
headers so that years of mail cost megabytes, and the viewer is about 6.5MB of
JavaScript in the same file, which is larger than the mail.
It is in the database because that is the only per-instance state mailweb has,
and because it is replaced at runtime rather than at build time.
.Pp
A new release is written under a new generation and
.Li pdfjs_head
is flipped in the same transaction, so a request either sees the whole old
viewer or the whole new one.
The generation before the live one is kept rather than collected: a page loaded
moments before an update is still fetching
.Pa viewer.mjs
and
.Pa pdf.worker.mjs ,
and pulling those out from under it would break the frame it was about to draw.
.Sh EXAMPLES
Discover the exact mailbox names on the server:
.Bd -literal -offset indent
$ mailweb --imap-host=imap.example.org \e
    --imap-user=me@example.org \e
    --imap-pass-cmd='pass email/example' \e
    --list-mailboxes
.Ed
.Pp
Serve two mailboxes, without send support:
.Bd -literal -offset indent
$ mailweb --imap-host=imap.example.org \e
    --imap-user=me@example.org \e
    --imap-pass-cmd='pass email/example' \e
    --mailbox=INBOX --mailbox=Archive
.Ed
.Pp
Full configuration with sending enabled, as used by the shipped
.Pa mailweb-profpatsch.service :
.Bd -literal -offset indent
$ mailweb --imap-host=imap.mailbox.org \e
    --imap-user=mail@profpatsch.de \e
    --imap-pass-cmd='pass email/mailbox.org' \e
    --smtp-host=smtp.mailbox.org \e
    --smtp-pass-cmd='pass email/mailbox.org' \e
    --account-name=profpatsch \e
    --listen=127.0.0.1:8776 \e
    --db=$HOME/.local/share/mailweb/profpatsch.db \e
    --mailbox=INBOX --mailbox=Archive --mailbox=Sent
.Ed
.Pp
A second account alongside it, as
.Pa mailweb-qualle.service .
Everything that distinguishes the two instances is on this command line: a
different database, a different port and a different label.
The mailbox holding sent mail is named explicitly because strato calls it
.Li "Sent Items" ,
and SMTP uses the same password as IMAP:
.Bd -literal -offset indent
$ mailweb --imap-host=imap.strato.de \e
    --imap-user=info@qualleaugsburg.de \e
    --imap-pass-cmd='pass offline/qualle/mail-pass' \e
    --smtp-host=smtp.strato.de \e
    --smtp-pass-cmd='pass offline/qualle/mail-pass' \e
    --account-name=qualle \e
    --sent-mailbox='Sent Items' \e
    --listen=127.0.0.1:8777 \e
    --db=$HOME/.local/share/mailweb/qualle.db \e
    --mailbox=INBOX --mailbox='Sent Items'
.Ed
.Pp
Note what enabling SMTP costs on a shared address: with no authentication and no
CSRF protection, any page the browser visits can then send mail under the name
of everyone who shares the account.
An account kept for reading omits
.Fl -smtp-host .
.Pp
Survey which MIME shapes the archive actually contains, and which part the
selection algorithm picks for each:
.Bd -literal -offset indent
$ mailweb --imap-host=imap.example.org \e
    --imap-user=me@example.org \e
    --imap-pass-cmd='pass email/example' \e
    --analyze
.Ed
.Pp
Read the mail from the command line, which is what
.Li text/llm
is for:
.Bd -literal -offset indent
$ curl -s -H 'Accept: text/llm' localhost:8776/?since=today
$ curl -s 'localhost:8776/contacts?view=llm'
.Ed
.Sh SEE ALSO
.Xr pass 1 ,
.Xr systemd.service 5 ,
.Xr mailweb 7
.Pp
RFC 3501
.Pq IMAP4rev1 ,
RFC 2177
.Pq IMAP IDLE ,
RFC 5322
.Pq Internet Message Format ,
RFC 8058
.Pq List-Unsubscribe .
.Sh AUTHORS
.An Profpatsch
.Sh CAVEATS
.Ss No authentication
.Nm
has no authentication, no authorisation and no CSRF protection whatsoever.
Every mutating action \(en hiding a contact, sending mail, unsubscribing, filing
a spam report \(en is a plain
.Li POST
that any page in the browser can trigger.
Anyone who can reach the listen address has full use of the mail account.
The default
.Ar localhost:8080
is the only safe configuration; exposing it requires putting an authenticating
reverse proxy in front, and even then any site the browser visits can forge
requests to it.
.Ss Passwords on the command line
.Fl -imap-pass
and
.Fl -smtp-pass
place the password in the process table, where every user on the machine can
read it.
Prefer
.Fl -imap-pass-cmd
and
.Fl -smtp-pass-cmd ,
which are re-executed at startup and leave only the command name visible.
.Ss The PDF viewer is downloaded and executed unattended
With
.Fl -pdfjs-update
on, which is the default, mailweb fetches the current pdf.js release from GitHub
and stores it, without a person reading a line of it.
That is about 6.5MB of somebody else's JavaScript, refreshed whenever upstream
publishes, running in a browser tab that also holds the whole mirrored archive.
.Pp
The frame it runs in withholds
.Li allow-same-origin ,
so it is an opaque origin and cannot read mailweb's pages or reach its routes;
that is what makes this tolerable rather than reckless, and it is why the two
sandbox tokens must never be granted together.
It is not the same as safe.
A viewer that renders a document is a viewer that can be told what to render,
and pdf.js has had bugs of exactly the shape that matters here \(en
CVE-2024-4367 was arbitrary script execution in the embedding origin from a
crafted font matrix.
Against that, an opaque origin is the whole of the defence.
.Pp
Trust rests on TLS to github.com and on the release being Mozilla's.
There is no signature check and no pinned hash, so a compromised release is
executed like any other.
.Fl -pdfjs-update Ns = Ns Cm false
freezes whatever is already stored and contacts nobody.
.Ss Hardcoded values
Several values are compile-time constants rather than options:
.Bl -bullet -compact
.It
Spam reports are addressed to
.Li allgemeiner-spam@internet-beschwerdestelle.de ,
or
.Li besonderer-spam@
when the illegal-content box is ticked, with a German-language cover note.
This is the German complaints office and is unlikely to be the right recipient
elsewhere.
Both names are German words, not translations of them: the office publishes
these same addresses on its English-language page.
The cover note lists the
.Li From:\&
header of each attached message, and its
.Li Return-Path
where the message has one.
.It
The backfill window is two years.
Mail older than that is never synced, no matter which mailboxes are watched;
messages already in the database are unaffected.
.El
.Ss Matching is approximate
Contact and thread membership is determined with SQL
.Li LIKE '%address%'
over the stored JSON address fields, so an address that is a substring of
another will match it.
Forge threads are grouped by the issue number parsed out of the subject line; a
subject that does not match the expected shape becomes a thread of its own.
.Pp
This decides what is
.Em offered
and never what is
.Em done :
nothing that sends mail, writes a flag or names a sender to somebody else rests
on it.
See
.Sx WHAT IS OFFERED AND WHAT IS DONE
in
.Xr mailweb 7 .
.Ss Senders are not authenticated
A contact is an address taken from a
.Li From:\&
header, which is written by whoever sent the mail.
.Li SPF ,
.Li DKIM
and
.Li DMARC
results are mirrored like any other header and never consulted; nothing anywhere
checks whether a message came from the address it claims.
Two addresses matching says only that they name the same contact.
.Pp
A petname does not change this \(en it records that the reader has seen an
address before and chose to call it something.
What it does is stop
.Nm
from printing a stranger's chosen display name in the same voice as a name the
reader chose.
See
.Sx SENDERS ARE NOT AUTHENTICATED
in
.Xr mailweb 7
for what this costs a spam report.
.Ss A sent report is not a delivered one
.Nm
reports success once its SMTP server has accepted the message, and acceptance is
not delivery.
A provider's own outbound filter may reject the mail afterwards, and that
rejection arrives asynchronously as a bounce in the account's
.Li INBOX ,
where nothing looks at it \(en while the form came back green and every trace
.Nm
leaves says the complaint was made.
This is the expected failure for a spam report, not an exotic one; it has been
observed with the shipped configuration.
A report that matters is confirmed by looking for a bounce a few minutes later.
.Ss Read-only mirror
Mailboxes are selected read-only.
Flag changes made in another client are never reflected.
There is no unread state and no search, and a reply does not mark the message it
answers as answered, here or anywhere else.
.Pp
Deletion, by contrast, is followed: a message expunged on the server is deleted
locally at the next reconciliation, and its header rows go with it, so it also
disappears from the contacts and forge views.
.Nm
cannot show what the server no longer has, since it never stored the body.
Mail moved by a server-side filter is not lost this way as long as its
destination is also watched.
Reconciliation only ever runs against a mailbox that was successfully selected
and searched, so an unreachable mailbox, or one dropped from
.Fl -mailbox ,
does not have its messages deleted.
A message newer than the search that decided the prune is never deleted by it,
so mail arriving mid-reconciliation is not mistaken for mail that left; it is
considered by the next one.
Deletion is thus followed promptly but never eagerly.
.Pp
A message read within moments of arriving may briefly be fetched over a pooled
connection that has not yet heard of it.
This is retried transparently and logged, and costs one extra round-trip on the
first read of very new mail.
Only an empty answer that survives the retry is reported as an expunged
message, so that report can be believed.
.Ss Sync robustness
The initial sync is fatal on error: if any watched mailbox fails to sync at
startup,
.Nm
exits rather than serving a partial view.
A mailbox named with
.Fl -mailbox
that does not exist on the server will therefore prevent startup entirely; use
.Fl -list-mailboxes
to confirm the exact names.