Changing cPanel POP Email Password Programmatically

I’m not sure why cPanel/WHM has yet to fully support poppassd or some other more simple way of changing an email account password programmatically, but for some reason, they don’t. This rolled up from a client a few months ago, and happened to be a pretty simple solution… albeit unfortunately, well… not very secure. The solution here is to use the cPanel uAPI to run the passwd_pop function–it’s pretty easy, but horribly documented on their website as to how to accomplish (you have to dig around in a lot of places to get all the information you need to construct the request).

Just throw in your stuff at the top, and you’re off to cpanel-change-password… land. This could pretty easily be implemented into some web-based email client change password code, and is a great template to start of off if you’re rolling your own email for your employees/business and want them to be able to reset their passwords without having to contact IT/support.