using mail() to send data from a comment form

Hi, im having some difficulty getting this code to email a message to a local address, any help appreciated!

<?php $first_name=$_POST['fname']; $last_name=$_POST['lname']; $gemail=$_POST['guest_email']; $comment=$_POST['comment']; // local mail address inserted here $to ="[email protected]"; $from = $first_name." ".$last_name; $subject="Feedback"; $headers = "From: " . $from . "rn"; $message = "This is the message to the administratorn"; $message .= $first_name." ".$last_name."n"; $message .= "Would like to pass on the following feedback:n"; $message .= $comment."n"; $message .= "Their email address is ".$gemail."n"; //$message .= "--$boundary--"; $mailsent = mail($to, $subject, $message, $headers); if ($mailsent) { echo ""; echo(""); echo(""); echo ""; echo "
".$fname." ".$lname." wrote:
The Administrator has received your request and is currently processing it.
"; } else { echo "There was an error..."; } ?>

are your mail server working?? :wink:

r u getting any errors?

try to put error_reporting(E_ALL) in there as first line of ur php-code.

what server r u using?

Tried turning errors on but all i get is the “there was an error…” i set up if !$mailsent. Using a Linux server, the mail server is configured to work only for local addresses.

do u have access to the logs of ur mailtransport agent?

No unfortunately. So the problem is most likely with the mail server? thanks for your help!

Sponsor our Newsletter | Privacy Policy | Terms of Service