Python Script to Check if Email is Valid or Invalid Using validators Library in Terminal
20K views
Jun 3, 2025
Buy the full source code of application here:
View Video Transcript
0:00
uh hello guys welcome to this video So
0:02
in this video I will show you yet
0:04
another Python package which will
0:06
actually fix invalid emails It will give
0:10
you actually it will validate whether
0:12
email address that you written is valid
0:14
or not Uh it will show you a valid or
0:17
invalid message So as soon as I write
0:21
this script here you will see run the
0:23
script It will check this email address
0:25
As you can see it's not in valid email
0:28
the syntax is not right So now it
0:31
returns this is invalid email So very
0:34
simple script If I fix this let's
0:38
suppose I fix this email address Now
0:39
it's valid So once again I run the
0:42
Python script You will see now it is
0:44
showing that it's a valid email So for
0:46
this you just need a third party package
0:49
Just need to install this package uh pip
0:51
install validators So this is the name
0:54
of the package So simply install this
0:57
command and install this package So
1:00
after installing it it's very easy So
1:02
you first of all import this package
1:05
Import validators So at the very top and
1:09
then you declare whatever email address
1:11
that you're working here
1:17
So after that you write your email
1:20
address inside the variable And now we
1:23
can actually call this validators and it
1:26
contains this function which is email
1:29
and here you actually pass your email
1:31
address and it it returns either true or
1:35
false So if it returns true then in that
1:38
case you will simply say it's a valid
1:41
email and if it returns false then in
1:45
that the else case we will simply print
1:47
out that it's a invalid email
1:50
So very simple Python script It imports
1:53
the package Then it declares the email
1:55
address Then it checks in this if
1:58
condition If the val email is valid then
2:00
we simply say valid email If the email
2:03
is not valid then we say invalid email
2:06
So as soon as I execute this now python
2:10
app py So you will see it's a valid
2:12
email So if I make some mistake here in
2:15
the syntax if I write here add the rate
2:18
symbol once again
2:20
So now you will see it changes to
2:22
invalidable
2:24
So in this way guys you can uh
2:28
validate your email addresses while
2:31
developing Python application Simply
2:32
install this package and uh you can
2:35
easily do the validation of email And
2:39
thank you very much for watching this
2:40
video and also check out my website
2:42
freemediatools.com
2:44
uh which contains thousands of tools
#Email
#Jobs & Education