Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi sir
I want to send email by html page
my pages are

enquiry.html
<form enctype="multipart/form-data" action="send_mai.php" method="POST">
								
<input name="sendername" type="text" />

<input type="text" name="senderemail" />

<input name="city" type="text"/>

<input name="state" type="text" /> 

<input name="country" type="text" />
<input name="contact" type="text" />
<textarea name="query" rows="2" cols="18" style="height:91px;width:290px;" wrap="physical">
</textarea>
<input name="submit" type="submit" class="button1" value="Submit" />
</form>

send_mail.php
$name=$_POST['sendername'];
	$email=$_POST['senderemail'];
	$city=$_POST['city'];
	$state=$_POST['state'];
	$country=$_POST['country'];
	$contact=$_POST['contact'];
	$query=$_POST['query'];
	$to="singhdeepender891@gmail.com";
	$from=$_POST['senderemail'];
	$subject="Enquiry";
	$message .= "Name : "; 
    $message .= $name; 
	$message .= "\n E-mail : "; 
    $message .= $email; 
	$message .= "\n City : "; 
    $message .= $city; 
	$message .= "\n State : "; 
    $message .= $state; 
	$message .= "\n Country : "; 
    $message .= $country; 
	$message .= "\n Contact Number : "; 
    $message .= $contact; 
	$message .= "\n Enquiry Details : "; 
    $message .= $query; 
	$headers="MIME-Version: 1.0" . "\r\n";
	$headers.="Content-Type: text/html; charset=iso-8859-1" . "\r\n";
	$headers.="FROM:".$from. "\r\n";
	mail($to,$subject,$message,$headers);

	if(mail($to,$subject,$message,$headers))
	{
	$message_error="Sent Mail Successfully";
	}
	else
	{
	$message_error="Mail not sent";
	}


?>



what's error
and if u have any alternate to email enquiry form by html without outlook then plz tell me
plz help
thanx
Posted
Updated 19-Jan-11 2:02am
v2
Comments
Slacker007 19-Jan-11 7:37am    
Please reformat your question so that the code is in code blocks.
Also, what have you tried already in regards to solving the problem yourself (i.e. debugging?) No one here is ever, ever going to do ALL the work for you. Good luck.

Wait a minute! I have a big warning for you.

Don't even think of putting such code on a production server — it will be hacked in no time!



Well, some background now. Frankly, such thing happened to me years ago, my site was suspended, but I fixed situation in one day, added detection of malicious activity and observed such activity on a regular basis. Now, I could hack such code in no time. You host will be turned into a zombie distributing spam or something like that.

How this is done? If one honestly fill in the form manually in a regular Web browser, you can only write what you write in one text input line. Programmatically, I can post whatever I want. One simple trick is to put in one line, for example under the key "sendername" many lines. While in manual post this is one string with one line, programmatically it would be one string with several lines; just insert line delimiters. In that extra line you could add "BCC: " + 9000 of other addresses to spam. Even though you receive that e-mail in a regular mail, you will only see regular spam addressed just for you.

Whatever the attach is, you should never call the function mail without filtering out its every parameter to remove anything weird. Remember, you never know what exactly it the method of the assault, so you should not assume anything about values you receive in you POST.

Sorry it has nothing to do with your question or if you know all this already -- this warning is too important.

[EDIT]

I had to wait for my next e-mail message from the PHP send list, to add this reference: http://www.phpclasses.org[^].

If you need to find out good ready-to-use solution, this is a good place.
 
Share this answer
 
v5
I cannot see immediate problem (code is bad but looks like it should work). How do you know it's not working? It could be something else like wrong address of server setup.

No matter, I wanted to give you an advice on debugging. If you have Visual Studio, you can use Phalanger PHP for .NET which works with VS's interactive debugger: http://en.wikipedia.org/wiki/Phalanger_(compiler)[^].

Yes, I know it's functionality is different from what you do, but you can successfully debug the body of your methods. It worked to me. If you already using some debugger, please ignore this answer.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900