[PHP] mail form verstuurd blank mailtjes

Pagina: 1
Acties:
  • 34 views sinds 30-01-2008

  • DNA_Saint
  • Registratie: Maart 2004
  • Laatst online: 23-04 09:15

DNA_Saint

Go Go Gadget Ondertitel!

Topicstarter
Ik heb een mail form gemaakt. Maar nu kom ik op een foutje. Als je op de pagina komt met de mail form. Staat er al gelijk "Bedankt voor je mail", terwijl je nog niks hebt getypt. Ik krijg dan ook een blank mailtje in mijn box.
Maar als je gewoon alles invuld enzo komt ie gewoon netjes in mijn box terecht.

De fout hieronder is door de automatische reply. Die geeft dan nu ook een foutmelding:
Warning: mail(): SMTP server response: 503 Bad sequence of commands. You must specify the recipients of a message before you can send it in C:\Domains\empirepalace.nl\wwwroot\contactform.php on line 56
Dit is waarschijnlijk omdat hij al een mail probeert te sturen naar de verzender, terwijl er nog geen mail is ingevuld.

Dit is het script:
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php

$recipientname = "NAAM";

$recipientemail = "mail@mail.com";

$subject = "Online-Form Response for $recipientname";

$autoresponse = "yes";

$autosubject = "Bedankt voor uw mail";

$automessage = "Dit is een automatisch bericht om u te laten weten dat we uw mail succesvol hebben ontvangen. Indien nodig krijgt u van ons zo spoedig mogelijk antwoord.";

$thanks = "Bedankt voor uw mail.";

$failed = "Het verzenden is mislukt. Probeer het later nog eens.";

?>

<?php

$mail_to = "mail@mail.nl";

$mail_subject = $_POST['soortbericht'];

$mail_body  = "\n Naam: ".$_POST['naam']." - Email: " .$_POST['email']. " - Bericht: " .$_POST['bericht']. " - Waarvan: " .$_POST['waarvan']." \n";

$mail_header = "From:".$_POST['naam']. "\r\n" . "Reply-To:" .$_POST['email'];

(mail($mail_to, $mail_subject, $mail_body, $mail_header));

if ($autoresponse == "yes") {
$autosubject = stripslashes($autosubject);
$automessage = stripslashes($automessage);
mail($email,"$autosubject","$automessage","From: $recipientname <$recipientemail>");
echo "$thanks";
}
else
{
echo "$failed";
}
?> 


Wat heb ik mis gedaan?

Huub Huub Barbatruc!


  • NMe
  • Registratie: Februari 2004
  • Laatst online: 15-04 22:07

NMe

Quia Ego Sic Dico.

  1. Lijn je code eens uit, dit is niet echt leesbaar.
  2. Ik zie twee keer de mail-functie in je code staan.
  3. Beide keren heeft deze mail-functie andere parameters.
  4. Het is niet de bedoeling dat wij je code gaan debuggen, dat mag je zelf doen.
Op slot dus. :)

'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.


Dit topic is gesloten.