Phase 2: Implement Domain & Mailbox persistence, Analytics, and fix pagination issues
This commit is contained in:
@@ -90,6 +90,24 @@ class ProcessIncomingEmail implements ShouldQueue
|
||||
]
|
||||
);
|
||||
|
||||
// Track analytics for receiving email
|
||||
$mailbox = \App\Models\Mailbox::where('address', $email->recipient_email)->first();
|
||||
|
||||
TrackAnalytics::dispatch(
|
||||
eventType: 'email_received',
|
||||
mailboxHash: $mailbox?->mailbox_hash ?? 'unknown',
|
||||
domainHash: $mailbox?->domain_hash ?? 'unknown',
|
||||
metadata: [
|
||||
'email_id' => $email->id,
|
||||
'sender' => $email->sender_email,
|
||||
'recipient' => $email->recipient_email,
|
||||
'attachment_count' => count($metadata['attachments'] ?? []),
|
||||
'found_mailbox' => $mailbox !== null,
|
||||
],
|
||||
ipAddress: '0.0.0.0', // Server-side event
|
||||
userAgent: 'MailOps/IncomingWorker'
|
||||
);
|
||||
|
||||
$this->ensureTtlIndex();
|
||||
|
||||
NewEmailReceived::dispatch($email);
|
||||
|
||||
Reference in New Issue
Block a user