diff --git a/modules/smart_date_recur/smart_date_recur.module b/modules/smart_date_recur/smart_date_recur.module
index df76714fec..12fefa6e2b 100644
--- a/modules/smart_date_recur/smart_date_recur.module
+++ b/modules/smart_date_recur/smart_date_recur.module
@@ -939,3 +939,28 @@ function _smart_date_recur_label_freq_defaults($freq_values) {
 function _smart_date_recur_get_freq_defaults() {
   return ['DAILY', 'WEEKLY', 'MONTHLY', 'YEARLY'];
 }
+
+/**
+ * Implements hook_mail().
+ */
+function smart_date_recur_mail($key, &$message, $params) {
+  
+    if ($key == 'cleanup_report') {
+        // Ensure subject is set
+        if (!empty($params['subject'])) {
+            $message['subject'] = $params['subject'];
+        } else {
+            $message['subject'] = "Smart Date Recur Cleanup - Missing Subject!";
+        }
+  
+        // Ensure message body is set
+        if (!empty($params['message'])) {
+            $message['body'][] = $params['message'];
+        } else {
+            $message['body'][] = "No content available for this report.";
+        }
+  
+        // Ensure correct content type
+        $message['headers']['Content-Type'] = 'text/plain; charset=UTF-8';
+    }
+  }

diff --git a/modules/smart_date_recur/src/Drush/Commands/SmartDateRecurCommands.php b/modules/smart_date_recur/src/Drush/Commands/SmartDateRecurCommands.php
index 50c9b6e140..9974c70e3d 100644
--- a/modules/smart_date_recur/src/Drush/Commands/SmartDateRecurCommands.php
+++ b/modules/smart_date_recur/src/Drush/Commands/SmartDateRecurCommands.php
@@ -2,31 +2,29 @@
 
 namespace Drupal\smart_date_recur\Drush\Commands;
 
+use Drupal\Core\Database\Database;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
-use Drupal\Core\Utility\Token;
-use Drupal\smart_date_recur\Entity\SmartDateRule;
+use Drupal\Core\Mail\MailManagerInterface;
+use Drupal\Core\Language\LanguageManagerInterface;
 use Drush\Attributes as CLI;
 use Drush\Commands\DrushCommands;
 use Symfony\Component\DependencyInjection\ContainerInterface;
+use Drupal\smart_date_recur\Entity\SmartDateRule;
+
 
 /**
- * A Drush command file.
+ * A Drush command file for Smart Date Recur.
  */
 final class SmartDateRecurCommands extends DrushCommands {
 
-  /**
-   * Information about the entity type.
-   *
-   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
-   */
-  protected $entityTypeManager;
-
+  protected EntityTypeManagerInterface $entityTypeManager;
   /**
    * Constructs a SmartDateRecurCommands object.
    */
   public function __construct(
-    private readonly Token $token,
     EntityTypeManagerInterface $entityTypeManager,
+    private readonly MailManagerInterface $mailManager,
+    private readonly LanguageManagerInterface $languageManager,
   ) {
     parent::__construct();
     $this->entityTypeManager = $entityTypeManager;
@@ -37,8 +35,9 @@ public function __construct(
    */
   public static function create(ContainerInterface $container) {
     return new static(
-      $container->get('token'),
       $container->get('entity_type.manager'),
+      $container->get('plugin.manager.mail'),
+      $container->get('language_manager'),
     );
   }
 
@@ -60,4 +59,174 @@ public function pruneRules() {
     $this->logger()->success(dt('Deleted ' . $deleted_ctr . ' rules.'));
   }
 
+ 
+/**
+   * Prunes old SmartDate Recur events, processes them, and sends an email.
+   *
+   * @command smart_date_recur:prune-old-events
+   * @aliases prune-sd-events
+   * @usage drush smart_date_recur:prune-old-events days field_name node_type email_address
+   */
+  public function pruneOldEvents(int $days, string $field_name, string $type, string $email) {
+    $database = Database::getConnection();
+    $one_year_ago = strtotime("-{$days} days");
+
+    // Trim and validate input parameters
+    $field_name = trim($field_name);
+    $type = trim($type);
+    $email = filter_var(trim($email), FILTER_VALIDATE_EMAIL);
+
+    if (!$email) {
+      $this->logger()->error("Invalid email address: {$email}");
+      return;
+    }
+
+    $deleted_event_nids = [];
+    $deleted_rule_rids = [];
+    $log_messages = [];
+
+    // --- Step 1: Cleanup event date field ---
+    $event_results = $database->select("node__{$field_name}", 'n')
+      ->fields('n', ['entity_id', "{$field_name}_end_value"])
+      ->condition("{$field_name}_end_value", $one_year_ago, '<')
+      ->execute()
+      ->fetchAll();
+
+    foreach ($event_results as $result) {
+      $entity_id = $result->entity_id;
+
+      // Check if future events exist
+      $future_event_exists = $database->select("node__{$field_name}", 'n')
+        ->fields('n', ['entity_id'])
+        ->condition('n.entity_id', $entity_id)
+        ->condition("{$field_name}_end_value", time(), '>')
+        ->execute()
+        ->fetchField();
+
+      if ($future_event_exists) {
+        $database->delete("node__{$field_name}")
+          ->condition('entity_id', $entity_id)
+          ->condition("{$field_name}_end_value", $one_year_ago, '<')
+          ->execute();
+        $deleted_event_nids[] = $entity_id;
+      } else {
+        // Keep only the two most recent past events
+        $old_dates = $database->select("node__{$field_name}", 'n')
+          ->fields('n', ["{$field_name}_end_value"])
+          ->condition('n.entity_id', $entity_id)
+          ->orderBy("{$field_name}_end_value", 'DESC')
+          ->execute()
+          ->fetchCol();
+
+        if (count($old_dates) > 2) {
+          $dates_to_delete = array_slice($old_dates, 2);
+          $database->delete("node__{$field_name}")
+            ->condition('entity_id', $entity_id)
+            ->condition("{$field_name}_end_value", $dates_to_delete, 'IN')
+            ->execute();
+          $deleted_event_nids[] = $entity_id;
+        }
+      }
+    }
+
+    if (!empty($deleted_event_nids)) {
+      $log_messages[] = "Deleted outdated event date entries. NIDs: " . implode(', ', $deleted_event_nids);
+    }
+
+    // --- Step 2: Cleanup expired `smart_date_rule` entries ---
+    $rule_results = $database->select('smart_date_rule', 'r')
+      ->fields('r', ['rid', 'end'])
+      ->condition('r.end', $one_year_ago, '<')
+      ->condition('field_name', $field_name)
+      ->execute()
+      ->fetchAll();
+
+    foreach ($rule_results as $rule) {
+      // Check if any active events exist for this rule
+      $linked_event_exists = $database->select("node__{$field_name}", 'n')
+        ->fields('n', ['entity_id'])
+        ->condition("{$field_name}_end_value", time(), '>')
+        ->execute()
+        ->fetchField();
+
+      if (!$linked_event_exists) {
+        $database->delete('smart_date_rule')
+          ->condition('rid', $rule->rid)
+          ->condition('end', $one_year_ago, '<')
+          ->execute();
+        $deleted_rule_rids[] = $rule->rid;
+      }
+    }
+
+    if (!empty($deleted_rule_rids)) {
+      $log_messages[] = "Deleted outdated Smart Date rules. Rule IDs: " . implode(', ', $deleted_rule_rids);
+    }
+
+    // --- Step 3: Update all recurring events ---
+    $this->updateRecurringEventDates($field_name);
+
+    // --- Step 4: Send email report ---
+    $this->sendCleanupEmail($email, $days, $deleted_event_nids, $deleted_rule_rids, $log_messages);
+  }
+
+  /**
+   * Updates recurring event dates.
+   */
+  private function updateRecurringEventDates($field_name) {
+    $database = Database::getConnection();
+    $table_name = 'node__' . $field_name;
+    $rrule_column = $field_name . '_rrule';
+    $start_column = $field_name . '_value';
+    $end_column = $field_name . '_end_value';
+
+    // Query nodes where recurrence rule exists (rrule > 0)
+    $node_ids = $database->select($table_name, 'n')
+      ->fields('n', ['entity_id'])
+      ->condition('n.' . $rrule_column, 0, '>')
+      ->execute()
+      ->fetchCol();
+
+    foreach ($node_ids as $node_id) {
+        // Fetch the earliest event instance for the node
+        $earliest_event = $database->select($table_name, 'n')
+          ->fields('n', [$start_column, $end_column, $rrule_column])
+          ->condition('n.entity_id', $node_id)
+          ->orderBy($start_column, 'ASC')
+          ->range(0, 1)
+          ->execute()
+          ->fetchAssoc();
+
+        if (!$earliest_event) {
+            continue;
+        }
+
+        $earliest_start = $earliest_event[$start_column];
+        $earliest_end = $earliest_event[$end_column];
+        $rrule_id = $earliest_event[$rrule_column];
+
+        if ($rrule_id) {
+            // Update the recurrence rule in `smart_date_rule`
+            $database->update('smart_date_rule')
+              ->fields(['start' => $earliest_start, 'end' => $earliest_end])
+              ->condition('rid', $rrule_id)
+              ->execute();
+        }
+    }
+  }
+
+  /**
+   * Sends a cleanup report email.
+   */
+  private function sendCleanupEmail($to, $days, $deleted_event_nids, $deleted_rule_rids, $log_messages) {
+    $subject = "Smart Date Cleanup Report - " . date('Y-m-d');
+    $body = "Smart Date Cleanup Report\n\n";
+    $body .= "Deleted Events: " . count($deleted_event_nids) . "\n";
+    $body .= "Deleted Rules: " . count($deleted_rule_rids) . "\n\n";
+    $body .= implode("\n", $log_messages) . "\n\n";
+    $body .= "--------------------------------------------\n";
+    $body .= "Note: Please remember to run `drush cr` after executing this command to ensure that the changes are reflected on the node editing page.\n";
+    $params = ['subject' => $subject, 'message' => $body];
+    $langcode = $this->languageManager->getDefaultLanguage()->getId();
+    $this->mailManager->mail('smart_date_recur', 'cleanup_report', $to, $langcode, $params);
+  }
 }
