Move a message to an other mailbox using CLI only

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

Move a message to an other mailbox using CLI only

Postby vdagost-fr » Fri Sep 20, 2019 9:08 am

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: 40
Joined: Mon Feb 12, 2018 10:16 am

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

Postby yeeP6rai » Mon Oct 14, 2019 11:17 am

User avatar
gabrieles
Advanced member
Advanced member
Posts: 146
Joined: Tue Feb 14, 2017 9:40 am

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

Postby gabrieles » Mon Oct 14, 2019 3:54 pm

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: 30
Joined: Tue Oct 04, 2016 9:54 pm

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

Postby killmasta93 » Fri Jul 17, 2020 2:13 pm

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

Return to “Administrators”

Who is online

Users browsing this forum: No registered users and 19 guests