poonam219 Posted August 1, 2011 Share Posted August 1, 2011 Hi everyone, I am such a newbie to php... dont know how to write codes using php as m a .net person but in a very urgent need to make an email form using php Please help me. I just want to send email on submit button click event the email form will include name, phone number, email adress, and a word document... and these fields should be mandatory and phone number , email text boxes should be validated as well. Please help me asap......... Thanx in advance.. Quote Link to comment https://forums.phpfreaks.com/topic/243457-sending-email-using-php/ Share on other sites More sharing options...
the182guy Posted August 1, 2011 Share Posted August 1, 2011 PHP send email Quote Link to comment https://forums.phpfreaks.com/topic/243457-sending-email-using-php/#findComment-1250114 Share on other sites More sharing options...
poonam219 Posted August 1, 2011 Author Share Posted August 1, 2011 hey i triend searching on google... but nothing happening correctly Quote Link to comment https://forums.phpfreaks.com/topic/243457-sending-email-using-php/#findComment-1250115 Share on other sites More sharing options...
the182guy Posted August 1, 2011 Share Posted August 1, 2011 Your post sounds more like you're briefing for a freelance project, or homework assignment. The first thing you need is a HTML form with the input fields (name, email, phone number etc), have you looked into that? Quote Link to comment https://forums.phpfreaks.com/topic/243457-sending-email-using-php/#findComment-1250117 Share on other sites More sharing options...
kamran890 Posted August 1, 2011 Share Posted August 1, 2011 1---create an html form with ur required fields and then post them using thte submit button on the same page with action="" or to some other page where you want to have thtat sending option... 2-- now get the values from the for using the method u have used in form that is get or post.. 3-- now the search for the mail function of php you will find it easily.. its having portions like subject,message,header where you can adjust ur values. 4-- but remeber one thing its not going to deliver ur message from local site unless you have files on the server. 5-- see this <?php // Your email address $email = "[email protected]"; // The subject $subject = "Enter your subject here"; // The message $message = "Enter your message here"; mail($email, $subject, $message, "From: $email"); echo "The email has been sent."; ?> Quote Link to comment https://forums.phpfreaks.com/topic/243457-sending-email-using-php/#findComment-1250121 Share on other sites More sharing options...
poonam219 Posted August 1, 2011 Author Share Posted August 1, 2011 hi, i tried this code.... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Contact Us</title> </head> <body> <?php $formname= $_POST["name"]; $formaddress= $_POST["address"]; $formemail= $_POST["email"]; $touser= $_POST["email"]; $tosubject="Enquiry - Thank You"; $tobody="Dear $_POST[name],<br> <br> <br> Thank you for contacting us. We have received your enquiry and will get back to you very soon.<br> <br> <br> Best Regards<br> <br> Support Team<br> <br> http://hrpn.co "; $formcontactno= $_POST["contactno"]; $formdiscription= $_POST["discription"]; $to="[email protected]"; $subject="Enquiry "; $body="<table width='45%' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='41%'>Name</td> <td width='59%'>$formname</td> </tr> <tr> <td>Address</td> <td>$formaddress</td> </tr> <tr> <td>E-mail id</td> <td>$formemail</td> </tr> <tr> <td>Contact</td> <td>$formcontactno</td> </tr> <tr> <td>Description</td> <td>$formdiscription</td> </tr> </table>"; $headers = "From :".$_POST["email"] ."\r\n"; $headers.="Mime-version: 1.0"."\r\n" . "Content-type: text/html; charset=iso-8859-1"; $toheaders = "From: HRPN <[email protected]> \r\n"; $toheaders.="Mime-version: 1.0"."\r\n" . "Content-type: text/html; charset=iso-8859-1"; mail($to,$subject,$body,$headers); mail($touser,$tosubject,$tobody,$toheaders); ?> <script type="text/javascript"> window.location="contact.html"; </script> </body> </html> but i am not getting any mail... plz help.... Quote Link to comment https://forums.phpfreaks.com/topic/243457-sending-email-using-php/#findComment-1250157 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.