You may have a need to change an email account password using a shell instead of accessing WHM.
This can be done by escalating to the cPanel user and then executing /usr/local/cpanel/cpanel-email
Example setting a random password that would be unseen
sudo -u cptest1 /usr/local/cpanel/cpanel-email passwdpop cptest $(openssl rand -base64 12) unlimited cp1testdomain.com
or with a defined password
sudo -u cptest1 /usr/local/cpanel/cpanel-email passwdpop cptest som3Pa33worD unlimited cp1testdomain.com
In this example the cPanel user is cptest1 and the email account is firstname.lastname@example.org with an unlimited quota.
sudo -u CPUSER /usr/local/cpanel/cpanel-email passwdpop EMAILUSER PASS QUOTA DOMAIN