Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WP Contact Form 7 Email Validator
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anton Sarukhanov
WP Contact Form 7 Email Validator
Commits
9cb1a82d
Commit
9cb1a82d
authored
7 years ago
by
Anton Sarukhanov
Browse files
Options
Downloads
Patches
Plain Diff
Initial commit
parents
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
contact-form-7-email-validator.php
+30
-0
30 additions, 0 deletions
contact-form-7-email-validator.php
with
30 additions
and
0 deletions
contact-form-7-email-validator.php
0 → 100644
+
30
−
0
View file @
9cb1a82d
/*
Plugin Name: Contact Form 7 Email Validator
Plugin URI: https://wordpress.org/plugins/contact-form-7-email-validator
Description: Validate email addresses in Contact Form 7 submissions.
Version: 0.1
Author: Anton Sarukhanov
Author URI: https://ant.sr
License: MIT
*/
add_filter
(
'wpcf7_validate_email*'
,
'wpcf7ev_validate_email'
,
20
,
2
);
function
wpcf7ev_validate_email
(
$result
,
$tag
)
{
$tag
=
new
WPCF7_FormTag
(
$tag
);
$email
=
isset
(
$_POST
[
$tag
->
name
])
?
trim
(
$_POST
[
$tag
->
name
])
:
''
;
$mailboxlayer_access_key
=
'YOUR_ACCESS_KEY'
;
$ch
=
curl_init
(
'http://apilayer.net/api/check?access_key='
.
$mailboxlayer_access_key
.
'&email='
.
$email
.
''
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
true
);
$json
=
curl_exec
(
$ch
);
curl_close
(
$ch
);
$validationResult
=
json_decode
(
$json
,
true
);
if
(
!
$validationResult
[
'smtp_check'
])
{
$result
->
invalidate
(
$tag
,
"This email address could not be verified!"
);
}
return
$result
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment