How to move mail from one user's folder to another, or to send it for external delivery: Difference between revisions

mNo edit summary
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Archive}}{{Unsupported}}
= How to move mail messages from one user's mail folder to another user =
= How to move mail messages from one user's mail folder to another user =
(or to send them to external delivery).
(or to send them to external delivery).
Line 8: Line 10:




* Then you need to prepare file with a lot of lines, like 1/25+1 of number of messages in his folder needed to copy. If, for example, the messages from folder /test need to be moved, then this file should have the first line: "search 'in:test'" and all other lines: "search -n" (means "give next page of the search results"), like:
* Then you need to prepare file with a lot of lines, like 1/25+1 of number of messages in his folder needed to copy. If, for example, the messages from folder /test need to be moved, then this file should have the first line: "search -t message 'in:test'" and all other lines: "search -n" (means "give next page of the search results"), like:






         search 'in:test'
         search -t message 'in:test'
         search -n
         search -n
         search -n
         search -n
Line 39: Line 41:
(if there are a lot of messages, it's better to create a file with lines "am $i" and to feed them to zmmailbox because it starts slowly.
(if there are a lot of messages, it's better to create a file with lines "am $i" and to feed them to zmmailbox because it starts slowly.


* If the messages should be sended to external domain, then the last step may be something like this:
* If the messages should be sent to an external domain, then the last step maybe something like this:




Line 49: Line 51:
         sendmail -i  <$i;   
         sendmail -i  <$i;   
       done
       done
{{Article Footer|unknown|8/20/2008}}
[[Category:Administration]]

Latest revision as of 07:42, 26 February 2020


How to move mail messages from one user's mail folder to another user

(or to send them to external delivery).

  • First you need to identify zimbra store folder of this user, like


        mysql -e "select * from zimbra.mailbox where comment like 'user@domain.com'"


  • Then you need to prepare file with a lot of lines, like 1/25+1 of number of messages in his folder needed to copy. If, for example, the messages from folder /test need to be moved, then this file should have the first line: "search -t message 'in:test'" and all other lines: "search -n" (means "give next page of the search results"), like:


        search -t message 'in:test'
        search -n
        search -n
        ....
        search -n


  • Then you feed this file to zmmailbox to get message IDs:


        zmmailbox -z -m user@impulse.net  messagelist.txt


  • And then we ready to get all the messages in the format ready to feed them to sendmail:


        for i in `grep '^[0-9]' messagelist.txt | awk '{print $2}' | sed 's/-//'`; do
          find /opt/zimbra/store/0//msg/ -name $i\* >> filelist.txt
        done
        for i in `cat filelist.txt`; do
          zmmailbox -z -m  am  $i;
        done


(if there are a lot of messages, it's better to create a file with lines "am $i" and to feed them to zmmailbox because it starts slowly.

  • If the messages should be sent to an external domain, then the last step maybe something like this:


     for i in `grep '^[0-9]' messagelist.txt | awk '{print $2}' | sed 's/-//'`; do
       find /opt/zimbra/store/0//msg/ -name $i\* >> filelist.txt;
     done
     for i in `cat filelist.txt`; do
       sendmail -i  <$i;  
     done


Verified Against: unknown Date Created: 8/20/2008
Article ID: https://wiki.zimbra.com/index.php?title=How_to_move_mail_from_one_user%27s_folder_to_another,_or_to_send_it_for_external_delivery Date Modified: 2020-02-26



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search