php - Check if the email is valid in a data migration and/or it's real -


two question code made migrate table form old format, many fake emails (not existents), , wrong emails (bad write) application did not check anything.

first, use validation on laravel 5.2 check if old email value detect if email valid email.

all examples see it's use check on form web, not command. all, validate examples of forms, , think it's different because should not included in use

use illuminate\validation\validator; ..  $email_wrong = 'ksisks @kikoo';  // how check it's valid email? 

second question try search class or example validate if email it's real email.

to validate email can use next function method in class:

/**  * check if @param formatted e-mail address.  *  * @param string $emailtockeck  * @return bool  */ private function validateemail($emailtockeck) {     $my_data = [         'email' => $emailtockeck,     ];     $validator = validator::make($my_data, [         'email' => 'email',     ]);     if ($validator->fails()) {         return false;     } else {         return true;     } } 

to chek if email exists or no can use api this or this.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -