Move a message to an other mailbox using CLI only

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
vdagost-fr
Posts: 43
Joined: Mon Apr 11, 2016 11:59 am

Move a message to an other mailbox using CLI only

Post 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
yeeP6rai
Posts: 41
Joined: Mon Feb 12, 2018 10:16 am

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

Post by yeeP6rai »

User avatar
gabrieles
Outstanding Member
Outstanding Member
Posts: 236
Joined: Tue Feb 14, 2017 9:40 am

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

Post 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.
killmasta93
Posts: 47
Joined: Tue Oct 04, 2016 9:54 pm

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

Post by killmasta93 »

dont want to necropost but is there another way that does not involve CLI only?
Post Reply