/** * Auto removes email file when expired. * @param string * @return bool */ private function removeExpired($path) { if ($this->autoremove) { $now = new DateTime(); $file_date = new DateTime('@' . filemtime($path)); $file_date->setTimezone($now->getTimezone()); $remove_date = $now->modify($this->autoremove); if ($file_date < $remove_date) { unlink($path); return TRUE; } } return FALSE; }