Jump to content

Email Server Connection error...


phpanon

Recommended Posts

Hi everyone,

 

<?php
require "connect.php";
require "EmailConnect.php";
$roomID = $_POST['roomID'];
$bkgDate = $_POST['bkgDate'];
$bkgTime = $_POST['bkgTime'];
$empID = $_POST['empID'];

if($roomID == "[select Room Number]") 
{
	$message2 = "Please select a Room Number";
	header("Location: MeetingMain.php?message2=$message2");
	exit();
}
if($bkgTime == "[select Time]") 
{
	$message3 = "Please select a Meeting Time";
	header("Location: MeetingMain.php?message3=$message3");
	exit();
}

else if($building == !null || $roomID == !null)
{
	$query = "SELECT COUNT(*) FROM booking WHERE bkgTime ='".$bkgTime."' AND bkgDate ='".$bkgDate."' AND roomID ='".$roomID."'";
	$result = mysql_query($query, $connection) or die ("Unable to perform query<br>$query");
	$row= mysql_fetch_row($result);
    	$count = $row[0];

	if($count)
	{
		$message5 = "Sorry Meeting Room is booked on that date at that time. Please re-select.";
		header("Location: MeetingMain.php?message5=$message5");
		exit();
	}
	else
	{

		$to      = '[email protected]';
		$subject = "Room ".$roomID." Successfully Booked";
		$message = "You have successfully booked a Meeting Room. \n \n Meeting Room : ".$roomID." \n Date: ".$bkgDate." \n Time Slot: ".$bkgTime.". \n \n This is a confirmation email. Do not reply. \n \n \n \n RIAS Plc \n Insurance for the over 50's.";
		$headers = 'From: [email protected]' . "\r\n" .
    					'X-Mailer: PHP/' . phpversion();

		mail($to, $subject, $message, $headers);

		$query2 = "insert into booking values ('','".$roomID."','".$empID."','".$bkgDate."','".$bkgTime."')";
		$result2 = mysql_query($query2, $connection) or die ("Unable to perform query<br>$query2");

		$message4 = "Meeting Room Booked ";
		header("Location: MeetingMain.php?message4=$message4");
		exit();
	}
}
?>

 

Can anybody help me so that rather than the page crashing if it cant connect to the mail server the page just carries on and runs the sql query without sending the email.

Link to comment
https://forums.phpfreaks.com/topic/97150-email-server-connection-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.