isSMTP(); //Send using SMTP $mail->SMTPAuth = true; //Enable SMTP authentication $mail->Host = 'mail.harmanpipeband.com'; //Set the SMTP server to send through $mail->Username = 'info@harmanpipeband.com'; //SMTP username $mail->Password = 'harman@!@#$%'; //SMTP password $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; //Enable implicit TLS encryption $mail->Port = 587; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS` //Recipients $mail->setFrom('info@harmanpipeband.com', 'Harman Pipe Band'); $mail->addAddress('info@harmanpipeband.com', 'User'); //Add a recipient //Content $mail->isHTML(true); //Set email format to HTML $mail->Subject = 'User Enquiry'; $mail->Body = " User Name : $name
Email Id : $email
Service : $service
Subject : $subject
Message : $message
"; if($mail->send()){ $_SESSION['status'] = "Thank you for sending mail"; header("Location: index.php"); exit(0); }else{ $_SESSION['status'] = "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; header("Location: index.php"); exit(0); } } catch (Exception $e) { echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; } }else{ header("Location: index.php"); } ?>