Skip to content

Commit 4a5de8c

Browse files
authored
Merge pull request #89 from io238/master
Added isAutoReply() method to InboundEmail
2 parents 57cb8a8 + f4eee16 commit 4a5de8c

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

src/InboundEmail.php

+39
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,43 @@ public function isValid(): bool
193193
{
194194
return $this->from() !== '' && ($this->isText() || $this->isHtml());
195195
}
196+
197+
public function isAutoReply($checkCommonSubjects = true): bool
198+
{
199+
if ($this->headerValue('x-autorespond')) {
200+
return true;
201+
}
202+
203+
if (in_array($this->headerValue('precedence'), ['auto_reply', 'bulk', 'junk'])) {
204+
return true;
205+
}
206+
207+
if (in_array($this->headerValue('x-precedence'), ['auto_reply', 'bulk', 'junk'])) {
208+
return true;
209+
}
210+
if (in_array($this->headerValue('auto-submitted'), ['auto-replied', 'auto-generated'])) {
211+
return true;
212+
}
213+
214+
if ($checkCommonSubjects) {
215+
return Str::startsWith($this->subject(), [
216+
'Auto:',
217+
'Automatic reply',
218+
'Autosvar',
219+
'Automatisk svar',
220+
'Automatisch antwoord',
221+
'Abwesenheitsnotiz',
222+
'Risposta Non al computer',
223+
'Automatisch antwoord',
224+
'Auto Response',
225+
'Respuesta automática',
226+
'Fuori sede',
227+
'Out of Office',
228+
'Frånvaro',
229+
'Réponse automatique',
230+
]);
231+
}
232+
233+
return false;
234+
}
196235
}

0 commit comments

Comments
 (0)