diff --git a/lib/classes/api/commands/class.EmailAccounts.php b/lib/classes/api/commands/class.EmailAccounts.php
index 1b8216de..b4f18b0f 100644
--- a/lib/classes/api/commands/class.EmailAccounts.php
+++ b/lib/classes/api/commands/class.EmailAccounts.php
@@ -109,7 +109,7 @@ class EmailAccounts extends ApiCommand implements ResourceEntity
`customerid` = :cid,
`email` = :email,
`username` = :username," . (Settings::Get('system.mailpwcleartext') == '1' ? '`password` = :password, ' : '') . "
- `password_enc` = :password_end,
+ `password_enc` = :password_enc,
`homedir` = :homedir,
`maildir` = :maildir,
`uid` = :uid,
diff --git a/lib/classes/api/commands/class.Emails.php b/lib/classes/api/commands/class.Emails.php
index d4a36fc6..5255cf33 100644
--- a/lib/classes/api/commands/class.Emails.php
+++ b/lib/classes/api/commands/class.Emails.php
@@ -162,7 +162,7 @@ class Emails extends ApiCommand implements ResourceEntity
$params['customerid'] = implode(", ", $customer_ids);
$params['idea'] = ($id <= 0 ? $emailaddr : $id);
- $result_stmt = Database::prepare("SELECT v.`id`, v.`email`, v.`email_full`, v.`iscatchall`, v.`destination`, v.`customerid`, v.`popaccountid`, u.`quota`
+ $result_stmt = Database::prepare("SELECT v.`id`, v.`email`, v.`email_full`, v.`iscatchall`, v.`destination`, v.`customerid`, v.`popaccountid`, v.`domainid`, u.`quota`
FROM `" . TABLE_MAIL_VIRTUAL . "` v
LEFT JOIN `" . TABLE_MAIL_USERS . "` u ON v.`popaccountid` = u.`id`
WHERE v.`customerid` IN (:customerid)
diff --git a/lib/classes/database/class.Database.php b/lib/classes/database/class.Database.php
index 3c7d5cb5..3c1e64c3 100644
--- a/lib/classes/database/class.Database.php
+++ b/lib/classes/database/class.Database.php
@@ -372,17 +372,17 @@ class Database {
@fwrite($errlog, "|TRACE\n".$error_trace."\n");
@fclose($errlog);
+ if (empty($sql['debug'])) {
+ $error_trace = '';
+ } elseif (!is_null($stmt)) {
+ $error_trace .= "
".$stmt->queryString;
+ }
+
if ($showerror && $json_response) {
- throw new Exception($error_message, 500);
+ throw new Exception($error_message.($sql['debug'] ? "\n\n".$error_trace : ''), 500);
}
if ($showerror) {
- if (empty($sql['debug'])) {
- $error_trace = '';
- } elseif (!is_null($stmt)) {
- $error_trace .= "
".$stmt->queryString;
- }
-
// fallback
$theme = 'Sparkle';