Hello,
I've setup two development servers (A and B) to separate a few services from main cPanel installation, like email and DNS. I'm able to create, remove and update email accounts transparently on box B from server A using CustomEventHandler.pm, but cannot list those email accounts and get quota information. Let me show you:
This piece of code is incomplete, but do you have any ideas how to properly get Email::listpopswithdisk from server B and show it on server A?
Regards,
Ruy Rocha
I've setup two development servers (A and B) to separate a few services from main cPanel installation, like email and DNS. I'm able to create, remove and update email accounts transparently on box B from server A using CustomEventHandler.pm, but cannot list those email accounts and get quota information. Let me show you:
Code:
[email protected] [/usr/local/cpanel/Cpanel]# cat CustomEventHandler.pm
package Cpanel::CustomEventHandler;
# cpanel12 - CustomEventHandler.pm Copyright(c) 2008 cPanel, Inc.
# All rights Reserved.
# [email protected] http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
use strict;
use Cpanel::Logger ();
use Cpanel::PublicAPI ();
sub event {
my ( $apiv, $type, $module, $event, $cfgref, $dataref ) = @_;
return 1 if ( $module ne 'email' );
if ($module eq 'email') {
if ($event eq 'listpopswithdisk' && $type eq 'post') {
my $user = $Cpanel::user;
my $domain = $cfgref->{'domain'};
# get remote domain mailboxes
if ( $domain eq 'abcdefg.com' ) {
my $pubapi = Cpanel::PublicAPI->new('user' => 'root', 'pass' => 'superpassword', 'host' => 'x.x.x.x');
my $emails = $pubapi->cpanel_api2_request(
'whostmgr',
{ 'module' => 'Email',
'func' => 'listpopswithdisk',
'user' => $user,
},
);
}
}
}
return 1;
}
1;
Regards,
Ruy Rocha