Remove processed packets if there were no issues
This commit is contained in:
@@ -100,7 +100,8 @@ final class Receive extends Item
|
||||
case self::IS_PKT:
|
||||
Log::info(sprintf('%s: - Processing mail packet [%s]',__METHOD__,$this->file));
|
||||
|
||||
foreach (Packet::open(new File($this->file),$this->ao->zone->domain)->messages as $msg) {
|
||||
$po = Packet::open(new File($this->file),$this->ao->zone->domain);
|
||||
foreach ($po->messages as $msg) {
|
||||
Log::info(sprintf('%s: - Mail from [%s] to [%s]',__METHOD__,$msg->fftn,$msg->tftn));
|
||||
|
||||
// @todo Quick check that the packet should be processed by us.
|
||||
@@ -109,6 +110,16 @@ final class Receive extends Item
|
||||
// Dispatch job.
|
||||
ProcessPacket::dispatchSync($msg);
|
||||
}
|
||||
|
||||
if ($po->hasErrors) {
|
||||
Log::info(sprintf('%s: - Not deleting packet [%s], as it has validation errors',__METHOD__,$this->file));
|
||||
|
||||
// If we want to keep the packet, we could do that logic here
|
||||
} elseif (! config('app.packet_keep')) {
|
||||
Log::debug(sprintf('%s: - Deleting processed packet [%s]',__METHOD__,$this->file));
|
||||
unlink($this->file);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Reference in New Issue
Block a user