feat: auto-refresh AJAX, bouton transfert entre comptes, webhook par compte

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jules
2026-05-05 15:39:49 +02:00
parent 1ef093f5ec
commit 0d4998e129
6 changed files with 281 additions and 69 deletions

View File

@@ -91,5 +91,29 @@ function process_account(array $account, MailMimeParser $parser): void {
// Déplace le mail vers cur/ (marque comme lu)
rename($filePath, "/var/mail/vhosts/{$domain}/{$account['username']}/Maildir/cur/{$fileName}:2,S");
// Webhook
if (!empty($account['webhook_url'])) {
fire_webhook($account['webhook_url'], [
'account' => $account['username'],
'email' => $account['email'],
'subject' => $subject,
'from' => $from,
'source_id' => $sourceId,
'files' => $attachments ? count($attachments) : 0,
'received_at'=> date('c'),
]);
}
}
}
function fire_webhook(string $url, array $payload): void {
$ctx = stream_context_create(['http' => [
'method' => 'POST',
'header' => "Content-Type: application/json\r\n",
'content' => json_encode($payload),
'timeout' => 5,
'ignore_errors' => true,
]]);
@file_get_contents($url, false, $ctx);
}