How to check if an email address exists without sending an email ?
In this article, we will learn to check if an address exists without sending an email.
Approach: By using some free APIs we can easily check whether an email is valid or not. One of the easiest way to check whether an email address is valid is to use PHP’s filter_var() function.
Example 1:The following method can only check if the format is a valid email format. In this, we cannot check whether the format actually exits or not.
PHP
|
Email is Valid Email is not valid
Example 2: To check if an email exists, we need to use some APIs into our PHP program. We are going to use a free API called abstractapi. The curl_init() function returns a cURL handle. The curl_setopt() set an option for a cURL transfer. The curl_setopt_array() sets multiple options for a cURL transfer. This function is useful for setting a large number of cURL options without repetitively calling curl_setopt().
PHP
|
Valid Email format EmailID [email protected] exists
If we execute the command
echo $res ;
It contains all the information about our email
{"email":"[email protected]","autocorrect":"","deliverability":"DELIVERABLE","quality_score":"0.70","is_valid_format":{"value":true,"text":"TRUE"},"is_free_email":{"value":true,"text":"TRUE"},"is_disposable_email":{"value":false,"text":"FALSE"},"is_role_email":{"value":false,"text":"FALSE"},"is_catchall_email":{"value":false,"text":"FALSE"},"is_mx_found":{"value":true,"text":"TRUE"},"is_smtp_valid":{"value":true,"text":"TRUE"}}
Example 3: We can also check the value of $data[‘is_smtp_valid’][‘value’] to check whether the email exists or not
PHP
|
Valid Email format EmailID [email protected] exists
In this article, we will learn to check if an address exists without sending an email.
Approach: By using some free APIs we can easily check whether an email is valid or not. One of the easiest way to check whether an email address is valid is to use PHP’s filter_var() function.
Example 1:The following method can only check if the format is a valid email format. In this, we cannot check whether the format actually exits or not.
PHP
|
Email is Valid Email is not valid
Example 2: To check if an email exists, we need to use some APIs into our PHP program. We are going to use a free API called abstractapi. The curl_init() function returns a cURL handle. The curl_setopt() set an option for a cURL transfer. The curl_setopt_array() sets multiple options for a cURL transfer. This function is useful for setting a large number of cURL options without repetitively calling curl_setopt().
PHP
|
Valid Email format EmailID [email protected] exists
If we execute the command
echo $res ;
It contains all the information about our email
{"email":"[email protected]","autocorrect":"","deliverability":"DELIVERABLE","quality_score":"0.70","is_valid_format":{"value":true,"text":"TRUE"},"is_free_email":{"value":true,"text":"TRUE"},"is_disposable_email":{"value":false,"text":"FALSE"},"is_role_email":{"value":false,"text":"FALSE"},"is_catchall_email":{"value":false,"text":"FALSE"},"is_mx_found":{"value":true,"text":"TRUE"},"is_smtp_valid":{"value":true,"text":"TRUE"}}
Example 3: We can also check the value of $data[‘is_smtp_valid’][‘value’] to check whether the email exists or not
PHP
|
Valid Email format EmailID [email protected] exists