Autoreply Code

Having Problems with my AutoReply Code. Help Plzz?

Page 1 of 1

1 Replies - 660 Views - Last Post: 24 October 2009 - 02:54 AM Rate Topic: -----

#1 falco1608  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 23-October 09

Autoreply Code

Posted 23 October 2009 - 02:43 PM

Hey guys. Im trying to place an auto-reply code to my code in which clients send in their forms with Inquires, but am having trouble. My code works perfectly for me to receive the forms submitted by clients but i want to eliminate the hassle of responding back to them saying "Thank you for submitting your inquiry" one by one. I tried adding a $message2 to my code but its not working. Here is my code:

<?php 
session_start();

//################ File upload ######################

$_FILES['file_free_quote']['name'];
$_FILES['file_free_quote']['type'];
$extension = explode("/",$_FILES['file_free_quote']['type']);
$_FILES['file_free_quote']['tmp_name'];
$_FILES['file_free_quote']['size'];

$file_name = explode(" ",$_SESSION['name']);
$target_path = "free_quote/".$file_name[0].".".$extension[1];
$upload = move_uploaded_file($_FILES['file_free_quote']['tmp_name'], $target_path);

$filepath = "http://www.fakeexampleaddress.com/example/".$target_path; 

if($_SESSION['freequote_requiest']=="Request_Free")
	{
		$subject_enquiry = "Request a Free Quote";
		$url_path = "<tr> <td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>File Url</td>
					<td></td>
					<td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>".$filepath."</td>  </tr>";
	}
	else
	{
		$subject_enquiry = "Inquiry";	
	}

$BestTimeToCall = $_POST['BestTimeToCall'];
$Industry = $_POST['Industry'];
$Project = $_POST['Project'];
$ProjectTime = $_POST['ProjectTime'];

$subject = "Example";
	//$to = "email@example.com";
	$to = "email@example.com,email@example.com,email@example.com,email@example.com";
	//$to = "email@example.com";
	$headers = "MIME-Version: 1.0\n";
	$headers .= "Content-type: text/html;charset=iso-8859-1\n";
	$headers .= "From: ".$name."<".$email.">\n";
	$headers .= "Reply-To: ".$name."<".$email.">\n";
	/*$mesg = "Name:".$_POST['name'];
	$mesg .= "\n Company Name:".$_POST['company'];
	$mesg .= "\n Phone:".$_POST['phone'];
	$mesg .= "\n Email:".$_POST['email'];
	$mesg .= "\n Comment:".$_POST['comment'];*/
	$mesg = "<table width='100%' border='0' cellspacing='0' cellpadding='0'>
  <tr>
	<td><span style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>".$subject_enquiry."</span></td>
  </tr>
  <tr>
	<td></td>
  </tr>
  <tr>
	<td><table width='100%' border='0' cellspacing='0' cellpadding='0'>
   <tr>
	<td width='24%' style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'></td>
	<td width='2%'></td>
	<td width='74%' style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'></td>
  </tr>

	<tr>
	<td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>Name</td>
	<td></td>
	<td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>".$_SESSION['name']."</td>
  </tr>
	<tr>
	<td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>Business Name</td>
	<td></td>
	<td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>".$_SESSION['businessname']."</td>
  </tr>
  <tr>
	<td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>Email</td>
	<td></td>
	<td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>".$_SESSION['email']."</td>
  </tr>
  <tr>
	<td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>Primary Phone</td>
	<td></td>
	<td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>".$_SESSION['phone']."</td>
  </tr>
  <tr>
	<td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>Best Time To Call</td>
	<td></td>
	<td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>".$BestTimeToCall."</td>
  </tr>
  <tr>
	<td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>Industry</td>
	<td></td>
	<td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>".$Industry."</td>
  </tr>
  <tr>
	<td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>Project</td>
	<td></td>
	<td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>".$Project."</td>
  </tr>
". $url_path ."	
  <tr>
	<td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>Project Start Time</td>
	<td></td>
	<td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>".$ProjectTime."</td>
  </tr>
 <tr>
	<td width='25%' style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'></td>
	<td width='2%'></td>
	<td width='73%' style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'></td>
  </tr>
 <tr>
   <td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>Thanks,</td>
   <td></td>
   <td style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'></td>
 </tr>
 
</table></td>
  </tr>
</table>
";

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

$message2 = "Thank You for submitting your inquiry." 
$headers = "MIME-Version: 1.0" . "\r\n"; 
$headers = $headers . "Content-type: text/html; charset=iso-8859-1" . "\r\n"; 
$headers = $headers . "From: email@example.com";


mail(". .$_POST['email'] ."$to,$subject,$message2,$headers);
	header("location: email.example.htm");	
?>


Any Help would be great. Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: Autoreply Code

#2 noorahmad  Icon User is offline

  • Untitled
  • member icon

Reputation: 209
  • View blog
  • Posts: 2,290
  • Joined: 12-March 09

Re: Autoreply Code

Posted 24 October 2009 - 02:54 AM

Here is a quick example:
when client sent message to you, after that send a message to clients email using $_POST['mail'] (client email)
// mail from client
$to = "mail@example.any";		// my email
$from = $_POST['mail'];			// client email
$message = $_POST['message'];	// message form client
$subject = $_POST['subject'];

// if mail recieved successully
if(mail($to,$subject,$message)){
	$to = $from; // client email
	$from = "example@example.com";
	$message = "thanks msg";
	$subject = "Thanks for you message";
	
	// reply to your client
	mail($to,$from,$message);
}


Hope it helps :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1