Skip to content

Commit

Permalink
Fix outlook email auth (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrimaud committed Sep 13, 2020
1 parent 27fd08c commit 4e95e66
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Instagram/Auth/Checkpoint/ImapClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,19 @@ public function getLastInstagramEmailContent(int $try = 1): string
$headers = imap_headerinfo($resource, $i, 0);

preg_match('/<font size="6">([0-9]{6})<\/font>/s', $body, $match);
if ($headers->senderaddress === 'Instagram <[email protected]>' && isset($match[1])) {

$isMailFromInstagram = false;

// confirm instagram is the mail sender
if (
(property_exists($headers, 'senderaddress') &&
$headers->senderaddress === 'Instagram <[email protected]>')
|| $headers->from->host === 'mail.instagram.com'
) {
$isMailFromInstagram = true;
}

if ($isMailFromInstagram && isset($match[1])) {
imap_delete($resource, $i);

$foundCode = true;
Expand Down

0 comments on commit 4e95e66

Please sign in to comment.