• 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!
  • 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.

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>...                         |     |                                      |
|                  eric@example.com    |     |                           *********  |
| ...<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 eric@example.com <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. <27587.1407623005@localhost.localdomain>
USER eric@example.com
+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