diff --git a/src/lib-sieve/sieve-actions.c b/src/lib-sieve/sieve-actions.c
index b0f751751bec12979236ac9fc9a40d6c8c41629f..4aa3f59901d9c4ec13488d0d25f60b021be5b346 100644
--- a/src/lib-sieve/sieve-actions.c
+++ b/src/lib-sieve/sieve-actions.c
@@ -408,7 +408,8 @@ static bool act_store_start
 
 	*tr_context = (void *)trans;
 
-	return TRUE;
+	return ( trans->error_code == MAIL_ERROR_NONE || 
+		trans->error_code == MAIL_ERROR_NOTFOUND );
 }
 
 static struct mail_keywords *act_store_keywords_create
diff --git a/tests/execute/errors.svtest b/tests/execute/errors.svtest
index 383df8b4c22c6d52be426dad983f421b9cbde7fe..ec5c57846223ee96c4c39ab4b335618fbd8322a5 100644
--- a/tests/execute/errors.svtest
+++ b/tests/execute/errors.svtest
@@ -2,6 +2,7 @@ require "vnd.dovecot.testsuite";
 
 require "relational";
 require "comparator-i;ascii-numeric";
+require "fileinto";
 
 test "Action conflicts: reject <-> fileinto" {
 	if not test_script_compile "errors/conflict-reject-fileinto.sieve" {
@@ -108,3 +109,27 @@ test "Fileinto missing folder" {
 	}
 }
 
+test "Fileinto invalid folder name" {
+	if not test_script_compile "errors/fileinto-invalid-name.sieve" {
+		test_fail "compile failed";
+	}
+
+	if not test_script_run {
+		test_fail "execution failed";
+	}
+
+	if test_result_execute {
+		test_fail "execution of result should have failed";
+	}
+
+	if not test_error :count "eq" :comparator "i;ascii-numeric" "1" {
+		test_fail "wrong number of runtime errors reported";
+	}
+
+	if not allof (
+		test_error :index 1 :contains "failed to store into mailbox",
+		test_error :index 1 :contains "name") {
+		test_fail "unexpected error reported";
+	}
+}
+
diff --git a/tests/execute/errors/fileinto-invalid-name.sieve b/tests/execute/errors/fileinto-invalid-name.sieve
new file mode 100644
index 0000000000000000000000000000000000000000..871323e0e11922da5bffdb4872144487a46196ee
--- /dev/null
+++ b/tests/execute/errors/fileinto-invalid-name.sieve
@@ -0,0 +1,5 @@
+require "fileinto";
+require "mailbox";
+
+fileinto :create "foo//somedomain/org";
+