Author Topic: How to change Mailbox folder / mount point  (Read 18229 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
How to change Mailbox folder / mount point
« on: April 17, 2015, 06:38:04 AM »
I have install Centos 6 with disk partition like this:

Filesystem      Size  Used Avail Use% Mounted on
rootfs           20G  9.7G  8.6G  54% /
/dev/root        20G  9.7G  8.6G  54% /
devtmpfs        3.9G  320K  3.9G   1% /dev
/dev/sda2       898G  158G  694G  19% /home
tmpfs           3.9G     0  3.9G   0% /dev/shm
/dev/root        20G  9.7G  8.6G  54% /var/named/chroot/etc/named
/dev/root        20G  9.7G  8.6G  54% /var/named/chroot/var/named
/dev/root        20G  9.7G  8.6G  54% /var/named/chroot/etc/named.conf
/dev/root        20G  9.7G  8.6G  54% /var/named/chroot/etc/named.rfc1912.zones
/dev/root        20G  9.7G  8.6G  54% /var/named/chroot/etc/rndc.key
/dev/root        20G  9.7G  8.6G  54% /var/named/chroot/usr/lib64/bind
/dev/root        20G  9.7G  8.6G  54% /var/named/chroot/etc/named.iscdlv.key
/dev/root        20G  9.7G  8.6G  54% /var/named/chroot/etc/named.root.key

is it possible to change mailbox folder from /var/vmail/domainname.com/account-name/ to another (example: /home/account/vmail/domainname.com/account-name/) ?

Thank you

Offline
*
Re: How to change Mailbox folder / mount point
« Reply #1 on: May 02, 2015, 10:47:14 AM »
Even I wanna know this. @Admin kindly reply

Offline
***
Re: How to change Mailbox folder / mount point
« Reply #2 on: May 03, 2015, 04:32:21 AM »
I have tried to supply you a script to do that but i think you cannot do that without cwp code changes. (and you cannot do that) so i don't think you can do.

For sure, you can move files, create a symlink and so on, the problem comes when you create the new inboxes.

You have to check wich user is the target of that domain inbox. This check has to be performed each time you move a folder and each time you create a new inbox, so it's a task of the CWP.

I don't figure out how can you check for user, otherwise you will not known where /home folder to put them.
« Last Edit: May 03, 2015, 04:40:24 AM by erm3nda »
8==D it's a function that try to compare 8 (int) against D (string) which returns True or False depending on the asker.

Offline
*
Re: How to change Mailbox folder / mount point
« Reply #3 on: May 04, 2015, 09:18:28 PM »
probably the best way to test it would be creating a sym link.
AntiDDoS Protection (web + mail)
http://centos-webpanel.com/website-ddos-protection-proxy

Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp


Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor


Do you need Fast and FREE Support included for your CWP linux server?
http://centos-webpanel.com/noc-partner-list
Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services

Offline
***
Re: How to change Mailbox folder / mount point
« Reply #4 on: May 05, 2015, 05:32:19 AM »
probably the best way to test it would be creating a sym link.

This is partially true.

The symlink cannot handle a scenario with accounts set up with subdomains.
There isn't a way to check wich user have wich sudomain from a symlink... so if the cwp doesn't handle with that you will got UGLY fails when a user sets up a new account with an present domain.
8==D it's a function that try to compare 8 (int) against D (string) which returns True or False depending on the asker.

Offline
*
Re: How to change Mailbox folder / mount point
« Reply #5 on: December 16, 2019, 10:49:30 PM »
I found a way, dont know it's exactly the same as your looking for but all the auto email creation stuff works and everything BUT if you rebuild the mail config for whatever reason you must do this again

this file also demonstrates me putting email in /home to follow the quota requirements  change as your build needs this
tested on xfs system only

edit the main dovecot file
nano /etc/dovecot/dovecot.conf
and make sure
mail_location = maildir:/home/%u/%d/%n
save and exit
now the wierd part

edit this one
nano /etc/dovecot/dovecot-mysql.conf

and change all the /var/vmail links to the path you need mine is posted bellow

# following should all be on one line.
password_query = SELECT username as user, password, concat('/home/%d/', maildir) as userdb_home, concat('maildir:/home/%d/', maildir) as userdb_mail, 101 as userdb_uid, 12 as userdb_gid FROM mailbox WHERE username = '%u' AND active = '1'

# following should all be on one line
user_query = SELECT concat('/home/%d/', maildir) as home, concat('maildir:/home/%d/', maildir) as mail, 101 AS uid, 12 AS gid, CONCAT('*:messages=0:bytes=', quota) as quota_rule FROM mailbox WHERE username = '%u' AND active = '1'

iterate_query = SELECT username AS user FROM mailbox


I hope this helps it did work for me make sure to restart the dovecot service, and also move the email if needed it will not copy it




Offline
*
Re: How to change Mailbox folder / mount point
« Reply #6 on: January 16, 2020, 05:27:38 PM »
Thanks a lot @wes
The file
/etc/dovecot/dovecot-mysql.conf
will of course be updated by the CWP auto update feature, how are you doing about this?
 ;)


