--- /dev/null
+<?php
+$email_address = 'ismael@bouya.org';
+$email_subject = 'Content-Security-Policy violation';
+
+$current_domain = $_SERVER['SERVER_NAME'];
+$email_subject = $email_subject . ' on ' . $current_domain;
+
+http_response_code(204);
+
+$json_data = file_get_contents('php://input');
+
+if ($json_data = json_decode($json_data)) {
+ $json_data = json_encode($json_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
+
+ $message = "The following Content-Security-Policy violation occurred on " .
+ $current_domain . ":\n\n" .
+ $json_data;
+ mail($email_address, $email_subject, $message, 'Content-Type: text/plain;charset=utf-8');
+}