Modify the file: /usr/local/directadmin/custombuild/php_extensions.conf
and perform the changes (according to your needs):
#PHP Extension Settings
gmp=no
htscanner=no
imagick=no
imap=yes
ioncube=yes
ldap=no
opcache=no
phalcon=no
suhosin=no
snuffleupagus=no
xmlrpc=yes
zend=no
and save the file.
Then, run the command:
/usr/local/directadmin/custombuild/build php_imap
/usr/local/directadmin/custombuild/build php_xmlrpc
DONE! IMAP & XMLRPC will be installed on your server by running the above command.