copy recursive mails from one account to another
Hi.
I tried to copy a mailbox on the same server from src-account1 to dest-account2 and tried to follow this page
https://doc.dovecot.org/admin_manual/migrating_mailboxes/
I have tried to get this command running via IMAP but sadly I was not able to bring it up and running. doveadm -D backup -u src-account1 -R dest-account2
This was working but only for INBOX, is there a option to copy the src-account1 recursively?
doveadm -D copy -u dest-account2 INBOX user src-account1
Please can anybody recommend a command to copy recursively mails from one mailbox to another on the same server.
doveadm config -n
# 2.2.36.4 (baf9232c1): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.24.2 (aaba65b7)
# OS: Linux 3.10.0-1160.59.1.el7.x86_64 x86_64 CentOS Linux release 7.9.2009
(Core)
# Hostname: mail.DOMAIN.com
auth_master_user_separator = *
auth_mechanisms = PLAIN LOGIN
deliver_log_format = from=%{from}, envelope_sender=%{from_envelope},
subject=%{subject}, msgid=%m, size=%{size}, %$
dict {
acl = mysql:/etc/dovecot/dovecot-share-folder.conf
quotadict = mysql:/etc/dovecot/dovecot-used-quota.conf
}
first_valid_uid = 2000
last_valid_uid = 2000
listen = * [::]
mail_attribute_dict = file:%Lh/dovecot-attributes
mail_gid = 2000
mail_location = maildir:%Lh/Maildir/:INDEX=%Lh/Maildir/
mail_plugins = quota mailbox_alias acl mail_log notify stats
mail_prefetch_count = 20
mail_uid = 2000
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 imapsieve vnd.dovecot.imapsieve
namespace {
inbox = yes
location =
mailbox Archive {
auto = no
special_use = \Archive
}
mailbox Archives {
auto = no
special_use = \Archive
}
mailbox "Deleted Messages" {
auto = no
special_use = \Trash
}
mailbox Drafts {
auto = subscribe
special_use = \Drafts
}
mailbox Junk {
auto = subscribe
special_use = \Junk
}
mailbox "Junk E-mail" {
auto = no
special_use = \Junk
}
mailbox Sent {
auto = subscribe
special_use = \Sent
}
mailbox "Sent Items" {
auto = no
special_use = \Sent
}
mailbox "Sent Messages" {
auto = no
special_use = \Sent
}
mailbox Spam {
auto = no
special_use = \Junk
}
mailbox Trash {
auto = subscribe
special_use = \Trash
}
prefix =
separator = /
type = private
}
namespace {
list = children
location = maildir:%%Lh/Maildir/:INDEXPVT=%%Lh/Maildir/Shared/%%Ld/%%Ln
prefix = Shared/%%u/
separator = /
subscriptions = yes
type = shared
}
passdb {
args = /etc/dovecot/dovecot-mysql.conf
driver = sql
}
passdb {
args = /etc/dovecot/dovecot-master-users
driver = passwd-file
master = yes
}
plugin {
acl = vfile
acl_shared_dict = proxy::acl
imapsieve_mailbox1_before = file:/var/vmail/sieve/report_spam.sieve
imapsieve_mailbox1_causes = COPY APPEND
imapsieve_mailbox1_name = Junk
imapsieve_mailbox2_before = file:/var/vmail/sieve/report_ham.sieve
imapsieve_mailbox2_causes = COPY
imapsieve_mailbox2_from = Junk
imapsieve_mailbox2_name = *
imapsieve_url = sieve://192.168.122.173:4190
mail_log_events = delete undelete expunge mailbox_delete mailbox_rename
mail_log_fields = uid box msgid size from subject
mailbox_alias_new = Sent Messages
mailbox_alias_new2 = Sent Items
mailbox_alias_old = Sent
mailbox_alias_old2 = Sent
quota = dict:user::proxy::quotadict
quota_grace = 10%%
quota_warning = storage=100%% quota-warning 100 %u
quota_warning2 = storage=95%% quota-warning 95 %u
quota_warning3 = storage=90%% quota-warning 90 %u
quota_warning4 = storage=85%% quota-warning 85 %u
sieve = ~/sieve/dovecot.sieve
sieve_before = /var/vmail/sieve/dovecot.sieve
sieve_dir = ~/sieve
sieve_global_dir = /var/vmail/sieve
sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment
sieve_max_redirects = 30
sieve_pipe_bin_dir = /etc/dovecot/sieve/pipe
sieve_plugins = sieve_imapsieve sieve_extprograms
sieve_vacation_send_from_recipient = yes
stats_refresh = 30 secs
stats_track_cmds = yes
}
protocols = imap sieve lmtp
recipient_delimiter = -
service auth {
unix_listener /var/spool/postfix/private/dovecot-auth {
group = postfix
mode = 0666
user = postfix
}
unix_listener auth-master {
group = vmail
mode = 0666
user = vmail
}
unix_listener auth-userdb {
group = vmail
mode = 0660
user = vmail
}
}
service dict {
unix_listener dict {
group = vmail
mode = 0660
user = vmail
}
}
service imap-login {
process_limit = 500
service_count = 1
}
service lmtp {
executable = lmtp -L
inet_listener lmtp {
address = 127.0.0.1
port = 24
}
process_min_avail = 5
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
user = vmail
}
service managesieve-login {
inet_listener sieve {
port = 4190
}
}
service pop3-login {
service_count = 1
}
service quota-warning {
executable = script /usr/local/bin/dovecot-quota-warning.sh
unix_listener quota-warning {
group = vmail
mode = 0660
user = vmail
}
}
service stats {
fifo_listener stats-mail {
mode = 0644
user = vmail
}
inet_listener {
address = 127.0.0.1
port = 24242
}
}
ssl = required
ssl_cert = </etc/pki/tls/certs/iRedMail.crt
ssl_cipher_list =
EECDH+CHACHA20:ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5
ssl_key = # hidden, use -P to show it
ssl_prefer_server_ciphers = yes
syslog_facility = local5
userdb {
args = /etc/dovecot/dovecot-mysql.conf
driver = sql
}
protocol lda {
lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes
mail_plugins = quota mailbox_alias acl mail_log notify stats sieve
recipient_delimiter = -
}
protocol lmtp {
lmtp_save_to_detail_mailbox = yes
mail_plugins = quota sieve
recipient_delimiter = -
}
protocol imap {
imap_client_workarounds = tb-extra-mailbox-sep
mail_max_userip_connections = 30
mail_plugins = quota mailbox_alias acl mail_log notify stats imap_quota
imap_acl imap_stats imap_sieve
}
protocol pop3 {
mail_max_userip_connections = 30
mail_plugins = quota mailbox_alias acl mail_log notify stats
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
pop3_uidl_format = %08Xu%08Xv
}
Regards Alex
On Tue, 10 May 2022 22:48:01 +0200 Alex al-dovecot@none.at wrote:
Hi.
I tried to copy a mailbox on the same server from src-account1 to dest-account2 and tried to follow this page
https://doc.dovecot.org/admin_manual/migrating_mailboxes/
I have tried to get this command running via IMAP but sadly I was not able to bring it up and running. doveadm -D backup -u src-account1 -R dest-account2
This was working but only for INBOX, is there a option to copy the src-account1 recursively?
doveadm -D copy -u dest-account2 INBOX user src-account1
Please can anybody recommend a command to copy recursively mails from one mailbox to another on the same server.
Finally I have used imapsync because even the doveadm sync -1
have expunged
the mails on the source account. Maybe I have missued the doveadm tool
therefore I would be thankful to learn how to migrate a mailbox with doveadm
without the source is deleted.
imapsync --host1 localhost --user1 src-account1 \
--password1 PASS --ssl1 \
--host2 localhost --user2 dest-account2 \
--password2 PASS --ssl2 \
--exclude Shared
From what I have understood in the doc should doveadm backup
and doveadm sync
not delete any mails on the source, right?
https://wiki.dovecot.org/Tools/Doveadm/Sync
# doveadm -D sync -1 -u src-account1 -R maildir:/enc/vmail/vmail1/DOMAIN/u/s/e/dest-account2-2022.05.10.21.38.51/Maildir/
dsync(src-account1): Debug: brain M: Import INBOX: Import mail body for
GUID=1649141694....,S=2351,W=2460 UID=0
dsync(src-account1): Debug: Mailbox INBOX: Opened mail UID=246 because: copying
dsync(src-account1): Debug: brain M: Import INBOX: Saved UIDs:
864,768,683,861,806,792,661,889,1082,669,822,1183,902,1184,707,743,1075,1317,1342,1155,1170,1149,759,737,875,805,974,895,1097,1056,845,1141,1325,1111,688,1146,925,788,815,774,1121,1176,888,1102,705,662,799,921,871,1332,655,865,739,859,1085,1046,714,873,936,1145,1093,836,644,929,653,855,779,821,1152,1044,1313,701,966,1314,940,869,1125,803,626,850,1101,629,1323,797,718,1062,817,813,1337,711,894,1134,685,1109,823,843,928,1095,976,1147,1129,738,931,1167,631,758,874,1107,657,717,634,1092,1113,916,884,773,1333,1163,972,1081,968,637,656,1114,1140,1148,767,833,1112,879,924,1159,914,658,848,650,1153,789,1110,1130,920,1319,760,1171,770,691,678,819,828,651,846,646,937,700,1341,1156,814,1321,791,840,1090,756,1094,842,1066,1164,635,1161,918,935,856,986,715,808,807,1100,1132,1126,795,673,977,1154,1105,812,1169,1103,866,818,1339,778,1175,975,719,679,841,1087,713,1326,1083,887,654,765,885,709,783,979,1315,1173,769,1355,1336,775,728,1331,851,1162,1091,1127,732,1058,970,832,908,1119,868,1182,1098,927,780,1104,781,746,674,934,636,1060,969,801,1158,692,664,1057,1120,648,763,1084,922,883,749,670,867,800,727,761,668,1340,838,627,742,643,702,938,880,640,1043,829,790,782,1179,877,1115,754,1079,633,820,1080,933,793,704,1318,724,926,1059,967,716,1139,853,1144,835,854,1086,1137,831,1151,1123,675,741,723,699,786,1065,784,1088,663,734,1160,1077,863,939,1168,839,671,896,1106,971,847,672,766,1324,981,752,1157,1335,1166,690,639,857,697,913,826,911,878,1049,1108,1133,860,722,886,1089,703,729,1327,1128,720,785,736,1150,909,915,748,750,1061,645,649,1037,870,680,751,1124,1343,1096,1174,733,858,811,1055,772,630,731,852,1330,745,687,712,1045,1116,667,1142,652,912,1099,1185,710,721,1143,735,684,682,757,696,771,809,777,872,641,881,708,849,804,1117,1138,677,798,1320,810,824,980,794,660,762,834,1131,837,1178,796,891,1316,876,1328,698,1322,787,725,1047,1064,882,726,776,897,816,764,923,740,917,647,753,978,1122,901,1172,694,830,1076,755,693,659,1180,844,638,681,1329,666,930,1136,689,932,632,1177,695,1135,642,862,744,825,892,730,973,893,1048,686,628,1165,1118,802,676,665,919,1181,706,1078,983,827,747,910,890,898:900,903:907,941:965,982,984:985,987:1036,1038:1042,1050:1054,1063,1067:1074,1186:1312,1334,1338,1344:1354
dsync(src-account1): Info: expunge: box=INBOX, uid=...
dsync(src-account1): Info: expunge: box=INBOX, uid=...
dsync(src-account1): Info: expunge: box=INBOX, uid=...
dsync(src-account1): Info: expunge: box=INBOX, uid=...
dsync(src-account1): Info: expunge: box=INBOX, uid=...
doveadm config -n # 2.2.36.4 (baf9232c1): /etc/dovecot/dovecot.conf # Pigeonhole version 0.4.24.2 (aaba65b7) # OS: Linux 3.10.0-1160.59.1.el7.x86_64 x86_64 CentOS Linux release 7.9.2009 ...
Regards Alex
participants (2)
-
Aleksandar Lazic
-
Alex