From 67b1d771ac29b2b65c21aaf8c969d2e930997f0c Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Fri, 23 Oct 2015 12:53:51 +0000 Subject: [PATCH] imap : if there is an authentication, return an exception with 401 code git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2376 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- imap.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/imap.php b/imap.php index 5f88848..ed55a4a 100644 --- a/imap.php +++ b/imap.php @@ -63,6 +63,9 @@ class imap { // imap_errors() takes the errors and clear the error stack $errors = imap_errors(); + if (substr ($e->getMessage (), 0, 35) === + "Can not authenticate to IMAP server") + throw new Exception ("IMAP error : ".$e->getMessage(), 401); throw new Exception ("IMAP error : ".$e->getMessage(), 500); } }