User Registration with Email Verification using PHP and Mysql

by  
Share:
User Registration with Email Verification using PHP and Mysql

I had receive a tutorial request from one of my blog follower to make or demonstrate User Registration with Email Verification using PHP and Mysql. So the flow is quite simple, user registers to a site, and email is sent to their email address for verification. User then click a link in the email message which redirect him back to the site where it’s account gets approved. I have used php-mailer library so you can send mail via your google account from your local server itself.

View Demo

Create a database with user table

The first thing you have to do is to create your database and table where the records can be stored. Use the sql script below.

CREATE DATABASE IF NOT EXISTS login_system;
USE login_system;
CREATE TABLE IF NOT EXISTS `tbl_users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `pass` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `status`  enum('approved','pending') NOT NULL DEFAULT 'pending',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;

Setup a form with four fields username, email, password and confirm password. just to be extra sure of the password.
<form class="form-horizontal contactform" action="index.php" method="post" name="f">
  <fieldset>
  <div class="form-group">
    <label>Name:
      <input type="text" placeholder="Your Name" id="uname" class="form-control" name="uname">
      </label>
    </div>

    <div class="form-group">
      <label class="col-lg-12 control-label" for="uemail">Email:
        <input type="text" placeholder="Your Email" id="uemail" class="form-control" name="uemail">
        </label>
      </div>

      <div class="form-group">
        <label class="col-lg-12 control-label" for="pass1">Password:
        <input type="password" placeholder="Password" id="pass1" class="form-control" name="pass1">
        </label>
     </div>

     <div class="form-group">
       <label class="col-lg-12 control-label" for="pass1">Confirm Password:
       <input type="password" placeholder="Password" id="pass2" class="form-control" name="pass2">
        </label>
       </div>

       <div class="form-group">
       <div class="col-lg-10">
       <button class="btn btn-primary" type="submit" name="sub">Submit</button> 
       </div>
       </div>
   </fieldset>
</form>

Validation and user registration code with PHP and Mysql

I am skipping the client side validation with javascript, it is there in the demo and the download scripts. When the user submits the form it’s a two step process. First we check if any existing email id is present in the database, if yes we don’t proceed further, if no then we insert the values in the database and send an email to the user. The user status will be pending until user verify their email. See the code to insert the user record below.

<?php
if (isset($_POST["sub"])) {

  $name = trim($_POST["uname"]);
  $pass = trim($_POST["pass1"]);
  $email = trim($_POST["uemail"]);
  $sql = "SELECT COUNT(*) AS count from tbl_users where email = :email_id";
  try {
    $stmt = $DB->prepare($sql);
    $stmt->bindValue(":email_id", $email);
    $stmt->execute();
    $result = $stmt->fetchAll();

    if ($result[0]["count"] > 0) {
      $msg = "Email already exist";
      $msgType = "warning";
    } else {
      $sql = "INSERT INTO `tbl_users` (`name`, `pass`, `email`) VALUES " . "( :name, :pass, :email)";
      $stmt = $DB->prepare($sql);
      $stmt->bindValue(":name", $name);
      $stmt->bindValue(":pass", md5($pass));
      $stmt->bindValue(":email", $email);
      $stmt->execute();
      $result = $stmt->rowCount();

      if ($result > 0) {

        $lastID = $DB->lastInsertId();
        $msg = "User registered successfully";
        $msgType = "success";

      } else {
        $msg = "Failed to create User";
        $msgType = "warning";
      }
    }
  } catch (Exception $ex) {
    echo $ex->getMessage();
  }
}

?>

Sending mails using your Google account from your local/online server using phpmailer

For sending mail to user you can use php mail function. But that doesn’t work most of the time in your local server. There’s an excellent plugin I use in most of my project “PHPMAILER“. You can send good looking HTML email with your Gmail or any other mail account via SMTP. All you have to do it so set up your email id, password and host and port name.

<?php
// include the phpmailer class file
require_once "phpmailer/class.phpmailer.php";

// my message to send to the user
$lastID = $DB->lastInsertId();

$message = '<html><head>
           <title>Email Verification</title>
           </head>
           <body>';
$message .= '<h1>Hi ' . $name . '!</h1>';
$message .= '<p><a href="'.SITE_URL.'activate.php?id=' . base64_encode($lastID) . '">CLICK TO ACTIVATE YOUR ACCOUNT</a>';
$message .= "</body></html>";

// php mailer code starts
$mail = new PHPMailer(true);
// telling the class to use SMTP
$mail->IsSMTP();
// enable SMTP authentication
$mail->SMTPAuth = true;   
// sets the prefix to the server
$mail->SMTPSecure = "ssl"; 
// sets GMAIL as the SMTP server
$mail->Host = "smtp.gmail.com"; 
// set the SMTP port for the GMAIL server
$mail->Port = 465; 

// set your username here
$mail->Username = 'youremail@gmail.com';
$mail->Password = 'your password';

// set your subject
$mail->Subject = trim("Email Verifcation - aarafacademy.com");

// sending mail from
$mail->SetFrom('youremail@gmail.com', 'Your Name');
// sending to
$mail->AddAddress($email);
// set the message
$mail->MsgHTML($message);

try {
  $mail->send();
} catch (Exception $ex) {
  echo $msg = $ex->getMessage();
}
?>

Approving user registration process from email

The final part is approving the user. When you are sending email to the user, add the user ID that you recieve when you insert the record in the database. So when user hit the link it will be redirected back to your site with the user ID. You can then use that user ID and update the database.

if (isset($_GET["id"])) {
  $id = intval(base64_decode($_GET["id"]));

  $sql = "SELECT * from tbl_users where id = :id";
  try {
    $stmt = $DB->prepare($sql);
    $stmt->bindValue(":id", $id);
    $stmt->execute();
    $result = $stmt->fetchAll();

    if (count($result) > 0) {

      if ($result[0]["status"] == "approved") {
        $msg = "Your account has already been activated.";
        $msgType = "info";
      } else {
        $sql = "UPDATE `tbl_users` SET  `status` =  'approved' WHERE `id` = :id";
        $stmt = $DB->prepare($sql);
        $stmt->bindValue(":id", $id);
        $stmt->execute();
        $msg = "Your account has been activated.";
        $msgType = "success";
      }
    } else {
      $msg = "No account found";
      $msgType = "warning";
    }
  } catch (Exception $ex) {
    echo $ex->getMessage();
  }
}

View Demo
Download

Get the latest updates directly in your inbox for FREE: Subscribe here

Share your feedback / let me know your doubts regarding this tutorial in the comment box given below.

Share:
Hasan

Shahrukh Khan (Hasan)

A software engineer who's a die-hard coder, blogger, dreamer and mentor with years of expertise in web development. Know more...

Related Posts

Nitish Kasar on

good Script bro, especially liked the validation and prepared SQL methods thanks for sharing …. Keep it up

Reply
Lester on

smtp() connect failed.

Reply
Shahrukh Khan on

Make sure the access are correct and your internet is connected.

Reply
imran on

i got the same error even internet connected
how to configure SMTP with localhost.

Shahrukh Khan on

Hi. take a look at the few things given below which can be the major causes for not sending emails.
Your username, password, and host maybe incorrect.
try changing the smtp authentication mode $mail->SMTPAuth = true; to $mail->SMTPAuth = false;
try to print the error message what you see in the catch clause.

imran on

thanks shahrukh for the help…

Shahrukh Khan on

your welcome

Shahrukh Khan on

see if the ssl is turned on or not

Shahrukh Khan on

the email id must be fake thats why

herve on

Good Job man.
I’m new to php, can you please provide also one with the login page.
thanks

Shahrukh Khan on

i think a tutorial is already there in my blog.

ravi kiran on

bro can u help me out how to code for admin approval after user login

Shahrukh Khan on

i dont understand your question fully.

mozy on

I can’t find the “phpmailer/class.phpmailer.php” and the activate.php?id script. Please how do i do this I’m a novice to php and mysql

Shahrukh Khan on

download the zip file properly, everything is in the folder.

kishor on

where is the download link..

Reply
Shahrukh Khan on

click on the social link to avail the download the link.

Reply
gautam on

thanx for ths script
but it shows following error

Fatal error: Undefined class constant ‘MYSQL_ATTR_INIT_COMMAND’ in C:\wamp\www\email-verification-php-mysql\config.php on line 22

Reply
Shahrukh Khan on

in your php.ini file remove ; (uncomment)
extension=php_pdo_mysql.dll on Windows
extension=php_pdo_mysql.so on Linux/Mac

Reply
gautam on

it works now…
thanks man…

Arif on

i m getting error as
SMTP error:Could not authenticate

Reply
Shahrukh Khan on

please check your credentials/username/password/port no

Reply
rajs on

Hi Shahrukh

i got the error SMTP error:Could not authenticate
i will give my credentials like username, password and port number = 465 but it’s not working can you please help

Armel on

The requested URL /email-verification/activate.php was not found on this server.
hello, i got the error

Shahrukh Khan on

please check your project URL and also check if the file activate.php physically exist or not.

krunal on

i am also getting same error

Yashwanth Reddy Guduru on

This could be a reason when ssl is implemented in php, change the port number to 587 and the connection to TLS.
Some times even smtp of gmail gives you error, so change the gmail settings to allow less secure apps if you are trying from any local servers like wamp or xamp.

These steps helped me, hope they work for you too.

@shahrukh , that was a great tutorial, keep up the good work!!

Shahrukh Khan on

Thanks. I would recommend everyone to follow Mr. Guduru points to help you fix your isssues.

michal-fri on

SMTP connect() failed.
database info is ok, what now?

Reply
Devendra on

Hello sir all are working proper till last but in last it gives error
after clicking email for action

it give to

Hi devendra!

CLICK TO ACTIVATE YOUR ACCOUNT
and when i click to active link it gives error

Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Error 404

localhost
Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3

Reply
Shahrukh Khan on

That’s because you dont have any have that file in the the server. please check

Reply
Ray.W on

In your configuration.php,

change this line into your own URL

define(‘SITE_URL’, ‘http://your_own_URL’);

so when you click on “CLICK TO ACTIVATE YOUR ACCOUNT”, it will redirect you to you own “activation” page.

Reply
Danyal Fayyaz on

written up well. Thanks man

Reply
Boobathi on

I got error in SMTP Error: Could not authenticate. So kindly help me how to send mail for activation link

Reply
Shahrukh Khan on

You must have an online server to send mail, maybe gmail has stopped sending mails now. I am getting the same error. try sending without smtp authentication. or use your online server smtp credentials to send emails.

Reply
priya on

what are the online servers available pls help me

NiggOh on

SMTP connect() failed.

Where should i change username password ?

Reply
Shahrukh Khan on

try some live server mail access

Reply
Manish on

Hello Shahrukh khan,
Thanks for this amazing Tuturial.
But
where is the login page after confirming email?

Reply
Shahrukh Khan on

no login page is there. it is focused on registration only.

Reply
Mahim on

how can i check username and email availability both using this code, i tried but im getting error cannot use try without catch or finally…please help..

Reply
Shahrukh Khan on

what error are you getting?

Reply
mahim on

im getting cannot use try without catch or finally

Shahrukh Khan on

in php try is closed with catch.. make sure you have the correct syntax.
try {
// your code
}catch (Exception $ex) {
echo $ex->getMessage();
}

Mahim on

can you share the same code with username and email verification both??

Shahrukh Khan on

code is already available for download.

Mahim on

But it only checks Email from database, not Username. I have tried checking both Username and Email with this code but it gives error.
If the Username is available and Email is registered already it will echo Username is available and Email is already registered but inserts data into database. Also i get cannot use try without catch or finally error also.
I you could share a code which check both username and email from database, it will be a great help.

Shahrukh Khan on

why don’t you make username and email in the database unique. it will solve half of you primary issue.

rajkumar on

mail sent but email confirmation not received error (-102)

priya on

it occurs an error in phpmailer.

phpmailer file should hav what??

Reply
Shahrukh Khan on

try credentials of Live server that you have to buy from any hosting company, or try hotmail or google mail account.

Reply
munirah mohammed on

SMTP Error: data not accepted.

Reply
pinky on

will you tell me how to check duplicate email address exit in database or not at the time of registration

Reply
Shahrukh Khan on

You have to fire an ajax request and return value accordingly.

Reply
Stan Smith Adidas on

Why viewers still use to read news papers when in this technological
globe everything is accessible on net?

Reply
Shahrukh Khan on

sometimes it worth getting off any mobile devices and dedicated time to watch around the world

Reply
venugopal on

finally i got output – An email has been sent for verfication.
but no mail has come to my gmail account.

Reply
Fajar on

I Keep getting SMTP ERROR: Failed to connect to server: (0) SMTP connect() failed.
I’m currently hosted not using local server.

Reply
Shahrukh Khan on

Check your smtp details.

Reply
Fajar on

nevermind.
i solved it after removing

$mail->isSMTP();

and it worked perfectly on dedicated server

Anubhav Aggarwal on

Removing

$mail->isSMTP();

from index.php also worked for me. Thanks

vivek on

hello!
my program is working properly but i could not get an email in my email id. which i entered at time of registration.

Reply
Shahrukh Khan on

see if your host support mailing

Reply
Célest on

Hello bro,I am getting this error:
Parse error: parse error, unexpected ‘}’ in C:\EasyWAMP\www\LoginSys\index.php on line 17

Reply
Shahrukh Khan on

one of your closing braces is missing. check your code.

Reply
JP on

smtp() connect failed. first error and when I removed $mail->isSMTP(); COULD NOT INSTANTIATE MAIL FUNCTION , Not able to resolve this, can you please help and also update php mailer files.
right now I am trying with gmail account.

Reply
Atif Sheikh on

Fatal error: Class ‘SMTP’ not found in D:\Website Project\email\mail\class.phpmailer.php on line 1466

when i click on submit, this error come up on screen. but information is added to the database
I dnt get any email. What should i do. please let me know. i want to talk to you on facebook as well.

Reply
Shahrukh Khan on

your path to phpmailer is not correct.

Reply
Atif Sheikh on

It worked, after i set the port and mywebsite’s email noreply@mywebsite.com
Thanks a bunch for such a great post

Reply
Shahrukh Khan on

yes it works on live server email.

Reply
wedding planner trivandrum on

Wow that was unusual. I just wrote an really long comment but after I clicked submit my comment didn’t appear.
Grrrr… well I’m not writing all that over again.
Anyways, just wanted to say wonderful blog!

Reply
Shahrukh Khan on

Ha Ha 🙂

Reply
travestis suruba on

Тhank you for every օther informative blog. Ԝɦere
eⅼse could Ⅰ get that type ⲟf info wгitten іn such a perfect method?
Ι ɦave а venture thɑt I’m simply now running ⲟn, and
I Һave Ьeen at the look out fߋr sucҺ infoгmation.

Reply
Shahrukh Khan on

Thanks.

Reply
CreativeMaker on

Thanks useful Post

Reply
Shahrukh Khan on

Thanks

Reply
tej on

Can you help me?google is blocking my email activation email because of they think that activation link is suspicious…plz help

this is a function

email($register_data[’email’],$register_data[‘first_name’],’Active your account’,”
Hello “. $register_data[‘first_name’] .”\n\nyou need to activate your account, so use the link below: http://localhost/lr/activate.php?email=“. $register_data[’email’] . “&email_code=” . $register_data[’email_code’]);

Reply
Shahrukh Khan on

i think you better use a live server rather than localhost. It can be the primary reason.

Reply
james on

can you teach me the procedure to use a live server rather than localhost ?

Shahrukh Khan on

Localhost = Your Computer
Live Server = Someone else Computer
Every hosting vendors has different control panels. but core settings are same. I would recommend you to see some free hosting provider to get started.

kishan on

@Shahrukh Khan
I have one requirement like, I can add any number of members to my team(or Org) similarly another team also can add a member of my team to their team(or Org) vise versa. While i am adding when i enter mail id of a particular member(if already a member of one Team/Org) and click on submit then mail should go like please use your credentials and login. If the member is not part of any team then mail should go like please use following email id and password to login.
How can i do this? I am using PHP codeigniter

Reply
Shahrukh Khan on

It’s your business logic. You need to check on the server side and based on the response, fire email content accordingly.

Reply
shubham saini on

Bro email is not received on email for verification after submit form

Reply
Shahrukh Khan on

check the comment thread, most of the solution is given for this problem.

Reply
https://tangymistake4692.tumblr.com on

There is certainly a lot to learn about this topic.
I really like all the points you have made.

Reply
Shahrukh Khan on

Thanks

Reply
hanish on

sir mail is not sending from form to gmail i m using wamp server

Reply
Shahrukh Khan on

check the comments thread, this issue has been addressed many times.

Reply
arshad on

hi shahrukh ,
i tried this code but its showing below error….
SMTP Error: Could not authenticate.

Reply
Shahrukh Khan on

check comment thread, this is been resolved by the community users

Reply
shiv on

I get the activation mail and when I open it nothing happens , even the status shows pending in my database , pls help

shiv on

I m trying on localshost

Shahrukh Khan on

not possible in localhost

Shahrukh Khan on

try to debug your code a little see what the problem with the query.

Nitya on

Fatal error: Call to a member function bindValue() on null in /home/careindiaco/public_html/nitya/index.php on line 19

Reply
Shahrukh Khan on

your variable is null thats why, see why you are not able to get value in the variable.

Reply
poker Online on

I am really grateful to the holder of this site who has shared this enormous piece of writing at at this time.

Reply
Md Tausif Jawaid on

i am not able to create validation form on my own rule please help me .
i am using database MySql and server communicate language PHP

Reply
Harshit on

Where is ‘activate.php’ file in your code

Reply
Sai on

Can we schedule configuration message for perticular time period only

Reply
Shahrukh Khan on

Cron jobs can do

Reply
Shan Michael on

good eve bro may i ask
how i can solve this problem i can sent email yet i can’t receive email any answers will be appreciated

Reply
Shahrukh Khan on

see if you have permission/acces to send email from your hosting provider.

Reply
Ajeet on

thanks man your codes solve my problem 🙂

Reply
devashis khandelwal on

Awesome post,
Sir, my status is not changing from “PENDING” TO “APPROVED ” after 11 entries i have already change the length of id to 100.Please help

Reply
Shahrukh Khan on

try to debug, see whats the issue and error.

Reply
Wayne on

“An email has been sent for verfication.” but there’s no email came. I tried this in hostinger free account. How would I know if they support emailing? Can I use email forwarding? How?

Reply
Shahrukh Khan on

see if your hosting provider provide email facility to you.

Reply
vinith on

bro say me to align folders and file name to store these code.. i dono to makeup it.. need a help from u

Reply
Shahrukh Khan on

I Don’t understand bro.

Reply
olamilekan on

SQLSTATE[42S22]: Column not found: 1054 Unknown column ’email’ in ‘where clause’ is what i got please help me

Reply
Shahrukh Khan on

see if theres a typo mistake

Reply
Shahrukh Khan on

Hi. But i dont freelance. Thanks and Merry Christmas.

Reply
Jose on

Hi Shahrukh, firstly u are awesome, thanks for your tutorials, they are really dandy and outstanding,

Thumbs up with a standing ovation across borlands online.

I have an issue, can you please fix the download link to this registration demo, I am failing to download

thanks

Reply
Shahrukh Khan on

Hi Jose, Thanks for your appreciation. But the download link is working just fine.

Reply
Septian on

SQLSTATE[HY000] [1045] Access denied for user ‘katospedi_db’@’localhost’ (using password: YES)

Where Is Wrong? Sorry For Bad Engglish

Reply
Shahrukh Khan on

your username or password must be incorrect.

Reply
rohtash rathore on

i am getting this error
invalid address, when i am clicking submit values are entering properly in database,only the issue is with mail function

Reply
Shahrukh Khan on

please read the comment thread, this issue has already been resolved.

Reply
varunsai on

Could not instantiate mail function.

Reply
Shahrukh Khan on

see if the library path is correct

Reply
balaji on

sir , SMTP failed error is araised ,, what can i do sir?? please help me sir ,even i uploaded to the live server the error is araised sir ,please help me ,my mail id is karurbalamathi@gmail.com

Reply
Ilman H Oriza on

hi i’m a beginer php, please convert your tutorial PDO to MYSQLI, i don’t understand with PDO, please remake tutorial send confirmation email with PHP MYSQLI

Reply
Shahrukh Khan on

HI, PDO and Mysqli is very much same, its just with mysqli you can connect with mysql only whereaas with PDO you can connect with various database like oracle, sqlserver etc. So learning PDO can help you a lot.

Reply
gayathri on

After submit i am getting the message An email has been sent for verification
but i din’t received any mail to my gmail
i am using this form in xampp localhost

Reply
Shahrukh Khan on

Please read the comment thread, this has already been answered.

Reply
Milind on

Shahrukh,

May I request you to send an email using PHP via SES step by step?

Regards
Milind

Reply
sourav paul on

An email has been sent for verfication…..(show)
but does not sent to the email…how it can solve it?

Reply
Mohan on

Hi Sharukh,
Sometimes the mail sent successfully. Most of the time, it throws the error.
SMTP connect failed. I changed the ports from 465 to 587 & vice versa. Still the issue persists. Can anybody add some points to solve the issue.

Reply
Shahrukh Khan on

Hi Mohan. do you have access to send mail from localhost.

Reply
Ajith on

Hi,

After activation. It’s showing your website. how it is possible?. Could u assist me remove that.

Thanks

Reply
Shahrukh Khan on

change the site url in config file to your site address

Reply
rohit on

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Reply
rohit on

You don’t have permission to access the requested directory. There is either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster.

Reply
Shahrukh Khan on

make sure you folder has write permission.

Reply
vinoth on

Warning: require_once(phpmailer/class.phpmailer.php): failed to open stream: No such file or directory in C:\xampp\htdocs\ALUMNI\mail.php on line 4

Fatal error: require_once(): Failed opening required ‘phpmailer/class.phpmailer.php’ (include_path=’C:\xampp\php\PEAR’) in C:\xampp\htdocs\ALUMNI\mail.php on line 4

Reply
Shahrukh Khan on

check your library path

Reply
Suriyan on

Shahrukh Khan can you help me with the php codings for email otp verification ,have you posted that code in your page before

Reply
Arjun Kumar Rao on

SMTP connect() failed. ?

Reply
Shahrukh Khan on

please check the comment thread. this is already solved.

Reply
John on

Hi,
Mail not working, which files need to be modified for the email configuration, please let me know.

Reply
Shahrukh Khan on

in configuration give the credentials

Reply
Venus on

Hey, I think your website might be having browser compatibility issues.
When I look at your website in Opera, it llooks fine bbut whe opening
in Internet Explorer, it has some overlapping.
I just wantted to give you a quick heads up! Other then that, amazing blog!

Reply
Shahrukh Khan on

thanks for the feedback. will look into that. in the meantime try exploring my website on the latest version of google chrome, firefox, opera or microsoft edge for best user experience.

Reply
sbobet on

You can definitely see your expertise in the work you write.
The arena hopes for more passionate writers such as you who aren’t afraid to mention how they believe.

All the time go after your heart.

Reply
yogi on

how I need to run your program pls help me.

Reply
Shahrukh Khan on

Where are you stuck?

Reply
saikrishna on

I am getting error as following
Email already exist
what should i do
this solution is not there in comment thread

Reply
Shahrukh Khan on

this is because the email is already in the database. you need to delete that row first.

Reply
meylad on

hi : Message could not be sent.Mailer Error: SMTP connect() failed.

Reply
Pranay on

How do I fix that problem

The following From address failed: lahoreakshay@gmail.com : MAIL FROM command failed,530,5.7.0 Must issue a STARTTLS command first. m67sm14316107pfm.73 – gsmtp

Reply
James on

SMTP connect() failed.

Reply
Shahrukh Khan on

Please read through the comments, its already been solved.

Reply
paras on

SMTP Error: Could not authenticate.

Reply
pooja sonawane on

sir, I want login code after activate account using email.

Reply
Shahrukh Khan on

please check my other tutorial, login via google.

Reply
Jana on

Hi i am getting this error what should i do?
Fatal error: Uncaught phpmailerException: invalid_address: in C:\xampp\htdocs\phpmailer\class.phpmailer.php:770 Stack trace: #0 C:\xampp\htdocs\phpmailer\class.phpmailer.php(706): PHPMailer->addAnAddress(‘to’, ”, ”) #1 C:\xampp\htdocs\index.php(78): PHPMailer->addAddress(NULL) #2 {main} thrown in C:\xampp\htdocs\phpmailer\class.phpmailer.php on line 770

Reply
Jana on

I wish you can help me as soon as possible since i am working on my senior project

Reply
Shahrukh Khan on

please email me your query

Abhijeet Kumar on

what I do, please help
SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘login_system.tbl_users’ doesn’t exist

Reply
Shahrukh Khan on

Have you updated the database?

Reply
aim on

Hi. It shows the email has been sent for verification, but when I open my account there is no email for verification.. Please help me.

Reply
Shahrukh Khan on

check spam folder

Reply
Rekha Chaudhary on

after mail Activate page not working.

Reply
Shahrukh Khan on

whats the issue.

Reply
ayush on

Thank you so much. It has been very useful Sir. Great Jon btw.

Reply
majed on

hi i got this problem … Please help me.
SMTP Error: Could not authenticate.

Reply
Luciano Sbarbati on

Hi, awesome script! I am having an issue, an error appears saying “invalid address” but its showing a password I use for testing that I didnt use on this, kind of strange

Reply
Shahrukh Khan on

Well, that’s strange. try to debug and check if you have any errors in your log.

Reply
jay on

HI, nice script. i have this issue. SMTP Error: Could not authenticate.

Reply
Lee on

To the people that are saying they are having the “SMTP connect() failed.” You need to change the settings in your Google account to “Allow access to less secure apps”, Google will inevitably block the connection completely if this setting isn’t on, it did to me any way

Reply
samiksha kumari on

Hi,
nice coding. I run it perfectly and it working that’s you so much. But I need one help I want help with the login form.
After this email verification then login should be done. I want this code. can you please help me. It would be very helpful to me.

Reply
M Usman on

SMTP connect() failed.

Reply
deeje on

Hi Shahrukh,

Thank you so much for posting such a nice script/code. Working perfect on localhost.

Can you please help me to guide how to insert this code in wordpress page. I had tried by creating custom template page, but getting one or another error.

Reply
Vikas Pandey on

Thanks so much useful script/code working perfect of cpanel

Reply
Hashmi Shaikh on

Bro!!can you tell me how to set up email, password,port name because I don’t know to do in xampp server.i get lots of error

Reply
abdelkader on

how to fix problem about activate.php page i can’t find it !!!

Reply
Shahrukh Khan on

What problem are you facing.

Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.