Introduction:
I created a script that creates a full email account for a new user including setting the password.
I was looking for a way to change/set the password programmatically in the script using clear text passwords provided in variables.
I took this information for the man page of chpasswd

Some solution examples:
Changing/setting the password using the existing encryption provided by PAM system:
echo 'username:cleartext_password' | chpasswd
Changing/setting the password using a different encryption method(Not recommended)
echo 'username:cleartext_password' | chpasswd -c METHOD
METHODS:
Use the specified method to encrypt the passwords.
The available methods are DES, MD5, NONE, and SHA256 or SHA512 if your libc support these methods.

Changing/setting the password using already encrypted password:
echo 'username:encrypted_password' | chpasswd -e
Changing/setting the password for list of users:passowrds
chpasswd < users:passwords_list_file
(one line per user:password in the file)