isSMTP(); //Send using SMTP
// $mail->Host = 'mail.rajdholdelhino1.in.net'; //Set the SMTP server to send through
// $mail->SMTPAuth = true; //Enable SMTP authentication
// $mail->Username = 'info@rajdholdelhino1.in.net'; //SMTP username
// $mail->Password = 'ssp@123!@#'; //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@rajdholdelhino1.in.net', 'Mailer');
// $mail->addAddress('info@rajdholdelhino1.in.net', 'User'); //Add a recipient
// //Content
// $mail->isHTML(true); //Set email format to HTML
// $mail->Subject = 'User Enquiry';
// $mail->Body = "
// User Name : $name
// Phone Number : $phone
// Message : $message
// ";
// $mail->send();
// echo "
// ";
// } catch (Exception $e) {
// echo "
// ";
// }
// }
?>
isSMTP();
$mail->Host = 'smtp.gmail.com'; // Change this based on your email provider
$mail->SMTPAuth = true;
$mail->Username = 'sspappkeys@gmail.com'; // Your SMTP email
$mail->Password = 'momcjmfzwcfastuu'; // Your SMTP password (use App Passwords for security)
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;
// Recipients
$mail->setFrom('sspappkeys@gmail.com');
$mail->addAddress($recipient);
// Content
$mail->isHTML(true);
$mail->Subject = 'User Enquiry';
$mail->Body = "User Name : $name
Phone Number : $phone
Email : $email
City : $city
Message : $message
";
$mail->send();
http_response_code(200);
echo
'';
} catch (Exception $e) {
http_response_code(500);
echo "Error: Could not send email. Mailer Error: {$mail->ErrorInfo}";
}
} } else {
http_response_code(403);
echo "There was a problem with your submission. Please try again.";
}
?>