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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user