It would probably best to use the template toolkit interface with <?cptt mail/yourfile.tmpl ?>
Then yourfile.tmpl
Code:
[%
USE Api2;
USE CPList;
USE HTTP;
USE JSON;
USE NVData;
SET result = Api2.exec( 'Email', 'listmxs', { domain =>CPANEL.FORM.domain } );
%]
For a better example see
/usr/local/cpanel/base/frontend/x3/stats/lastvisit.html
and
/usr/local/cpanel/base/frontend/x3/stats/latest_visitors_entries.tmpl
Also http://docs.cpanel.net/twiki/bin/vie.../UsingCpttTags
**Note cptt is a bit slow in 11.32. cptt has been improved significantly in 11.34, however the speed improvements are not yet available publicly.