diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php
index 6dc08225931..2bf661912fc 100644
--- a/program/include/rcmail_output_html.php
+++ b/program/include/rcmail_output_html.php
@@ -2731,7 +2731,9 @@ protected function add_csp_header(): void
$csp_header = "Content-Security-Policy: {$csp}";
if (isset($this->env['safemode']) && $this->env['safemode'] === true) {
$csp_allow_remote = $this->get_csp_value('content_security_policy_add_allow_remote');
- $csp_header .= "; {$csp_allow_remote}";
+ if (!in_array($csp_allow_remote, ['', false, 'false', null])) {
+ $csp_header .= "; {$csp_allow_remote}";
+ }
}
$this->header($csp_header);
}