Email verification with PHPMailer without sending link?

71
May 13, 2022, at 00:30 AM

I'm currently writing a chat program in PHP and AJAX and have PHPMailer installed and in use.

The chat program will be available to businesses who join my site so they can live chat to their clients. I need to be able to provide clients with an easy way to start chatting with a business without having to go through the rigmarole of waiting to receive an email then clicking a link to get verified.

Currently my email checking is done first through Javascript as follows;

 // Chat Start - Validate Input Data - Chat Start Email
 $(document).on('input','#csmail',function() {
 var csmail=$("#csmail").val();
 var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
 if(!regex.test(csmail)) {
 $("#csemail").html("Email Address <span class='red'>invalid!</span>");
 } else {
 $("#csemail").html("Email Address");
 }
 });

Then a further check is done via PHP and an AJAX response is sent back after the email domain has been checked, code below is when domain validation fails;

 <?php
 // Email
 $csmail = mysqli_real_escape_string($con_usr_pub, $_POST['csmail']);
 $csmail_host = strtolower(substr(strrchr($csmail, "@"), 1));
 $csmail_host = idn_to_ascii($csmail_host.'.');
 if (filter_var($csmail, FILTER_VALIDATE_EMAIL) === false || !checkdnsrr($csmail_host, "MX")) {
 $response[] = "email";
 }
 ?>

The issue is that only the domain is being checked here and this will inevitably allow misuse of chat to occur so my question is: is there a way to use PHPMailer to contact an email address and get a result back which can be used to properly verify the full email address? Or is there any other way an email can be fully verified without relying on the user to wait for an email to be sent and them clicking on a link?

Many thanks.

READ ALSO
What is a single pipe equivalent in dart?

What is a single pipe equivalent in dart?

I'm attempting to convert a piece of PHP code to dart and I came across a few things I've simply never used before, one of which is a single pipe |Im not sure what the exact dart equivalent is, if there even is one

63
What is the proper way to do a foreach loop with an Array/Map in dart?

What is the proper way to do a foreach loop with an Array/Map in dart?

I'm trying to convert a piece of PHP code to dart and getting stuckWhat I have is a PHP array text that gets run through a function called toUTF8 as follows:

65
Laravel Error: Details blade displays wrong data, displays previous column data

Laravel Error: Details blade displays wrong data, displays previous column data

I have a Details page that displays "short description", "Duration", and "description of tour" from a database

28
File Download via API using Guzzle

File Download via API using Guzzle

I'm still on the learning slopes with Guzzle, but am stumped with this issue

40