<?php
if(isset($_POST['submit'])){
$navn = $_POST['navn'] ;
$melding = $_POST['melding'] ;
$emne = "Mail fra hjemmesiden din";
$adresse= "tomscott3@hotmail.com";
$headers = 'From: ' . $_POST['navn'] . "\r\n" .
'Reply-To: tomscott3@hotmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$sendt = mail($adresse,$emne,$melding, $headers);
if ($sendt):
echo 'Takk for beskjeden din :)';
else:
echo 'Det oppstod en feil. :<';
endif;
else {
?>
<p> </p><form method="post" action="<?php echo $PHP_SELF ?>">
Navn: <input type="text" size="10" maxlength="40" name="navn"> <br />
melding: <input type="textarea" size="200" maxlength="200" name="melding">
<input type="submit" name="submit" value="Send mail." />
</form>
<?php } ?>