• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Forwarding an entire mailbox?

Eric Pretorious

Regular Pleskian
A client has requested that one of their e-mail addresses (e.g., fred@example.com) be forwarded to another of their e-mail addresses (e.g., barney@example.com) but there are already a few hundred e-mail messages in Fred's mailbox.

Is there an easy way to move those messages from Fred's mail spool to to Barney's mail spool?
 
You can copy the email contents directly through SHELL with

Code:
scp -r /var/qmail/mailnames/from_domain.com/from_email/* /var/qmail/mailnames/to_domain.com/to_email/*
chown -R popuser:popuser /var/qmail/mailnames/to_domain.com/*
 
You can copy the email contents directly through SHELL with

Code:
scp -r /var/qmail/mailnames/from_domain.com/from_email/* /var/qmail/mailnames/to_domain.com/to_email/*
chown -R popuser:popuser /var/qmail/mailnames/to_domain.com/*

Thanks, Abdi:

Can/Should I copy the contents of Fred's Maildir/cur subdirectory to Barney's Maildir/new subdirectory? e.g.,

Code:
[root@www fred]# tree -d
.
├── @attachments
└── Maildir
    ├── courierimapkeywords
    ├── [COLOR="#00FF00"]cur[/COLOR]
    ├── [COLOR="#FF0000"]new[/COLOR]
    └── tmp
Or is there some metadata or tagging that would interfere with placing the current messages in the Maildir/new subdirectory?
 
Thanks, Abdi:

Can/Should I copy the contents of Fred's Maildir/cur subdirectory to Barney's Maildir/new subdirectory?... Or is there some metadata or tagging that would interfere with placing the current messages in the Maildir/new subdirectory?
And what about the contents of the maildirsize and courierimapuiddb files? Will moving the files into the subdirectories cause errors will these data files?
Code:
[root@mail fred]# for x in maildirsize courierimapuiddb ; do echo -e "\n$x\n============" ; head Maildir/$x ; done

maildirsize
============
0S,0C
           0           0
        2236            1
        1901            1
         896            1
        4706            1
        7240            1
        7464            1
        7329            1
        7400            1

courierimapuiddb
============
1 1379734202 136
1 1379734173.M370392P21576V000000000000CA01I000000000011C174.mail.example.com,S=2236
2 1379734251.M683539P21962V000000000000CA01I000000000011C182.mail.example.com,S=1901
3 1379736216.M56489P30712V000000000000CA01I000000000011C1D7.mail.example.com,S=4706
4 1379737258.M761139P31494V000000000000CA01I000000000011C1DD.mail.example.com,S=7240
5 1379737259.M89796P31511V000000000000CA01I000000000011C1F4.mail.example.com,S=7464
6 1379737530.M838652P31639V000000000000CA01I000000000011C1EE.mail.example.com,S=7329
7 1379743070.M470047P17169V000000000000CA01I000000000011C1F6.mail.example.com,S=7400
8 1379745047.M24357P21357V000000000000CA01I000000000011C200.mail.example.com,S=2664
9 1379749204.M947796P23740V000000000000CA01I000000000011C2BB.mail.example.com,S=7721
e.g., If I copy the files from fred/Mailbox/cur to barney/Mailbox/new, Firebird/Iceweasel complains when retrieving mail for Barney:

The RETR command did not succeed. Error retrieving a message. Mail server example.com responded: Can't open the message file - it's gone!
 
You can copy the email contents directly through SHELL with

Code:
chown -R popuser:popuser /var/qmail/mailnames/to_domain.com/*

And what about the contents of the maildirsize and courierimapuiddb files? Will moving the files into the subdirectories cause errors will these data files? ...e.g., If I copy the files from fred/Mailbox/cur to barney/Mailbox/new, Firebird/Iceweasel complains when retrieving mail for Barney:
The RETR command did not succeed. Error retrieving a message. Mail server example.com responded: Can't open the message file - it's gone!

The error was caused because I forgot to change the filesystem ownership. i.e., This command resolved the errors (just as Abdi had instructed):
Code:
[root@mail mailnames]# chown popuser:popuser example.com/BarneyMaildir/cur/*
 
Last edited:
Safest way to copy mailboxes would be to use some kind of IMAP migration tool like imapsync.

That said, copying with cp -ar with the exception of courier* metadata files would do the trick as well. That way IMAP keywords may be lost, but this is OK in this case. Quota will be automatically recalculated some time in the future upon mail delivery.
 
Back
Top