Nieuw lid |
|
beste, mensen
ik ben bezig met een email form en ik loop vast
weet niet wat ik eraan kan doen
dit is mijn error:
Warning: mail() [function.mail]: SMTP server response: 550 Authentication required
dit is mijn code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>mail sturen</title>
</head>
<body>
<?php
if($_POST["submit"]) {
$name = $_POST["name"];
$message = $_POST["message"];
if($name&&$message) {
$to = "[je email]";
$subject = "hallo";
$lengthname = 20;
$lengthmessage = 300;
if(strlen($name)<=$lengthname&&strlen($message)<=$lengthmessage) {
ini_set("SMTP", "mailhost.shef.ac.uk");
$headers = "From: maartenbuis@quicknet.nl";
$body = "hallo bericht van ".$name."\n\n".$message."";
mail($to, $subject, $body, $headers);
die();
} else {
die("Max length for name is ".$lengthname.", and max length for message is ".$lengthmessage."
");
}
} else {
die("You must enter a name and message
");
}
}
?>
<form method="post">
Name: <input type="text" name="name" maxlength="20"><br>
Bericht:<br><textarea cols="20" name="message"></textarea><br><br>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>mail sturen</title> </head> <body> <?php if($_POST["submit"]) { $name = $_POST["name"]; $message = $_POST["message"]; if($name&&$message) { $to = "[je email]"; $subject = "hallo"; $lengthname = 20; $lengthmessage = 300; if(strlen($name)<=$lengthname&&strlen ($message)<=$lengthmessage) { ini_set("SMTP", "mailhost.shef.ac.uk"); $headers = "From: maartenbuis@quicknet.nl"; $body = "hallo bericht van ".$name."\n\n".$message.""; mail($to, $subject, $body, $headers); } else { die("Max length for name is ".$lengthname.", and max length for message is ".$lengthmessage." "); } } else { die("You must enter a name and message "); } } ?> <form method="post"> Name: <input type="text" name="name" maxlength="20"><br> Bericht:<br><textarea cols="20" name="message"></textarea><br><br> <input type="submit" name="submit" value="submit"> </form> </body> </html>
|