diff --git a/api/src/Mail/Script.php b/api/src/Mail/Script.php
index 787138c4c6..af4ef589cc 100644
--- a/api/src/Mail/Script.php
+++ b/api/src/Mail/Script.php
@@ -607,7 +607,12 @@ class Script
//error_log(__METHOD__.__LINE__.array2string($newscript));
//print "
$newscript
"; exit;
//print "
".htmlentities($newscript)."
";
+
try {
+ if (!$connection->hasSpace($this->name, mb_strlen($newscript)))
+ {
+ throw new \Exception(lang("There is no space left to store sieve script, please check sieve_maxscriptsize option on your mailserver's config."));
+ }
$connection->installScript($this->name, $newscript, true);
}
catch (\Exception $e) {
diff --git a/mail/inc/class.mail_sieve.inc.php b/mail/inc/class.mail_sieve.inc.php
index d85be88d30..dcc91fe8fc 100644
--- a/mail/inc/class.mail_sieve.inc.php
+++ b/mail/inc/class.mail_sieve.inc.php
@@ -963,7 +963,7 @@ class mail_sieve
if($result)
{
- $response->error($result);
+ $response->message($result);
return;
}
$this->saveSessionData();
@@ -1170,7 +1170,7 @@ class mail_sieve
{
if (!$this->account->imapServer()->setRules($this->rules))
{
- return "update failed";
+ return $this->account->imapServer()->error;
}
}