I have a contact form on my Contact page and it's a php page. I am gathering user's request and trying to mail it to me@mydomain.com. However, I tried all different ways but not able to send mail using php. I am very new to php and I am trying to learn the language. Here is the code sample.
This is my HTML
<h2>Your Details</h2></br>
<div class="form_row">
<input type="text" class="form_input" name="name" id="txtName" placeholder="Your Name" />
</div>
<div class="form_row">
<input type="text" class="form_input" name="phone" id="txtPhone" placeholder="Phone Number" />
</div>
<div class="form_row">
<input type="text" class="form_input" name="email" id="txtEmail" placeholder="Email" />
</div>
<div class="form_row">
<textarea class="form_textarea" name="message" id="txtMessage" placeholder="Provide as much information you can regarding the project."></textarea>
<p><input type="submit" id="submit" class="button" value="Send"/></p>
</div>
This is my php script
<?php
if(isset($_POST['submit']))
{
$to = "harish.upadhyayula@ritchsystems.com";
$subject = 'Request for quote from - ritch systems website.';
$from = 'Surekha';
$phone = '410-555-4988';
$message = 'Testing php mail by hard coding.';
$headers = "From: ".$from."\r\n" .
"Phone: ".$phone;
ini_set("sendmail_from", $from);
if(mail( $to, $subject, $message, $headers ))
{
echo 'Mail Sent';
}
else {echo 'Something is wrong!';}
}
?>