I am using contact us form in my website and i want to send email through this. i got a sendemail.php script and integrated with my website. But when i filled the form and sent it, it shows email is sending and its forever. How can i make it to send email. Also do we need to host it in the website? I have it in my system and have to test the mail function before host the website. Here is my php script.
<?php
$name       = @trim(stripslashes($_POST['name'])); 
$from       = @trim(stripslashes($_POST['email'])); 
$subject    = @trim(stripslashes($_POST['subject'])); 
$message    = @trim(stripslashes($_POST['message'])); 
$to         = '<myemail@domain.com>';//replace with your email
$echo       =("Thank you for contacting us!");
$headers   = array();
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/plain; charset=iso-8859-1";
$headers[] = "From: {$name} <{$from}>";
$headers[] = "Reply-To: <{$from}>";
$headers[] = "Subject: {$subject}";
$headers[] = "X-Mailer: PHP/".phpversion();
mail($to, $subject, $message, $headers);
die;
 
     
    