Eksempel :
<?php
if ($send)
{
// Mailen sendes til denne adresse.
$recipient = "din mailadr@mail.dk";
// Emne
$subject = "Mail fra hjemmesiden's navn";
$message .= "Navn: $navn\n";
$message .= "Att: $att\n";
$message .= "Postnr: $pnr\n";
$message .= "By: $by\n";
$message .= "Telefon: $tlf\n";
$message .= "Mail: $mail\n";
$message .= "Besked: $besked\n";
$headers = "X-Mailer:
http://www.dit domain.dk\r\nFrom: " . $mail . "\r\n";
mail($recipient, $subject, $message, $headers);
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<title> mailform</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" media="screen">
body{
font: bold 16px Verdana, Arial, Helvetica, sans-serif;
background-color: #B3AEB5;
background-image: url(../traeet-tonebred.jpg);
background-attachment:fixed;
background-repeat:no-repeat;
background-position: center;
}
H1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size:large;
font-weight:bold;
color: Maroon;
margin-top: 4px;
margin-bottom: 4px;
}
H2 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size:small;
font-style: normal;
font-weight: bold;
color: Maroon;
margin-top: 10px;
margin-bottom: 4px;
}
.border
{
border: solid 1px #83032A;
}
.scroll
{
overflow: auto;
}
.wrapper
{
width: 770px;
margin:0 auto;
}
.top
{
color: Black;
font-weight: bold;
font-size: 36px;
padding: 10px 20px 10px 20px;
}
.top1 {
background-color: silver;
border-bottom: 1px solid #000000;
border-top: 1px solid white;
height: 14px;
font-size: 10pt;
font-weight: bold
}
.footer
{
background-color: Silver;
font-size: 12px;
text-align: center;
}
</style>
</head><center>
<Body><div class="wrapper">
<div class="top" style="padding-bottom: 20px; margin-bottom: 10px;">
<img src="dit-logo.jpg" width="710" height="50" align="bottom" alt="her er dit logo"> </div>
<div align="center" class="top1" >Her kan du skrive din adresse</div>
<div class="right" style="font-weight: bold;">
</div>
<h2> På denne formular kan du skrive til mig</h2>
<br>
<form method="post" onsubmit="return checkform(this);">
<table>
<tr><td>
Navn:</td><td><input type="text" size="30" maxlength="30" name="navn"></td></tr>
<tr><td>
Att:</td><td><input type="text" size="30" maxlength="30" name="att"></td></tr>
<tr><td>
Postnr :</td><td><input type="text" size="30" maxlength="4" name="pnr"></td></tr>
<tr><td>
By:</td><td><input type="text" size="30" maxlength="30" name="by"></td></tr>
<tr><td>
Telefon:</td><td><input type="text" size="30" maxlength="8" name="tlf"></td></tr>
<tr><td>
E-mail:</td><td><input type="text" size="30" maxlength="40" name="mail"></td></tr>
</table><p>
<table>
<tr>
<td>Beskrivelse/Tekst</td></tr>
</table>
<textarea wordwrap="physical" rows="10" cols="60" name="besked"></textarea>
<br><p>
<font face="Verdana">
<input type="submit" value="Indsend formular" name="send">
<input type="reset" value="Nulstil felter" name="reset"></font></p>
</form>
<div class="footer">Copyright © 2007 dit domain.dk </div>
</body>
</html>