0

I'm trying to recieve a contact form to my mail address. I've found this but when execute it, It went wrong and returned with Error:500. Are there any ideas to solve it or any other way to make the main idea happen? Thank you everyone who will try to help

//  Contact Form
 if (isset($_POST['gp_form'])) {

    "mail.esmun.org" = $smtphost;
    "587" = $smtpport;
    "system@esmun.org" = $smtpuser;
    "" = $smtppass;
    "d231@outlook.com" = $reciever;

    $name = htmlspecialchars(trim($_POST['form_name']));
    $phone = htmlspecialchars(trim($_POST['form_gsm']));
    $email = htmlspecialchars(trim($_POST['form_mail']));
    $school = htmlspecialchars(trim($_POST['form_school']));
    $msg = htmlspecialchars(trim($_POST['form_message']));

    include 'phpmailer/PHPMailer.php';
    $reciveform = $reciever;
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->SMTPAuth = true;
    $mail->Host = $smtphost;
    $mail->Port = $smtpport;
    $mail->SMTPSecure = 'tls';
    $mail->Username = $smtpuser;
    $mail->Password = $smtppass;
    $mail->SetFrom($mail->Username, $name);
    $mail->AddAddress($reciveform, $name);
    $mail->CharSet = 'UTF-8';
    $mail->Subject = 'Contact Form on ESMUN';
    $content = $name.'has sent you a message using ESMUN contact form. <br> her/his <b>phone number:</b>'.$phone.'<br><b>Mail Address:</b>'.$email.'<br><b>School:</b>'.$school.'<br><b>Message:</b>'.$msg;
    $mail->MsgHtml($content);
    if ($mail->Send()) { header("esmun.org");}
    else { header("go-akademi.com"); }

     exit;

 }

0 Answers0