I found a way, dont know it's exactly the same as your looking for but all the auto email creation stuff works and everything BUT if you rebuild the mail config for whatever reason you must do this again

this file also demonstrates me putting email in /home to follow the quota requirements  change as your build needs this
tested on xfs system only

edit the main dovecot file
nano /etc/dovecot/dovecot.conf
and make sure
mail_location = maildir:/home/%u/%d/%n
save and exit
now the wierd part

edit this one
nano /etc/dovecot/dovecot-mysql.conf

and change all the /var/vmail links to the path you need mine is posted bellow

# following should all be on one line.
password_query = SELECT username as user, password, concat('/home/%d/', maildir) as userdb_home, concat('maildir:/home/%d/', maildir) as userdb_mail, 101 as userdb_uid, 12 as userdb_gid FROM mailbox WHERE username = '%u' AND active = '1'

# following should all be on one line
user_query = SELECT concat('/home/%d/', maildir) as home, concat('maildir:/home/%d/', maildir) as mail, 101 AS uid, 12 AS gid, CONCAT('*:messages=0:bytes=', quota) as quota_rule FROM mailbox WHERE username = '%u' AND active = '1'

iterate_query = SELECT username AS user FROM mailbox


I hope this helps it did work for me make sure to restart the dovecot service, and also move the email if needed it will not copy it

Offline
*
Re: How to change Mailbox folder / mount point
« Reply #7 on: January 22, 2020, 12:16:19 PM »
Hi,

Are you using this solution?

I'm also interested in changing the mail folder to another location but like said above , future updates could mess things no?


I found a way, dont know it's exactly the same as your looking for but all the auto email creation stuff works and everything BUT if you rebuild the mail config for whatever reason you must do this again

this file also demonstrates me putting email in /home to follow the quota requirements  change as your build needs this
tested on xfs system only

edit the main dovecot file
nano /etc/dovecot/dovecot.conf
and make sure
mail_location = maildir:/home/%u/%d/%n
save and exit
now the wierd part

edit this one
nano /etc/dovecot/dovecot-mysql.conf

and change all the /var/vmail links to the path you need mine is posted bellow

# following should all be on one line.
password_query = SELECT username as user, password, concat('/home/%d/', maildir) as userdb_home, concat('maildir:/home/%d/', maildir) as userdb_mail, 101 as userdb_uid, 12 as userdb_gid FROM mailbox WHERE username = '%u' AND active = '1'

# following should all be on one line
user_query = SELECT concat('/home/%d/', maildir) as home, concat('maildir:/home/%d/', maildir) as mail, 101 AS uid, 12 AS gid, CONCAT('*:messages=0:bytes=', quota) as quota_rule FROM mailbox WHERE username = '%u' AND active = '1'

iterate_query = SELECT username AS user FROM mailbox


I hope this helps it did work for me make sure to restart the dovecot service, and also move the email if needed it will not copy it

Offline
*
Re: How to change Mailbox folder / mount point
« Reply #8 on: January 22, 2020, 01:12:44 PM »
Anyway i've created an symbolic link for the vmail folder and at this time i havent found any issue with the email operations.

Everything seems to be correctly created in the vmail folder and no errors are ocurring .

What exactly are the issues expected with this solution ?


Thanks