Page 1 of 1

Move a message to an other mailbox using CLI only

Posted: Fri Sep 20, 2019 9:08 am
by vdagost-fr
Hello

Using CLI only, I do a zmmailbox search to find a message and then I can move it to an other folder.

Is-it possible to move (or copy) a message to an other mailbox folder ?

Regards,
Victor

Re: Move a message to an other mailbox using CLI only

Posted: Mon Oct 14, 2019 11:17 am
by yeeP6rai

Re: Move a message to an other mailbox using CLI only

Posted: Mon Oct 14, 2019 3:54 pm
by gabrieles
Use Imapsync to move a single message is an overkill

1. Find your the id of your message searching it in the source@mydomain.com account. The id is in the first column.
zmmailbox -z -m source@mydomain.com s -t message "[your search query]"

Code: Select all

       Id  Type   From                  Subject                                             Date
    -----  ----   --------------------  --------------------------------------------------  --------------
 1. 28454  mess   a                   xxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx  10/14/19 06:26
 2. 28453  mess   b                   yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy        10/13/19 06:26
 3. 28452  mess   c                   zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz       10/12/19 06:26

2. Locate the blobfile on the volume:
zmmetadump -m source@mydomain.com -i 28454

Code: Select all

....
uuid: <null>

[Blob Path]
/opt/zimbra/store/0/1/msg/6/28454-82395.msg

[Metadata]
....

3. Inject that blobfile directly in the desided folder of the destination@mydomain.com user:
zmmailbox -z -m destination@mydomain.com addMessage /Inbox/myfolder /opt/zimbra/store/0/1/msg/6/28454-82395.msg

4. If you want to perform move, you can delete the original after the inject:
zmmailbox -z -m source@mydomain.com deleteMessage 28454

You can inject multiple blobfile if my memory is correct.
I don't remember if metadata are kept or are set to new. Read/unread surely is not kept. Delivery date is calculated.

Re: Move a message to an other mailbox using CLI only

Posted: Fri Jul 17, 2020 2:13 pm
by killmasta93
dont want to necropost but is there another way that does not involve CLI only?