Jump to content


Photo

PHP Mail Form Not Working


  • Please log in to reply
1 reply to this topic

#1 Patme

Patme

    Young Padawan

  • Members
  • Pip
  • 32 posts
  • Gender:Male
  • Location:Dubbo

Posted 29 June 2010 - 12:00 AM

Hey Guys i cannot get my mail form to work on my clients server, it works on my server fine but not on the clients. The client does have PHP installed and enabled.

Here is the coding:

HTML CODING:

<form action="bookings.php" method="post">
		 <table>
		 <tr>
			 <td>Contact Name*</td>
			 <td><input type="text" name="name"/></td>
		 </tr>
		 <tr>
			 <td>Email*</td>
			 <td><input type="text" name="email"/></td>
		 </tr>
		 <tr>
			 <td>Phone Number*</td>
			 <td><input type="text" name="phone"/></td>
		 </tr>
		 <tr>
			 <td>Date Required</td>
			 <td><input type="text" name="daterequired"/></td>
		 </tr>
		 <tr>
			 <td>Times Required</td>
			 <td><input type="text" name="timerequired" /></td>
		 </tr>
		 <tr>
			 <td>Hours Required </td>
			 <td><select name="hoursrequired">
			 <option>1</option>
			 <option>2</option>
			 <option>3</option>
			 <option>4</option>
			 <option>5</option>
			 <option>Other</option>
			 </select></td>
		 </tr>
		 <tr>
			 <td>Vehicle Required* </td>
			 <td><select name="vehiclerequired">
			 <option>Stretch Dodge Nitro</option>
			 <option>Nitro Sedan</option>
			 </select></td>
		 </tr>
		 <tr>
			 <td>Passengers* </td>
			 <td><select name="passengers">
				<option>1</option>
			 <option>2</option>
			 <option>3</option>
			 <option>4</option>
			 <option>5</option>
			 <option>6</option>
			 <option>7</option>
			 <option>8</option>
			 <option>9</option>
			 <option>10</option>
			 <option>11</option>
			 <option>12</option>
			 <option>13+</option>
			 </select></td>
		 </tr>
		 <tr>
			 <td>Occasion* </td>
			 <td><select name="occasion">
			 <option>General Hire</option>
			 <option>Wedding</option>
			 <option>Formal</option>
			 <option>Corporate</option>
			 <option>Promotion</option>
			 <option>Concert/Event</option>
			 <option>Airport Transfer</option>
			 <option>Other</option>
			 </select></td>
		 </tr>
		 <tr>
			 <td>Depart Suburb*</td>
			 <td><input type="text" name="pickupsuburb"/></td>
		 </tr>
		 <tr>
			 <td>Arrive  Suburb*</td>
			 <td><input type="text" name="dropofsuburb"/></td>
		 </tr>
		 <tr>
			 <td valign="top">Comments</td>
			 <td><textarea rows="8" cols="30" wrap="physical" name="comments"></textarea></td>
		 </tr>
		 <tr>
			 <td valign="top">Terms and Conditions</td>
			 <td><textarea rows="30" cols="50">HIRE AGREEMENT
 
 1.	Definitions:
 In this agreement the following definitions apply unless the context requires otherwise:
 'Balance' shall mean the amount due under the terms of this agreement, less any BOOKING FEE paid.
 'Booking' shall mean a period for which the Hirer has committed to Hire and the full amount of the Hire has been paid.
 'BOOKING FEE' shall mean the amount due under the terms of this agreement to secure a Reservation.
 'Chauffeur' shall mean the driver of the hired Vehicle.
 'Company' shall mean MINORE ENTERPRISE PTY LIMITED ACN 141 754 994 ABN 69 141 754 994 
 'Employee' shall have the meaning of any employee of the company, including any driver or chauffeur employed by the Company or agency contracted by the Company.
 'Hire’ shall mean the date or period for which the vehicle has been booked and reserved for.
 'Hire Charge' shall mean the amount due at any time under the terms of this agreement.
 'Hirer' shall be deemed to be the person who has signed the hire agreement and accepted these terms and conditions and will be the person responsible for the payment of the hire.
 'Party' shall mean any person or persons accompanying the Hirer in the hired Vehicle. 
 ‘Reservation’ shall mean a Hire where a Booking Fee has been paid to hold the date on which the Vehicle is to be hired or credit card details have been provided as security, but the full amount has not been paid.
 'Vehicle' shall mean the vehicle supplied by the Company to the Hirer.
 2.	Terms and Conditions
 2.1	The Hirer must:
 2.1.1	Pay a non-refundable Booking Fee equivalent to 30% of the Hire Charge on all Bookings or Reservations.  Such Booking Fee is not transferable.  
 2.1.2	Provide credit card details upon making a Booking or Reservation irrevocably authorising the Company to charge all Hire Charges to that credit card.  
 2.1.3	Pay the balance of the Hire Charge within ten (10) working days prior to the Hire. 
 2.1.4	Provide sixty (60) days written notice prior to the Hire for any cancellations.  
 2.1.5	Provide fourteen (14) days written notice of any time or venue changes to the Hire.  However the Company has the absolute right to refuse any such changes due to any other Bookings the Company may have at that time. 
 2.1.6	If the Hirer makes any changes to its Booking such as the time or location of the Hire then the Company reserves its absolute right to:
 (a)	make any additional charges such as excess mileage; and
 (B)	charge an hourly rate for each hour or part thereof where the Hire is extended beyond the agreed Hire period.
 Such additional charges will be accounted to the Hirer’s credit card and the Hirer irrevocably authorises the Company to account for these additional charges to that credit card.  The Hirer should confirm with the Company or the Chauffeur of the current charges for additional hours and excess mileage and any failure to do so will not derogate from the Hirer’s responsibility to pay the additional charges.
 2.2	The Hirer acknowledges and agrees that:
 2.2.1	Where the Hirer is a Business or Company and a representative made the Booking or Reservation, then:
 (a)	that Business shall assume the responsibility of the Hirer; and 
 (B)	the representative is bound to advise the Hirer and Party of the terms and conditions of this Hire.
 2.2.2	There will be an additional charge of 3% of the Booking Fee for all credit card transactions.
 2.2.3	That the car entertainment such as television screens, video and DVD equipment is provided as a courtesy and its use and/or availability does not form part of the Hire.
 2.2.4	The Hirer is not entitled to make any claim for compensation or obtain a reduction or refund of Hire Charges in the event that any equipment fitted to the Vehicle malfunctions prior to or during the Hire.
 2.2.5	The Company is not liable:
 (a)	for any loss suffered by the Hirer as a result of mechanical breakdown of the Vehicle; or
 (B)	if the Vehicle is involved in a motor vehicle accident; or 
 ©	if it is determined at the absolute discretion of the Chauffeur that it is no longer safe to continue to drive.
 2.2.6	If any of the matters referred to in clause 2.2.5(B) and © occur the Company shall endeavour to make alternative arrangements for the benefit of the Hirer. 
 2.2.7	Where time is crucial, such as for Weddings, the Company recommends that sufficient time is allowed for the Hirer to arrive at any event.  
 2.2.8	It is the sole responsibility of the Hirer to ensure that there is no disruption to their Schedule.
 2.2.9	Any damage to the Vehicle and/or its contents such as glassware, CD’s, DVD’s, Video tapes and the like, caused by the Hirer or any members of their Party during the Hire shall be at the cost of the Hirer. 
 2.2.10	There will be additional cleaning or sanitation charges incurred by the Hirer if:
 (a)	the Vehicle has been left in an unreasonable condition; or
 (B)	where there has been spillage of food or drinks or illness within the Vehicle;
 Such additional cleaning or sanitation charges will be accounted to the Hirer’s credit card and the Hirer irrevocably authorises the Company to account for these charges to that credit card.
 2.2.11	Drug use is strictly prohibited.  
 2.2.12	The Chauffeur has the absolute right to terminate the Hire if the Hirer or their Party carry on any illegal activity.  
 2.2.13	Consumption of food within the Vehicle is not permitted unless specific agreement has been made to the contrary at the time of the Booking or Reservation and agreed in writing.
 2.2.14	That the Company shall comply with the principles of the Responsible Service of Alcohol.
 2.2.15	The Hirer or Party is not permitted to:
 (a)	stand through the sunroof; or
 (B)	sit on the exterior of the Vehicle; or
 ©	hang out of the windows; or
 (d)	shout abuse to other road users or pedestrians; or
 (e)	be rude or intolerant with the Chauffeur; or
 (f)	misuse the equipment, fixtures or consumables within the Vehicle.  
 2.2.16	If the Hirer or their Party behave in the manner provided in clause 2.2.15 (a) through to (f) then the Chauffeur has the absolute right to terminate the Hire. In addition, the Hirer shall be held liable and responsible for any loss suffered, howsoever caused, by the irresponsible behaviour of his or her Party.
 2.2.17	There is strictly no smoking within the Vehicle.   
 2.2.18	The Vehicle cannot be loaded beyond its legal seating capacity and the Chauffeur and Company reserves the right to terminate the Booking and/or Reservation should the Hirer insist to carry more passengers than that which the Vehicle is legally able to transport. 
 2.2.19	The Hirer and their Party must wear seat belts at all times.
 2.2.20	The Hirer indemnifies the Company and the Chauffeur against any fine(s) imposed as a consequence of the Hirer or Party failing to wear seat belts and irrevocably authorises the Company to charge the Hirer’s credit card for any such fines incurred. 
 2.2.21	Where the Hirer has asked for a child seat to be fitted, it is the responsibility of the Hirer to supply and ensure that the seat is correctly fitted.
 2.2.22	The Hirer indemnifies the Company and Chauffeur to the maximum extent permitted by law for any injury sustained by any child due to insufficient fitting or installation of a child seat.
 2.2.23	The Hirer holds the Company harmless of any liability for any personal or material damages arising from the conduct of his or her Party.
 2.2.24	The Company is not responsible for articles left in the Vehicle by the Hirer or Party and the Hirer specifically indemnifies the Company from any such responsibility and undertakes to advise all other persons in his or her Party. 
 2.2.25	As a safety precaution to minimise risk of accidents and damage to the Vehicle, only the Chauffeur may open and close doors except in cases of an emergency.
 2.2.26	The Company will not be held responsible for accidents and damages caused to Vehicles, persons and property as a consequence of the Hirer and/or the Hirer’s Party breaching clause 2.2.25.  
  
 3.	Limitation of Liability
 3.1	The Hirer accepts and indemnifies the Company and its employees against:-
 3.1.1	any loss, consequential or otherwise as a result of the Company’s failure to meet time deadlines; and
 3.1.2	any advice provided by the Company or its employees to the Hirer; and  
 3.1.3	any and all claims resulting directly or otherwise as a consequence of failing to arrive at the destination at the appropriate time or at all.
 
 4.	Other Conditions
 4.1	If any term or condition of this agreement is found to be invalid for any reason whatsoever this shall not deem this agreement to be invalid and all other terms shall remain in full force and effect.
 4.2	The Company may at its entire discretion refuse any Hire without any explanation or reason.
 </textarea><br /><a href="TERMS AND CONDITIONS.pdf" style="color: #000000;">Click here to download the Terms and Conditions</a><br /><br /><input type="checkbox" />I accept the terms and conditions</td>
		 </tr>
		 </table>
 <br /><br />
			 <input type="submit" value="Submit Booking" name="accept"/> <input type="reset" />
			 
		 </form>

