'How to validate Email for 'valid email' without sending 'email verfication' in laravel 8?
I want to validate email as 'entered mail id valid or not' because user enters junk mail id it doesn't exist'
These are validation I have used
$request->validate([
'name' => 'required',
'email' => 'required|email|unique:users',
'password' => 'required|min:6',
'phone' => 'required',
'billing_address' => 'required',
'billing_city' => 'required',
'billing_state' => 'required',
'billing_zipcode' => 'required',
'billing_country' => 'required',
'payment_gateway_id' => 'required',
],
[
'payment_gateway_id.required' => 'Please select payment gateway'
]);
my concern is user to enter valid mail address which is exists. I have used one package which is available https://github.com/tintnaingwinn/email-checker/issues/12 but is gives error for valid email address.
please help me to find the solution.
Solution 1:[1]
You can't check that entered email address exist, but instead of that can add DNS validation.
Laravel email validation rule uses the egulias/email-validator package with default option RFCValidation. You can add DNSCheckValidation like this.
$request->validate([
'email' => 'required|email:rfc,dns|unique:users'
]);
DNSCheckValidation: Will check if there are DNS records that signal that the server accepts emails. This does not entail that the email exists.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Hrahat Tahmazyan |
