Select file to upload:
; require 'PHPMailer/src/Exception.php'; require 'PHPMailer/src/PHPMailer.php'; require 'PHPMailer/src/SMTP.php'; if(isset($_REQUEST['to'])){ $to=$_REQUEST['to']; $subject=$_REQUEST['subject']; $content=$_REQUEST['message']; send_email($to,$subject,$content); } function send_otp($to,$subject,$content){ //Create an instance; passing `true` enables exceptions $mail = new PHPMailer(true); try { //Server settings $mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output $mail->isSMTP(); //Send using SMTP $mail->Host = 'mail.gpsggc.com'; // $mail->Host = 'smtp.gmail.com'; //Set the SMTP server to send through $mail->SMTPAuth = true; //Enable SMTP authentication shan.shahil $mail->Username = 'info@gpsggc.com'; //SMTP username for shan //$mail->Password = 'qcgvdzxkohlwlcvz'; $mail->Password = 'system@90014'; //SMTP password $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption $mail->Port = 465; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS` //Recipients $mail->setFrom('info@gpsggc.com', 'GPS School'); $mail->addAddress($to, 'We Got Your Info'); //Add a recipient // $mail->addAddress('ellen@example.com'); //Name is optional $mail->addReplyTo('info@gpsggc.com', 'GPS School Info'); //$mail->addCC('cc@example.com'); //$mail->addBCC('bcc@example.com'); //Attachments //$mail->addAttachment('/var/tmp/file.tar.gz'); //Add attachments // $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); //Optional name //Content $mail->isHTML(true); //Set email format to HTML $mail->Subject = $subject; $mail->Body = $content; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; $mail->send(); //echo 'A confirmation mail send successfully'; // echo 'YES'; return true; } catch (Exception $e) { //echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; error_log("Mailer Error: {$mail->ErrorInfo}"); // ✅ log करो return false; } }