summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/ampache.cfg.php.dist5
-rw-r--r--modules/validatemail/validateEmail.php24
2 files changed, 28 insertions, 1 deletions
diff --git a/config/ampache.cfg.php.dist b/config/ampache.cfg.php.dist
index 4be6251e..e5f61472 100644
--- a/config/ampache.cfg.php.dist
+++ b/config/ampache.cfg.php.dist
@@ -440,6 +440,11 @@ refresh_limit = "60"
; You need to change this when you activate public_registration.
;mail_from = "info@domain.tld"
+; It defines whether this setup checks a mail address strictly.
+; You can select "strict" or "easy" or "none".
+; DEFAULT: strict
+;mail_check = "strict"
+
; This setting turns on/off admin notify off registration.
; DEFAULT: false
;admin_notify_reg = "false"
diff --git a/modules/validatemail/validateEmail.php b/modules/validatemail/validateEmail.php
index 3d460143..a08636de 100644
--- a/modules/validatemail/validateEmail.php
+++ b/modules/validatemail/validateEmail.php
@@ -148,6 +148,12 @@ function validateEmail ( $email, $verbose=0 ) {
// Leave blank to use $SERVER_NAME.
// Note that most modern MTAs will ignore (but require) whatever you say here ...
// the server will determine your domain via other means.
+ if (Config::get('mail_check')) {
+ $mail_check = Config::get('mail_check');
+ } else {
+ $mail_check = "strict";
+ }
+
if (Config::get('mail_domain')) {
$serverName = Config::get('mail_domain');
}
@@ -274,6 +280,8 @@ function validateEmail ( $email, $verbose=0 ) {
}
if ( $verbose ) eval("echo \"Internal: checking DNS for $domain ... \"; $vNL");
+ // Strict Mail Check
+ if($mail_check == "strict") {
// check that an MX record exists for Top-Level domain
// If it exists, start our email address checking
if (function_exists('checkdnsrr')) {
@@ -621,7 +629,20 @@ function validateEmail ( $email, $verbose=0 ) {
} // end checkdnsrr test
} // if function doesn't exist
-
+ } elseif ($mail_check == "easy") {
+ $pattern = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$";
+ if(eregi($pattern, $email)) {
+ $return[0] = true;
+ $return[1] = "OK";
+ } else {
+ $return[0] = false;
+ $return[1] = "NG";
+ }
+ } else {//
+ $return[0] = true;
+ $return[1] = "No Check";
+ }
+
} // end walking through each domain possibility
} // end isValid
@@ -639,4 +660,5 @@ function validateEmail ( $email, $verbose=0 ) {
return $return;
} // END validateEmail-2.0
+
?>