Hi i am hoping to develop a Magento extension which can check the top level domain (.co.uk, .gov, .mil) and also verify the email address is valid by sending the user an email with a link or code.
Any advice or a point in the right direction is much appreciated!
Check below may be help you & email verification with link is default magento functionality
– Go to System -> Configuration -> CUSTOMERS -> Customer Configuration – Click Create New Account Options – Set Require Emails Confirmation = Yes – Save Config
Domain validation code:-
$email = 'the_username_here@yahoo.com'; $domain = substr(strrchr($email, "@"), 1); $domain_list = array("(co.uk", "gov", "yahoo.com","mil"); if (in_array($domain, $domain_list)) { echo "This is correct domain"; }
Just to follow Magikvishal's advice - I'd look at using PHP's filter_var() function for this:
if (!filter_var($email, FILTER_VALIDATE_EMAIL) === false) { echo ("$email is a valid email address"); } else { echo("$email is not a valid email address"); }
Thank you for that i have tried the following:
$domain = substr(strrchr($_POST['email'], "@"), 1);
$domain_list = array(".co.uk", "org.uk");
if (in_array($domain, $domain_list) === false) {
echo "This email address does not qualify";
}
If i enter test@.co.uk it works but i need to be able to enter test@anything.co.uk
@Magikvishal is right so please follow the #Magikvishal's method
and thank you
Hi there,
There are two extensions available for email verification - OTP based and instant email checker.
1. OTP (One Time Password) for Magento 2 - With this, customers need to do verification during the registration and checkout. One-time-passcode is sent to the customer's email address to prevent fake customer signup and orders. Further, you can also implement mobile SMS based OTP verification.
2. Security Extension Suite for Magento 2 - This is a complete security solution offering various features for both customers and store owners. While signup, real-time email address verification is done via Mailboxlayer API.
Do share your thoughts.
Thanks,
Rohit.
what can i do if i want OTP in email instead of Verification link in magento 2 ?