from[0]->mailbox . "@" . $header->from[0]->host; $subject = $header->subject; $date = date('Y-m-d H:i:s', strtotime($header->date)); // Determine the URS provider based on the email sender $ursProvider = ($from == 'providerA@example.com') ? 'URSPA' : 'URSPB'; // Extract domain name or relevant info from the email (you'd need more specific code here based on the email content) $body = imap_fetchbody($inbox, $emailId, 1); $domainName = extractDomainNameFromEmail($body); // You'd have to define this function // Insert into the database $stmt = $pdo->prepare("INSERT INTO urs_actions (domain_name, urs_provider, action_date, status) VALUES (?, ?, ?, ?)"); $stmt->execute([$domainName, $ursProvider, $date, 'Suspended']); } imap_close($inbox); function extractDomainNameFromEmail($emailBody) { // Placeholder function; you'd extract the domain name based on the email format/content // This is just a basic example preg_match("/domain: (.*?) /i", $emailBody, $matches); return $matches[1] ?? ''; }