Re: Renaming mailboxes

2020-06-05 Thread Marco



Hello David,

Il 27/05/2020 16:48, David Moyes ha scritto:


I want to rename a mailbox (and all of its descendants), however I am
struggling with what, on the surface, would appear to be a simple task.

I first tried to use cyradm rename command to rename user.foo to
user@example.com, like this:

 localhost> rename user.foo user@example.com

However the rename command does not appear to be recursive, and I could
not find any argument to tell it to recurse. Do I have this right or am
I doing something wrong?


from what I remember, the rename is "recursive". If you login as an 
admin you can simply rename all users mailboxes from a name to a new 
name in a single step.


If you login as the user, then you have to move all folders as you 
describe below. Pay attention to specialuse folders and to the xapian 
indexes which could increase a lot.


I didn't remember on cyradm, but I currently use Cyrus::IMAP::Admin for 
almost all my scripts. I don't know if something of this could be useful 
for you:


https://github.com/falon/cyr_scripts
https://cloudsmith.io/~csi/repos/cyrus-scripts/packages/

(see at cyr_moveMailboxPart.pl, cyr_moveINBOX.pl)

Greetings
Marco


I decided to try it in a Perl script using Cyrus::IMAP::Admin. By doing
a `list` I could get the mailbox and its descendants like this:

 @mailboxes = $client->list("user/$oldname");
 @mailboxes_sub = $client->list("user/$oldname/*");
 push (@mailboxes , @mailboxes_sub);

(I found that listing "user/$oldname*" got me user.foo but also
user.foobar so I had to combine two calls to prevent that.)

Then I could iterate over the mailboxes doing

 $client->rename( $oldmailbox, $mailbox );

However, nothing works after the first rename; the program just exits,
not even "or die" error messages are displayed. In case it means
anything, the exit status is 141 which I think indicates a SIGPIPE (as
confirmed using `kill -l "$?"` which returns `PIPE`).

I did also notice a similar thing in cyradm, that after doing a rename
that subsequent action caused cyradm to exit:

localhost> rename user/testuser/Trash user/t...@example.net/Trash
renamemailbox:
localhost> lm  # this curiously returns nothing!

localhost> echo $?
0
localhost> lm
[cyrus@fee7fffd9be7 ~]$ echo $?
141


Any help would be greatly appreciated. I am currently using cyrus-imapd
3.0.13-3 on Arch Linux.



Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus




Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus


Re: renaming mailboxes

2005-05-19 Thread seph
Didi Rieder [EMAIL PROTECTED] writes:
 I'd like to rename user.foo to xuser.foo, and I can't seem to do this
 with cyrus 2.2.12, I do have allowusermoves set to yes. From cyradm:

 set the following in /etc/imapd.conf

 allowusermoves = yes

As I said in my first paragraph, I have alloweusermoves set to
yes. Also, my docs say :, not =

seph
---
Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: renaming mailboxes

2005-05-19 Thread Didi Rieder
--On Thursday, May 19, 2005 10:46:47 AM -0400 seph [EMAIL PROTECTED] 
wrote:

I'd like to rename user.foo to xuser.foo, and I can't seem to do this
with cyrus 2.2.12, I do have allowusermoves set to yes. From cyradm:
   imap cm user.foo
   imap rename user.foo user.bar
   imap rename user.bar xuser.bar
   renamemailbox: Operation is not supported on mailbox
Is there a cleaner way than using the filesystem and reconstruct?
set the following in /etc/imapd.conf
allowusermoves = yes
and try again
Didi
--
-
Didi Rieder
[EMAIL PROTECTED]
PGPKey ID: 3431D0B0
-
---
Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html