mdbox_deleted proper syntax

Johan Huldtgren
Mon, 30 Jul 2018 23:45:06 -0000

I do not know, the data shown below was me trying to understand the
command and how it works, once I knew how the command worked I could
then look at the user in question's mailbox and see how it looked.

my question really boiled down to how do I use the mdbox_deleted
storage in the correct way? This led me down the rabbit hole of
fetch vs import. could you provide a correct example of using
mdbox_deleted with doveadm fetch?

thanks,

.jh

On 2018/07/29 23:48, Aki Tuomi wrote:
> Are you sure you have deleted mails and not just Trashed mails?
>
> Aki
>
>
> On 26.07.2018 19:23, Johan Huldtgren wrote:
>> hello,
>>
>> on the wiki, https://wiki2.dovecot.org/MailboxFormat/dbox, it says that
one can
>> use either doveadm fetch or doveadm import, however I can find no
correct syntax
>> with fetch that'll actually work. Is the idea to simply override
the
>> mail_location with -o ? That seems to work for doveadm mailbox but not
for
>> doveadm fetch or search
>>
>> # doveadm -f table mailbox status -u johan all dovecot
>> mailbox messages recent uidnext uidvalidity unseen highestmodseq vsize
guid                             firstsaved
>> dovecot 0        0      1       1362145026  0      1
164208086 64bd9f0003af305190040000b9256959 1471825482
>>
>> # doveadm -f table -o "mail_location=mdbox_deleted:~/mdbox"
mailbox status -u johan all dovecot
>> mailbox messages recent uidnext uidvalidity unseen highestmodseq vsize
guid                             firstsaved
>> dovecot 0        0      1       0           0      1             0
ddb9421479f0595bf21b0100b9256959 18446744073709551615
>>
>>
>> # doveadm -f flow fetch -u johan size.virtual mailbox dovecot
>> size.virtual=2869
>> size.virtual=2960
>> size.virtual=8023
>> size.virtual=6683
>> ...
>> #
>>
>> # doveadm -f flow -o "mail_location=mdbox_deleted:~/mdbox"
fetch -u johan size.virtual mailbox dovecot
>> #
>>
>> # doveadm search -u johan mailbox dovecot subject "LMTP Log"
>> 64bd9f0003af305190040000b9256959 8642
>> 64bd9f0003af305190040000b9256959 21302
>> 64bd9f0003af305190040000b9256959 21373
>> 64bd9f0003af305190040000b9256959 21420
>> 64bd9f0003af305190040000b9256959 21434
>> 64bd9f0003af305190040000b9256959 21435
>> 64bd9f0003af305190040000b9256959 21460
>> 64bd9f0003af305190040000b9256959 21461
>> 64bd9f0003af305190040000b9256959 21463
>> 64bd9f0003af305190040000b9256959 23684
>>
>> # doveadm -o "mail_location=mdbox_deleted:~/mdbox" search -u
johan mailbox dovecot subject "LMTP Log"
>> #
>>
>>
>> What I'm really trying to accomplish is see if a mail which a user
deleted still exists in mdbox_deleted, so I
>> wanted to do a fetch / search to see and then try to copy / import that
message back.
>>
>> This is on OpenBSD 6.3-current with dovecot 2.2.36, doveconf -n below.
>>
>> thanks,
>>
>> .jh
>>
>> ---
>>
>> # 2.2.36 (1f10bfa63): /etc/dovecot/dovecot.conf
>> # Pigeonhole version 0.4.24 (124e06aa)
>> # OS: OpenBSD 6.3 amd64
>> # Hostname: www.example.com
>> auth_mechanisms = plain login
>> first_valid_gid = 0
>> first_valid_uid = 507
>> imap_client_workarounds = delay-newmail tb-extra-mailbox-sep
tb-lsub-flags
>> imap_id_log = *
>> last_valid_uid = 1059
>> listen = 127.0.0.1
>> mail_home = /home/vmail/%d/%n
>> mail_location = mdbox:~/mdbox
>> mail_plugins = stats fts fts_solr
>> mail_privileged_group = _dovecot
>> mailbox_list_index = yes
>> managesieve_notify_capability = mailto
>> managesieve_sieve_capability = fileinto reject envelope
encoded-character vacation subaddress comparator-i;ascii-numeric relational
regex imap4flags copy include variables body enotify environment mailbox date
index ihave duplicate mime foreverypart extracttext spamtest spamtestplus
virustest
>> mbox_write_locks = fcntl
>> mmap_disable = yes
>> namespace {
>>   inbox = yes
>>   location >>   mailbox spam {
>>     auto = subscribe
>>     special_use = \Junk
>>   }
>>   mailbox drafts {
>>     auto = subscribe
>>     special_use = \Drafts
>>   }
>>   mailbox sent-mail {
>>     auto = subscribe
>>     special_use = \Sent
>>   }
>>   mailbox trash {
>>     auto = subscribe
>>     autoexpunge = 30 days
>>     special_use = \Trash
>>   }
>>   prefix >>   separator = /
>>   subscriptions = yes
>>   type = private
>> }
>> passdb {
>>   args = /etc/dovecot/dovecot-pgsql.conf
>>   driver = sql
>> }
>> passdb {
>>   args = /etc/dovecot/dovecot-pgsql2.conf
>>   driver = sql
>> }
>> passdb {
>>   args = cache_key=%u%r%l *
>>   driver = bsdauth
>> }
>> plugin {
>>   antispam_backend = mailtrain
>>   antispam_mail_notspam = learn_ham
>>   antispam_mail_sendmail = /usr/local/bin/rspamc
>>   antispam_mail_sendmail_args = -h;127.0.0.1:11334;-P;q1
>>   antispam_mail_spam = learn_spam
>>   antispam_spam = caughtspam
>>   antispam_trash = trash
>>   fts = solr
>>   fts_autoindex = yes
>>   fts_solr = url=http://127.0.0.1:8983/solr/dovecot/
>>   recipient_delimiter = +
>>   sieve = file:~/sieve;active=~/.dovecot.sieve
>>   sieve_before = /var/dovecot/sieve/before/
>>   sieve_default = /var/dovecot/sieve/default.sieve
>>   sieve_extensions = +spamtest +spamtestplus +virustest
>>   sieve_spamtest_max_header = X-Spamd-Result: default: [[:alnum:]]+
\[-?[[:digit:]]+\.[[:digit:]]+ / (-?[[:digit:]]+\.[[:digit:]]+)\]
>>   sieve_spamtest_status_header = X-Spamd-Result: default: [[:alnum:]]+
\[(-?[[:digit:]]+\.[[:digit:]]+) / -?[[:digit:]]+\.[[:digit:]]+\]
>>   sieve_spamtest_status_type = score
>>   sieve_virustest_status_header = X-Virus-Scan: Found to be (.+)\.
>>   sieve_virustest_status_type = text
>>   sieve_virustest_text_value1 = clean
>>   sieve_virustest_text_value5 = infected
>>   stats_refresh = 30 secs
>>   stats_track_cmds = yes
>> }
>> protocols = imap lmtp sieve
>> service auth {
>>   unix_listener /var/spool/postfix/private/auth {
>>     group = _postfix
>>     mode = 0666
>>     user = _postfix
>>   }
>> }
>> service imap-login {
>>   inet_listener imaps {
>>     port = 993
>>     ssl = yes
>>   }
>>   process_limit = 200
>> }
>> service lmtp {
>>   unix_listener /var/spool/postfix/private/dovecot-lmtp {
>>     group = _postfix
>>     user = _postfix
>>   }
>> }
>> service managesieve-login {
>>   inet_listener sieve {
>>     port = 4190
>>   }
>> }
>> service stats {
>>   fifo_listener stats-mail {
>>     mode = 0666
>>     user = _postfix
>>   }
>> }
>> ssl = required
>> ssl_cert = </etc/ssl/acme/example.com/fullchain.pem
>> ssl_key =  # hidden, use -P to show it
>> userdb {
>>   args = uid=507 gid=507
>>   driver = static
>> }
>> userdb {
>>   driver = passwd
>> }
>> verbose_proctitle = yes
>> protocol lmtp {
>>   mail_plugins = stats fts fts_solr sieve
>> }
>> protocol imap {
>>   mail_max_userip_connections = 50
>>   mail_plugins = stats fts fts_solr antispam imap_stats
>> }
>>
>