PHP CODING:

<?php
 
 header('Location: booking-accepted.htm');
 
 
 $to = '[email protected]';
 $subject = 'Booking Enquiry';
 $name = $_POST['name'];
 $email = $_POST['email'];
 $phone = $_POST['phone'];
 $daterequired = $_POST['daterequired'];
 $timerequired = $_POST['timerequired'];
 $hoursrequired = $_POST['hoursrequired'];
 $vehiclerequired = $_POST['vehiclerequired'];
 $occasion = $_POST['occasion'];
 $pickupsuburb = $_POST['pickupsuburb'];
 $dropofsuburb = $_POST['dropofsuburb'];
 $comments = $_POST['comments'];
 $passengers = $_POST['passengers'];
 $accept = $_POST['accept'];
 
 
 
 
 $message = '
 <html>
 <body>
 <font color="#000000" face="Arial">
 Booking Enquiry (www.pristinelimousines.com.au):<br><br>
 <b>Contact Name:</b>&nbsp; '.$name.' <br>
 <b>Email Address:</b>&nbsp; '.$email.' <br>
 <b>Phone Number:</b>&nbsp; '.$phone.' <br>
 <b>Date Required:</b>&nbsp; '.$daterequired.' <br>
 <b>Times Required:</b>&nbsp; '.$timerequired.' <br>
 <b>Hours Required:</b>&nbsp; '.$hoursrequired.' <br>
 <b>Vehicle Required:</b>&nbsp; '.$vehiclerequired.' <br>
 <b>Passengers:</b>&nbsp; '.$passengers.' <br>
 <b>Occasion:</b>&nbsp;  '.$occasion.' <br>
 <b>Pickup Suburb:</b>&nbsp; '.$pickupsuburb.' <br>
 <b>Drop Of Suburb:</b>&nbsp; '.$dropofsuburb.' <br>
 <b>Comments:</b>&nbsp; '.$comments.' <br><br><br>
 
 
 <font style="font-size: 10px;">This email was sent from Pristine Limousines online booking form.<Br>This form was created by Thrive Media.</font>
 </font>
 </body>
 </html>
 ';
 
 $headers  = 'MIME-Version: 1.0' . "\r\n";
 $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 $headers .= 'From: ' . $email . "\r\n";
 
 
 
 //echo $message; // Enable to debug output
 mail($to, $subject, $message, $headers );
 
 
 ?>

Edited by Patme, 29 June 2010 - 07:51 PM.
Please use code tags


#2 Hayden

Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 717 posts
  • Gender:Male
  • Location:Texas

Posted 02 July 2010 - 10:50 PM

If it works on one server but not another, then it's most likely going to be an issue with the server.

Some web hosts, depending on who you use, disable PHP Anonymous mailer from working, so to be able to send mail you'll have to reconfigure the script to login to a valid mail account via SMTP.

This is just a rough sketch but...
<?php
include("Mail.php");
/* mail setup recipients, subject etc */
$recipients = "[email protected]";
$headers["From"] = "[email protected]";
$headers["To"] = "[email protected]";
$headers["Subject"] = "User feedback";
$mailmsg = "Hello, This is a test.";
/* SMTP server name, port, user/passwd */
$smtpinfo["host"] = "smtp.mycorp.com";
$smtpinfo["port"] = "25";
$smtpinfo["auth"] = true;
$smtpinfo["username"] = "smtpusername";
$smtpinfo["password"] = "smtpPassword";
/* Create the mail object using the Mail::factory method */
$mail_object =& Mail::factory("smtp", $smtpinfo);
/* Ok send mail */
$mail_object->send($recipients, $headers, $mailmsg);





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users