<?php

final class MetaMTAMailSentGarbageCollector
  extends PhabricatorGarbageCollector {

  public function collectGarbage() {
    $ttl = phutil_units('90 days in seconds');

    $mails = id(new PhabricatorMetaMTAMail())->loadAllWhere(
      'dateCreated < %d LIMIT 100',
      PhabricatorTime::getNow());

    foreach ($mails as $mail) {
      $mail->delete();
    }

    return (count($mails) == 100);
  }

}

<?php

final class MetaMTAMailSentGarbageCollector
  extends PhabricatorGarbageCollector {

  public function collectGarbage() {
    $ttl = phutil_units('90 days in seconds');

    $mails = id(new PhabricatorMetaMTAMail())->loadAllWhere(
      'dateCreated < %d LIMIT 100',
      PhabricatorTime::getNow() - $ttl);

    foreach ($mails as $mail) {
      $mail->delete();
    }

    return (count($mails) == 100);
  }

}

Fix GC threshold for mail to be 90 days instead of 0 seconds
Fix GC threshold for mail to be 90 days instead of 0 seconds

See D13408.
