Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/InboundEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,43 @@ public function isValid(): bool
{
return $this->from() !== '' && ($this->isText() || $this->isHtml());
}

public function isAutoReply($checkCommonSubjects = true): bool
{
if ($this->headerValue('x-autorespond')) {
return true;
}

if (in_array($this->headerValue('precedence'), ['auto_reply', 'bulk', 'junk'])) {
return true;
}

if (in_array($this->headerValue('x-precedence'), ['auto_reply', 'bulk', 'junk'])) {
return true;
}
if (in_array($this->headerValue('auto-submitted'), ['auto-replied', 'auto-generated'])) {
return true;
}

if ($checkCommonSubjects) {
return Str::startsWith($this->subject(), [
'Auto:',
'Automatic reply',
'Autosvar',
'Automatisk svar',
'Automatisch antwoord',
'Abwesenheitsnotiz',
'Risposta Non al computer',
'Automatisch antwoord',
'Auto Response',
'Respuesta automática',
'Fuori sede',
'Out of Office',
'Frånvaro',
'Réponse automatique',
]);
}

return false;
}
}