"; $email_body .= "Subject: " . $subject . "
"; $email_body .= "Phone: " . $phone . "
"; $email_body .= "You can contact " . $name . " via email, " . $from_email ; $email_body .= $message . "

"; try { //Server settings $mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output $mail->isSMTP(); //Send using SMTP $mail->Host = 'smtp.hostinger.com'; //Set the SMTP server to send through $mail->SMTPAuth = true; //Enable SMTP authentication $mail->Username = 'help@thewebmax.org'; //SMTP username $mail->Password = 'nodu_252525'; $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` $mail->SMTPDebug = 0; //Recipients $mail->setFrom('help@thewebmax.org', 'thewebmax'); $mail->addAddress('thewebmaxhelp@gmail.com', 'The Webmax Support'); //Add a recipient $mail->addReplyTo('thewebmaxhelp@gmail.com', 'Information'); //Content $mail->isHTML(true); //Set email format to HTML $mail->Subject = $subject; $mail->Body = $email_body; //$mail->AltBody = 'This is the body in plain text for non-HTML mail clients for the webmax'; $mail->send(); echo json_encode(array( 'success' => true, 'message' => "Message Sent Successfully!" )); } catch (Exception $e) { echo json_encode(array( 'success' => false, 'message' => "Message could not be sent. Mailer Error: {$mail->ErrorInfo}" ) ); } die; }