summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzytzagoo <zytzagoo@gmail.com>2014-09-08 15:54:04 +0200
committerzytzagoo <zytzagoo@gmail.com>2014-09-08 15:54:04 +0200
commitdb2a8cc8a324fd52a33ee729669500309671e6bf (patch)
tree9e1a8a5174fcac767ccee23f9becb3fb2d3374ad
parent3062e5e1fae7163e733a53f243a133553771179c (diff)
downloadsmtp-validate-email-db2a8cc8a324fd52a33ee729669500309671e6bf.zip
smtp-validate-email-db2a8cc8a324fd52a33ee729669500309671e6bf.tar.gz
smtp-validate-email-db2a8cc8a324fd52a33ee729669500309671e6bf.tar.bz2
Handle @kevin39's #10 exception catching slightly differently, maintaining configurable results when comm fails...
...instead of assuming everything is valid when those exceptions occur. Controlling the desired outcome is done via `$this->no_comm_is_valid`, as before.
-rw-r--r--smtp-validate-email.php27
1 files changed, 13 insertions, 14 deletions
diff --git a/smtp-validate-email.php b/smtp-validate-email.php
index 98c4972..c6749a5 100644
--- a/smtp-validate-email.php
+++ b/smtp-validate-email.php
@@ -331,20 +331,19 @@ class SMTP_Validate_Email {
$this->set_domain_results($users, $domain, $this->no_comm_is_valid);
}
- }
- catch(SMTP_Validate_Email_Exception_Unexpected_Response $e)
- {
- foreach ($users as $user) {
- $address = $user . '@' . $domain;
- $this->results[$address] = true;
- }
- }
- catch(SMTP_Validate_Email_Exception_Timeout $e)
- {
- foreach ($users as $user) {
- $address = $user . '@' . $domain;
- $this->results[$address] = true;
- }
+
+ } catch (SMTP_Validate_Email_Exception_Unexpected_Response $e) {
+
+ // Unexpected responses handled as $this->no_comm_is_valid, that way anyone can
+ // decide for themselves if such results are considered valid or not
+ $this->set_domain_results($users, $domain, $this->no_comm_is_valid);
+
+ } catch (SMTP_Validate_Email_Exception_Timeout $e) {
+
+ // A timeout is a comm failure, so treat the results on that domain
+ // according to $this->no_comm_is_valid as well
+ $this->set_domain_results($users, $domain, $this->no_comm_is_valid);
+
}
}