• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Creating Mail Accounts From the CLI

Eric Pretorious

Regular Pleskian
When I use the /usr/local/psa/admin/bin/mailmng script to update the password for a mail account, the account is removed:
Code:
[root@www postfix]# /usr/local/psa/admin/bin/mail_auth_view
Authentication database contents:
+--------------------------------------+-----+--------------------------------------+
|             address                  |flags|               password               |
+--------------------------------------+-----+--------------------------------------+
| ...<SNIP>...                         |     |                                      |
|                  [email protected]    |     |                           *********  |
| ...<SNIP>...                         |     |                                      |
+--------------------------------------+-----+--------------------------------------+
Flags
	A - account disabled
	D - domain disabled
	E - password encrypted
[root@www bin]# ./mailmng --set-password --domain-name=example.com --mailname=eric foobar123
[root@www bin]# ./mail_auth_view | grep eric
[root@www bin]#
When I use the /usr/local/psa/admin/bin/mailmng script to create a mail account, the account is not created:
Code:
[root@www bin]# ./mailmng --add-mailname --domain-name=example.com --mailname=eric
[root@www bin]# ./mail_auth_view | grep eric
[root@www bin]#
Have I misunderstood the output from the command `/usr/local/psa/admin/bin/mailmng --help-commands`?
Code:
Mailmng commands:
--add-mailname                                                                                                 adds mailname to the mail domain. Optionally sets the mailbox quota
...<SNIP>...
--set-password                                                                                                 sets the password for a mailname
        The noncrypted password is transferred in the environment variable PSA_PASSWORD,
        or crypted password is transferred in the environment variable PSA_CRYPTED_PASSWORD
...<SNIP>...
 
Last edited:
When I use the /usr/local/psa/admin/bin/mailmng script to update the password for a mail account, the account is removed:

The Web-based interface (i.e., https://www.Example.com:8443), however, restores the mailname to the database (i.e., /var/spool/postfix/plesk/passwd.db) and changes the password. :)

However, the Web-based interface does not restore the mailname and password in the Courier POP3/IMAP list of usernames/passwords. :(

How can I restore the POP3/IMAP credentials? e.g., If I use the Web-based interface to delete the e-mail account and then recreate it, will Plesk destroy the Maildir (/var/qmail/mailnames/example.com/eric)?
 
Last edited:
However, the Web-based interface does not restore the mailname and password in the Courier POP3/IMAP list of usernames/passwords. :(

My mail client (i.e., MUA) must be the problem:
Code:
eric@eric-x1:~$ openssl s_client -connect example.com:993
CONNECTED(00000003)
...<SNIP>...
---
* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=PLAIN IDLE ACL ACL2=UNION]
A1 LOGIN [email protected] <password>
A1 OK LOGIN Ok.
A1 LIST "" *
...<SNIP>...
A1 OK LIST completed

Code:
eric@eric-x1:~$ openssl s_client -connect example.com:995
CONNECTED(00000003)
...<SNIP>...
---
+OK Hello there. <[email protected]>
USER [email protected]
+OK Password required.
PASS <password>
LIST
+OK POP3 clients that break here, they violate STD53.
...<SNIP>...


ergo, the Web-based interface does correctly restore the Courier POP3/IMAP list of usernames/passwords! :)

BTW: Resources that I used to troubleshoot this (i.e., Useful reference material)...
 
Last edited:
Output of this command on Plesk 12:

[root@ppu12-0 ~]# /usr/local/psa/admin/bin/mailmng --help
Usage: mailmng <COMMAND> <COMMAND OPTIONS...>

WARNING: you are using legacy mailmng compatibility wrapper.
Please use one of the following utilities instead in the future:
mailmng-black-white
mailmng-core
mailmng-domain
mailmng-mailname
mailmng-server
mailmng-service

This wrapper suppresses any supplied STDIN. If you're getting errors like
'Failed to read and parse session mail data from STDIN.' then you should use one of the
utilities mentioned above and supply valid STDIN. See also --help-stdin option.
Next time consider using Plesk CLI utilities or API instead of relying on its internals.
 
Code:
[root@ppu12-0 ~]# /usr/local/psa/admin/bin/mailmng --help
Usage: mailmng <COMMAND> <COMMAND OPTIONS...>

WARNING: you are using legacy mailmng compatibility wrapper.
Please use one of the following utilities instead in the future:
    mailmng-black-white
    mailmng-core
    mailmng-domain
    mailmng-mailname
    mailmng-server
    mailmng-service

This wrapper suppresses any supplied STDIN. If you're getting errors like
'Failed to read and parse session mail data from STDIN.' then you should use one of the
utilities mentioned above and supply valid STDIN. See also --help-stdin option.
Next time consider using Plesk CLI utilities or API instead of relying on its internals.

AFAICT, I'm using the command correctly, Igor.

From above...
Code:
[root@www bin]# ./mailmng --add-mailname --domain-name=example.com --mailname=eric
[root@www bin]# ./mail_auth_view | grep eric
[root@www bin]#

Have I overlooked something? Do you see any syntactical errors? Or is this a bug in Plesk Panel 11.0.9 (Update #62)?
 
Back
Top