sneha Posted June 2, 2009 Share Posted June 2, 2009 Hi to all, I know I am going to ask a silly question. But there is no way out. I have developed a HTML website. Now It has a "contact us" form. Now the client want that the details which the user will enter in the form should go to his email address. I searched a lot and got the answer it is done by using php script. Then I made a php script. But I am unable to send the email. I am doing like this: PHP Script: <!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 content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Untitled 1</title> </head> <body> <?php $firstname = $_POST['firstname'] ; $lastname = $_POST['lastname'] ; $company = $_POST['company'] ; $phoneno = $_POST['phoneno'] ; $mobileno = $_POST['mobileno'] ; $email = $_POST['email'] ; $city = $_POST['city'] ; $country = $_POST['country'] ; $message = $_POST['message'] ; $email_to = "[email protected]"; $email_subject = "contact details of the User"; $format = <<<EOF <html> <body bgcolor="#F0EFE3"> <h3>Message from your website:</h3> <br /> First Name: $firstname<br /> Last Name: $email<br/> Company: $company<br/> Phone No:$phoneno<br/> Mobile No:$mobileno<br/> E-Mail:$email<br/> City:$city<br/> Country:$country<br/> Message:$message<br/> </body> </html> EOF; mail( $email_to, $email_subject,$format,$email ); ?> </body> </html> In the Html form I am using these lines: <form id="form1" name="form1" action="sendmail.php" method="post" enctype="text/plain" > Please assist me where I am lacking. Waiting for your response. cheers sneha Link to comment https://forums.phpfreaks.com/topic/160605-php-script-problem/ Share on other sites More sharing options...
Jibberish Posted June 2, 2009 Share Posted June 2, 2009 As far as I know you must set headers to send a html e-mail <?php $to = "[email protected]"; $subject = "bobbing"; $message = <<<EOF <html> <body bgcolor="#F0EFE3"> <h3>Message from your website:</h3> <br /> First Name: $firstname<br /> Last Name: $email<br/> Company: $company<br/> Phone No:$phoneno<br/> Mobile No:$mobileno<br/> E-Mail:$email<br/> City:$city<br/> Country:$country<br/> Message:$message<br/> </body> </html> EOF; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; mail($to, $subject, $message, $headers); ?> Link to comment https://forums.phpfreaks.com/topic/160605-php-script-problem/#findComment-847601 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.