Problem with email validation?

What seems to be the problem:

When I use the validate Email attribute like: ‘email’ => 'required*|*email’,

I can pass an email address like [email protected] without .topleveldomain to the DB

Steps to Reproduce:

Are you using the latest version of Livewire:


Do you have any screenshots or code examples:

public function updatedEmail()
‘email’ => ‘unique:users|email’,

this will pass [email protected] to the DB

Hey, @reniar1
You can validate the TLD for email with

'email' => ['required', 'max:255', 'email', 'regex:/(.*)@(gmail|yahoo|protonmail)\.com/i', 'unique:users'],

See more here

1 Like

I love it.

That is a great solution thank you skywalker again.

Are you also active on the laracast forum?

I’m happy to hear that!

Nop, I’m not that active in laracasts :smile:

You only want to permit specific domains?

You can specify additional checks in the email rule for rfc and dns checking


@reniar1 Snapey is 1st on leaderboard in laracasts :smiley:

1 Like

You don’t need to use regular expressions to check if the email address is valid, because the rule you have is technically correct ([email protected] is valid, just like [email protected] would be valid). Adding the filter validation would make [email protected] invalid:

'email' => 'unique:users|email:filter'

You may want to consider adding more validations as well, e.g.:

'email' => 'unique:users|email:filter,rfc,spoof'