e-mail-passwords in Plesk

Recently I had a project, where it was necessary to change the POP3 or IMAP-passwords for a user from within a webapplication.
The only way, I could figure out to do this, was to do a shell-command with a “sudo”-prefix.

But in order to change a mail-account’s password I had to know how Plesk stores the data for the passwords. It turns out that the passwords are stored in a database-table (or 3 to be precise [domains, mail, mailaccounts]).

So far – so good. It turns out, that Plesk stores or caches the data from these tables to a file on the disk. In my case the file was /var/qmail/users/cdb – I believe the path can differ on other systems.

So the way to change a password I use now is to change the value in the database and run
# /usr/local/psa/admin/sbin/mchk -v

May be I’ll find a better way some time. 😉

PS: I found the better way:
run this (with root-priveleges):

PSA_PASSWORD=”none” && /usr/local/psa/admin/sbin/mailmng –set-password –domain-name=yourdomain.de –mailname=yourmailbox

This updates the password for mailbox “yourmailbox@yourdomain.de” to “none”