Morpheusweb.it - Risorse per webmaster: script, ASP.NET, C#, Visual Basic .Net, tutorial, asp, javascript, css, php, html, java, ADO, VBScript, forms, frames, Active Server Pages, Dynamic HTML, database, gratis per webmaster e webdesigner

MonstarMail

Simple form to send mail. With the control on the mandatory fields.



conf.php3

<?
// Where to send to?
$email = "your@domain.com";
// The subject of the e-mail you get:
$onderwerp = "You've got mail";
// Title of the website
$title = "You can send me a e-mail here";
// Header text
$maintxt = "Send me a e-mail";
// Thank you message
$thankz = "Thank you for sending me a e-mail!";
// Question for her/his name
$name = "What's your name";
// Question for her/his e-mail adress
$emailadress = "What's your e-mail adress";
// Question for her/his message
$saywhat = "What have you got to say";
// Errors:
$noname = "You haven't filled in your name";
$nomail = "You haven't filled in your e-mail adress";
$wrongmail = "You've filled in a wrong e-mail adress";
$nomessage = "You haven't filled in a message";
?>

mail.php3

<?
require("conf.php3");
?>
<html>
<head>
<title><? echo $title ?></title>
<link rel="stylesheet" type="text/css" href="stylez.css">
</head>
<body>
<table width="580" border=0 cellspacing=0 cellpadding=1>
<tr><td class="MainTD">
<table width="100%" border=0 cellspacing=0 cellpadding=3>
<tr>
<td class="HeaderText"><? echo $maintxt ?></td>
<tr>
<td class="NormalText">
<?php
if ($send == "ok") {
    if ($naam == "") {
        $ok = "false";
        $era = "<font class=\"Error\"> $noname</font>\n";
    }
    if ($from == "") {
        $ok = "false";
        $erb = "<font class=\"Error\"> $nomail</font>\n";
    }
    if ($from != "") {
        if (!eregi( "^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $from)) {
            $erb = "<font class=\"Error\"> $wrongmail</font>\n";
            $ok = "false";
        }
    }
    if ($bericht == ""){
        $ok= "false";
        $erc = "<font class=\"Error\"> $nomessage</font>\n";
    }
    if ($ok != "false"){
        mail("$email", "$onderwerp","$bericht\n\n---------\nCame from host: $REMOTE_HOST\nIP Adress: $REMOTE_ADDR", "From: $naam         <$from>\nReply-To: $naam <$from>\nX-Mailer: Script made by Ate Bontjer www.monstar.nl\nSender: $naam <$from>");
        echo "$thankz\n";
    }
    elseif ($ok == "false") {
        ?>
        <form method="POST" action="<? echo $PHP_SELF ?>">
        <? echo $name.": ".$era ?><br>
        <input type="text" name="naam" size="27" value="<? echo $naam ?>"><br>
        <? echo $emailadress.": ".$erb ?><br>
        <input type="text" name="from" size="27" value="<? echo $from ?>"><br>
        <? echo $saywhat.": ".$erc ?><br>
        <textarea rows="10" name="bericht" cols="40"><? echo $bericht ?></textarea><br>
        <input type="hidden" name="send" value="ok">
        <input type="submit" value="Send">
        <input type="reset" value="Empty fields">
        </form>
        <?
    }
}
else {
    ?>
    <form method="POST" action="<? echo $PHP_SELF ?>">
    <? echo $name ?>:<br>
    <input type="text" name="naam" size="27"><br>
    <? echo $emailadress ?>:<br>
    <input type="text" name="from" size="27"><br>
    <? echo $saywhat ?>:<br>
    <textarea rows="10" name="bericht" cols="40"></textarea><br>
    <input type="hidden" name="send" value="ok">
    <input type="submit" value="Send">
    <input type="reset" value="Empty fields">
    </form>
    <?
}
?>
</td></tr></table></td></tr></table><font>&copy; <a href="http://www.monstar.nl" target="_blank">Monstar.nl</a></font>
</body>
</html>


Download code...


Print this page


 

Inizio pagina

risorse per webmaster