Sending mail in PHP using Gmail SMTP [closed]

  email, php, smtp

i want to send email to different person using gmail smtp for example i have a signup page where people has to verify their email id using verification code sent to their respective email id, since few days i was using php mail but i want to shift to gmail smtp please guide me

if($data_check){
            $subject = "Email Verification Code (Code With Bishal)";
            $message = "Your verification code is $code";
            $sender = "From: [email protected]";
            if(mail($email, $subject, $message, $sender)){
                $info = "We've sent a verification code to your email - $email";
                $_SESSION['info'] = $info;
                $_SESSION['email'] = $email;
                $_SESSION['password'] = $password;
                header('location: otp');
                exit();

Source: Ask PHP

LEAVE A COMMENT