<?php
$dtitle = "Halton and Dufferin Peel Region District School Lunch Program Catering Services" ;
$dtags = "Mississauga lunch programs, Brampton lunch programs, Georgetown lunch programs, Oakville lunch programs, Milton lunch programs, Halton District, Dufferin-Peel District, Ontario, Mississauga school catering, Brampton school catering, Oakville school catering, Milton school caterers, Georgetown School caterer, catering, delivery";
$ddesc = "Lunch programs and catering services for the Halton District and Dufferin-Peel Districts of Mississauga, Oakville, Brampton, Georgetown, and Milton. Complete school lunch catering service including menu and delivery services.";

$ErrorMessage="";
$action = $_POST['action'];

if (trim($action) == "SEND")
{
	$mname = trim($_POST['mname']);
	$telno = trim($_POST['telno']);
	$email = trim($_POST['email']);
	$mMsg = trim($_POST['mMsg']);

	$ErrorMessage = "";
	
	//if not IsValidEmail(email) then ErrorMessage = "&nbsp;&nbsp;Your email is not valid<br/>"
	
	if(trim($email)== "") $ErrorMessage = "&nbsp;&nbsp;Email is required.<br/>";
	if(trim($mname)== "") $ErrorMessage = $ErrorMessage."&nbsp;&nbsp;Name is required.<br/>";
	if(trim($mMsg)== "") $ErrorMessage = $ErrorMessage."&nbsp;&nbsp;Message is required.<br/>";

if(trim($ErrorMessage)=="")
{
	$sendTo = "sales@lunchpails.ca"; 
		$subject = "Sub : Contact Us From LunchPails.ca";

		$headers  = 'MIME-Version: 1.0' . "\r\n";
		$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
		$headers .= "From:".$mname."<".$email."> \r\n";


			$message = "Dear Jeff ,\r\n<br>You had received the email from Lunchpalis Contact us  Page with the following details :<br /><br />\r\n";
			$message = "  Name : ".$mname."<br /><br />\r\n";
			$message .= " Email : ".$email."<br /><br />\r\n";
			$message .= " Phone : ".$telno."<br /><br />\r\n";
			$message .= " Message : ".$mMsg."<br /><br />\r\n";

			$message .="Thanks";

		mail($sendTo, $subject, $message, $headers);
		$ErrorMessage = "Thank you for your interest in our business. Someone will be in contact with you to provide you with more information";
}	
	/*if trim(ErrorMessage) & "" = "" then
		if trim(email) & "" = "" then email = "sales@lunchpails.ca"
		msBody="Name: " & mname & Chr(13) & Chr(10)
		msBody=msBody &"Email: " & email & Chr(13) & Chr(10)
		msBody=msBody &"Message: " & mMsg & Chr(13) & Chr(10)
		Set iMsg = CreateObject("CDO.Message")
		Set iConf = CreateObject("CDO.Configuration")
		Set Flds = iConf.Fields
		With Flds
			.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
			.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.microforum.ca"
			.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "jeff.fournier@microforum.ca"
			.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "asdf9910"
			.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
			.Update
		End With
		' Apply the settings to the message.
		With iMsg
			Set .Configuration = iConf
			.To = "sales@lunchpails.ca"
			.From = email
			.Subject = "Contact Us From LunchPails.ca"
			.TextBody = msBody & Chr(13) & Chr(10) & Chr(13) & Chr(10)
			.Send
		End With
		' Clean up variables.
		Set iMsg = Nothing
		Set iConf = Nothing
		Set Flds = Nothing
		ErrorMessage = "Thank you for your interest in our business. Someone will be in contact with you to provide you with more information.<br><br><br>"
	end if
end if


Function IsValidEmail(strEmail)
	if InStr(strEmail, "@") > 0 and instr(strEmail, ".") > 0 Then 
		IsValidEmail = true
	else
		IsValidEmail = false
	end if
End Function 
*/
}
	function IsValidEmail($strEmail)
	{
		if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/",$strEmail))
			return(true);
		else
			return(false);

	}



include("include/header.php");
?>
<tr><td width="900" class="fs15 blue">
    <table border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
        <tr><td colspan="2">&nbsp;</td></tr>
        <tr><td width="284" align="right" valign="top" class="fs12">
                <table width="270" class="innerborderred" border="0" cellspacing="2" cellpadding="1">
                    <tr valign="top"><td colspan="2" align="left" class="fs12"><b class="fs15"><br/>&nbsp;&nbsp;Lunch Pails Incorporated</b> 
                        <br/>&nbsp;&nbsp;392 Gibraltar 
                        <br/>&nbsp;&nbsp;Mississauga, ON L5T 2P6
                        <br/>&nbsp;&nbsp;Canada
                        <br/>&nbsp;&nbsp;Sharon: 647-828-6240
                        <br/>&nbsp;&nbsp;Jo-Ann: 416-809-6323 </td></tr>
                    <tr class="fs15"><td colspan="2" align="left"><br/>&nbsp;&nbsp;<b>Or send us an email...</b><br/></td></tr>
					<?php
                    if ($ErrorMessage == "THANK YOU")
					{
					?>
                        <tr class="fs12"><td></td><td><br/><br/><?=$ErrorMessage?></td></tr>
					<?php
					}
                    else 
					{
					?>
                    <form action="contact.php" method="POST">
                    <tr><td colspan="2" class="errmsg"><?=$ErrorMessage?></td></tr>
                    <tr class="fs12"><td width="80" align="right">*NAME:&nbsp;</td>
                        <td width="190" align="left"><input type="text" name="mname" maxlength="100" value="<?=$mname?>" class="formInputa" /></td></tr>
                    <tr class="fs12"><td width="80" align="right">TEL. NO:&nbsp;</td>
                        <td width="190" align="left"><input type="text" name="telno" maxlength="100" value="<?=$telno?>" class="formInputa" /></td></tr>
                    <tr class="fs12"><td width="80" align="right">*EMAIL:&nbsp;</td>
                        <td width="190" align="left"><input type="text" name="email" maxlength="100" value="<?=$email?>" class="formInputa" /></td></tr>
                    <tr class="fs12"><td width="80" valign="top" align="right">*MESSAGE:&nbsp;</td>
                        <td width="190" align="left"><textarea name="mMsg" class="formtexta" style="overflow: auto" > <?=$mMsg?></textarea></td></tr>
                    <tr><td colspan="2" align="right"><input class="fs12" type="submit" name="action" value="SEND"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>
                    </form>
					<?php
                    }
					?>
                </table></td>
            <td width="504" align="center" valign="top"><img class="dropshadow" src="images/lunchPailsOffice.jpg" width="480" height="360" border="0" alt="" /></td></tr>
        <tr><td colspan="2">&nbsp;</td></tr>
	</table></td></tr>
<?php
include("include/footer.php");
?>