@@ -18,6 +18,28 @@
|
|||||||
class EmailAccounts extends ApiCommand implements ResourceEntity
|
class EmailAccounts extends ApiCommand implements ResourceEntity
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add a new email account for a given email-address either by id or emailaddr
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* optional email-address-id of email-address to add the account for
|
||||||
|
* @param string $emailaddr
|
||||||
|
* optional email-address to add the account for
|
||||||
|
* @param int $customerid
|
||||||
|
* optional, admin-only, the customer-id
|
||||||
|
* @param string $loginname
|
||||||
|
* optional, admin-only, the loginname
|
||||||
|
* @param string $email_password
|
||||||
|
* password for the account
|
||||||
|
* @param string $alternative_email
|
||||||
|
* optional email address to send account information to, default is the account that is being created
|
||||||
|
* @param int $email_quota
|
||||||
|
* optional quota if enabled in MB, default 0
|
||||||
|
*
|
||||||
|
* @access admin, customer
|
||||||
|
* @throws Exception
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function add()
|
public function add()
|
||||||
{
|
{
|
||||||
if ($this->isAdmin() == false && Settings::IsInList('panel.customer_hide_options', 'email')) {
|
if ($this->isAdmin() == false && Settings::IsInList('panel.customer_hide_options', 'email')) {
|
||||||
@@ -181,6 +203,7 @@ class EmailAccounts extends ApiCommand implements ResourceEntity
|
|||||||
$mail_body = $this->getMailTemplate($customer, 'mails', 'pop_success_mailbody', $replace_arr, $this->lng['mails']['pop_success']['mailbody']);
|
$mail_body = $this->getMailTemplate($customer, 'mails', 'pop_success_mailbody', $replace_arr, $this->lng['mails']['pop_success']['mailbody']);
|
||||||
|
|
||||||
$_mailerror = false;
|
$_mailerror = false;
|
||||||
|
$mailerr_msg = "";
|
||||||
try {
|
try {
|
||||||
$this->mailer()->SetFrom($admin['email'], getCorrectUserSalutation($admin));
|
$this->mailer()->SetFrom($admin['email'], getCorrectUserSalutation($admin));
|
||||||
$this->mailer()->Subject = $mail_subject;
|
$this->mailer()->Subject = $mail_subject;
|
||||||
@@ -197,7 +220,7 @@ class EmailAccounts extends ApiCommand implements ResourceEntity
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($_mailerror) {
|
if ($_mailerror) {
|
||||||
$log->logAction($this->isAdmin() ? ADM_ACTION : USR_ACTION, LOG_ERR, "[API] Error sending mail: " . $mailerr_msg);
|
$this->logger()->logAction($this->isAdmin() ? ADM_ACTION : USR_ACTION, LOG_ERR, "[API] Error sending mail: " . $mailerr_msg);
|
||||||
standard_error('errorsendingmail', $email_full, true);
|
standard_error('errorsendingmail', $email_full, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +250,7 @@ class EmailAccounts extends ApiCommand implements ResourceEntity
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($_mailerror) {
|
if ($_mailerror) {
|
||||||
$log->logAction($this->isAdmin() ? ADM_ACTION : USR_ACTION, LOG_ERR, "[API] Error sending mail: " . $mailerr_msg);
|
$this->logger()->logAction($this->isAdmin() ? ADM_ACTION : USR_ACTION, LOG_ERR, "[API] Error sending mail: " . $mailerr_msg);
|
||||||
standard_error(array(
|
standard_error(array(
|
||||||
'errorsendingmail'
|
'errorsendingmail'
|
||||||
), $alternative_email, true);
|
), $alternative_email, true);
|
||||||
@@ -245,9 +268,13 @@ class EmailAccounts extends ApiCommand implements ResourceEntity
|
|||||||
throw new Exception("No more resources available", 406);
|
throw new Exception("No more resources available", 406);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* You cannot directly get an email account.
|
||||||
|
* You need to call Emails.get()
|
||||||
|
*/
|
||||||
public function get()
|
public function get()
|
||||||
{
|
{
|
||||||
throw new Exception('You cannot directly get an email forwarder. You need to call Emails.get()', 303);
|
throw new Exception('You cannot directly get an email account. You need to call Emails.get()', 303);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -256,9 +283,11 @@ class EmailAccounts extends ApiCommand implements ResourceEntity
|
|||||||
* @param int $id
|
* @param int $id
|
||||||
* optional, the email-address-id
|
* optional, the email-address-id
|
||||||
* @param string $emailaddr
|
* @param string $emailaddr
|
||||||
* optional, the email-address to add the forwarder for
|
* optional, the email-address to update
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional, required when called as admin/reseller
|
* optional, admin-only, the customer-id
|
||||||
|
* @param string $loginname
|
||||||
|
* optional, admin-only, the loginname
|
||||||
* @param int $email_quota
|
* @param int $email_quota
|
||||||
* optional, update quota
|
* optional, update quota
|
||||||
* @param string $email_password
|
* @param string $email_password
|
||||||
@@ -353,6 +382,10 @@ class EmailAccounts extends ApiCommand implements ResourceEntity
|
|||||||
return $this->response(200, "successfull", $result);
|
return $this->response(200, "successfull", $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* You cannot directly list email forwarders.
|
||||||
|
* You need to call Emails.listing()
|
||||||
|
*/
|
||||||
public function listing()
|
public function listing()
|
||||||
{
|
{
|
||||||
throw new Exception('You cannot directly list email forwarders. You need to call Emails.listing()', 303);
|
throw new Exception('You cannot directly list email forwarders. You need to call Emails.listing()', 303);
|
||||||
@@ -364,11 +397,13 @@ class EmailAccounts extends ApiCommand implements ResourceEntity
|
|||||||
* @param int $id
|
* @param int $id
|
||||||
* optional, the email-address-id
|
* optional, the email-address-id
|
||||||
* @param string $emailaddr
|
* @param string $emailaddr
|
||||||
* optional, the email-address to add the forwarder for
|
* optional, the email-address to delete the account for
|
||||||
|
* @param int $customerid
|
||||||
|
* optional, admin-only, the customer-id
|
||||||
|
* @param string $loginname
|
||||||
|
* optional, admin-only, the loginname
|
||||||
* @param bool $delete_userfiles
|
* @param bool $delete_userfiles
|
||||||
* optional, default false
|
* optional, default false
|
||||||
* @param int $customerid
|
|
||||||
* optional, required when called as admin/reseller
|
|
||||||
*
|
*
|
||||||
* @access admin,customer
|
* @access admin,customer
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
|||||||
@@ -25,10 +25,12 @@ class EmailForwarders extends ApiCommand implements ResourceEntity
|
|||||||
* optional, the email-address-id
|
* optional, the email-address-id
|
||||||
* @param string $emailaddr
|
* @param string $emailaddr
|
||||||
* optional, the email-address to add the forwarder for
|
* optional, the email-address to add the forwarder for
|
||||||
|
* @param int $customerid
|
||||||
|
* optional, admin-only, the customer-id
|
||||||
|
* @param string $loginname
|
||||||
|
* optional, admin-only, the loginname
|
||||||
* @param string $destination
|
* @param string $destination
|
||||||
* email-address to add as forwarder
|
* email-address to add as forwarder
|
||||||
* @param int $customerid
|
|
||||||
* optional, required when called as admin/reseller
|
|
||||||
*
|
*
|
||||||
* @access admin,customer
|
* @access admin,customer
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
@@ -101,16 +103,28 @@ class EmailForwarders extends ApiCommand implements ResourceEntity
|
|||||||
throw new Exception("No more resources available", 406);
|
throw new Exception("No more resources available", 406);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* You cannot directly get an email forwarder.
|
||||||
|
* You need to call Emails.get()
|
||||||
|
*/
|
||||||
public function get()
|
public function get()
|
||||||
{
|
{
|
||||||
throw new Exception('You cannot directly get an email forwarder. You need to call Emails.get()', 303);
|
throw new Exception('You cannot directly get an email forwarder. You need to call Emails.get()', 303);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* You cannot update an email forwarder.
|
||||||
|
* You need to delete the entry and create a new one.
|
||||||
|
*/
|
||||||
public function update()
|
public function update()
|
||||||
{
|
{
|
||||||
throw new Exception('You cannot update an email forwarder. You need to delete the entry and create a new one.', 303);
|
throw new Exception('You cannot update an email forwarder. You need to delete the entry and create a new one.', 303);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* You cannot directly list email forwarders.
|
||||||
|
* You need to call Emails.listing()
|
||||||
|
*/
|
||||||
public function listing()
|
public function listing()
|
||||||
{
|
{
|
||||||
throw new Exception('You cannot directly list email forwarders. You need to call Emails.listing()', 303);
|
throw new Exception('You cannot directly list email forwarders. You need to call Emails.listing()', 303);
|
||||||
@@ -122,11 +136,13 @@ class EmailForwarders extends ApiCommand implements ResourceEntity
|
|||||||
* @param int $id
|
* @param int $id
|
||||||
* optional, the email-address-id
|
* optional, the email-address-id
|
||||||
* @param string $emailaddr
|
* @param string $emailaddr
|
||||||
* optional, the email-address to add the forwarder for
|
* optional, the email-address to delete the forwarder from
|
||||||
|
* @param int $customerid
|
||||||
|
* optional, admin-only, the customer-id
|
||||||
|
* @param string $loginname
|
||||||
|
* optional, admin-only, the loginname
|
||||||
* @param int $forwarderid
|
* @param int $forwarderid
|
||||||
* id of the forwarder to delete
|
* id of the forwarder to delete
|
||||||
* @param int $customerid
|
|
||||||
* optional, required when called as admin/reseller
|
|
||||||
*
|
*
|
||||||
* @access admin,customer
|
* @access admin,customer
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ class Emails extends ApiCommand implements ResourceEntity
|
|||||||
* @param boolean $iscatchall
|
* @param boolean $iscatchall
|
||||||
* optional, make this address a catchall address, default: no
|
* optional, make this address a catchall address, default: no
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional, required when called as admin/reseller
|
* optional, admin-only, the customer-id
|
||||||
|
* @param string $loginname
|
||||||
|
* optional, admin-only, the loginname
|
||||||
*
|
*
|
||||||
* @access admin, customer
|
* @access admin, customer
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
@@ -180,13 +182,15 @@ class Emails extends ApiCommand implements ResourceEntity
|
|||||||
* toggle catchall flag of given email address either by id or email-address
|
* toggle catchall flag of given email address either by id or email-address
|
||||||
*
|
*
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* optional, the customer-id
|
* optional, the email-address-id
|
||||||
* @param string $emailaddr
|
* @param string $emailaddr
|
||||||
* optional, the email-address
|
* optional, the email-address
|
||||||
|
* @param int $customerid
|
||||||
|
* optional, admin-only, the customer-id
|
||||||
|
* @param string $loginname
|
||||||
|
* optional, admin-only, the loginname
|
||||||
* @param boolean $iscatchall
|
* @param boolean $iscatchall
|
||||||
* optional
|
* optional
|
||||||
* @param int $customerid
|
|
||||||
* optional, required when called as admin/reseller
|
|
||||||
*
|
*
|
||||||
* @access admin, customer
|
* @access admin, customer
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
@@ -257,9 +261,9 @@ class Emails extends ApiCommand implements ResourceEntity
|
|||||||
* list all email addresses, if called from an admin, list all email addresses of all customers you are allowed to view, or specify id or loginname for one specific customer
|
* list all email addresses, if called from an admin, list all email addresses of all customers you are allowed to view, or specify id or loginname for one specific customer
|
||||||
*
|
*
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional, admin-only, select ftp-users of a specific customer by id
|
* optional, admin-only, select email addresses of a specific customer by id
|
||||||
* @param string $loginname
|
* @param string $loginname
|
||||||
* optional, admin-only, select ftp-users of a specific customer by loginname
|
* optional, admin-only, select email addresses of a specific customer by loginname
|
||||||
*
|
*
|
||||||
* @access admin, customer
|
* @access admin, customer
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
@@ -291,13 +295,15 @@ class Emails extends ApiCommand implements ResourceEntity
|
|||||||
* delete an email address by either id or username
|
* delete an email address by either id or username
|
||||||
*
|
*
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* optional, the customer-id
|
* optional, the email-address-id
|
||||||
* @param string $emailaddr
|
* @param string $emailaddr
|
||||||
* optional, the email-address
|
* optional, the email-address
|
||||||
* @param boolean $delete_userfiles
|
|
||||||
* optional, delete email data from filesystem, default: no
|
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional, required when called as admin/reseller
|
* optional, admin-only, the customer-id
|
||||||
|
* @param string $loginname
|
||||||
|
* optional, admin-only, the loginname
|
||||||
|
* @param boolean $delete_userfiles
|
||||||
|
* optional, delete email data from filesystem, default: 0 (false)
|
||||||
*
|
*
|
||||||
* @access admin, customer
|
* @access admin, customer
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
|||||||
Reference in New Issue
Block a user