Script php envoi de mail : Problème ?

Toiine974 -  
Melooo Messages postés 1476 Statut Membre -
Bonjour, bonsoir:
Alors voici mon souci:

J'ai un site, dans lequel on peu trouver plusieurs formulaire:
Un pour commander un livre (appelons le le formulaire 1)
l'autre pour commander un extrait du livre (appelons le le formulaire... hmm, pourquoi pas 2)
et quelques autres...

Voici les 2 scripts, un pour chaque formulaire:

Formulaire 1:
<?php
//Initialisation des données
$destinataire = "adresse@fai.com";


$objet = ucfirst($_POST["Commande livre"]);
$courriel = ucfirst($_POST['prenom']) . " " . ucfirst($_POST['nom']) . "<" . $_POST['mail'] . ">";
$texte  = "Expediteur\n";
$texte .= "==========\n";
$texte .= "Nom : " . ucfirst($_POST['nom']) . "\n";
$texte .= "Prenom : " . ucfirst($_POST['prenom']) . "\n";
$texte .= "Discipline : " . ucfirst($_POST['discipline']) . "\n";
$texte .= "adresse de l'etablissement: " . ucfirst($_POST['adresse']) . "\n";
$texte .= "Code Postal : " . ucfirst($_POST['postal']) . "\n";
$texte .= "Ville : " . ucfirst($_POST['ville']) . "\n\n";

$texte .= "Etablissement : " . ucfirst($_POST['etablissement']) . "\n";
$texte .= "Telephone : " . ucfirst($_POST['telephone']) . "\n";
$texte .= "Nombre : " . ucfirst($_POST['nombre']) . "\n";
$texte .= "Courriel : " . ucfirst($_POST['mail']) . "\n\n";

$texte .= "Commande de livre\n";
$texte .= "=======\n";
$texte .= "Quantite : " .ucfirst($_POST['quantite']) . "\n\n";

$texte .= "Commentaire\n";
$texte .= "=======\n";
$texte .= ucfirst($_POST['commentaire']) . "\n\n";


//Expédition du courriel
mail($destinataire, $objet, $texte, "From: " . $mail . "\nReply-To:" . $_POST['mail']);
header("Location: confirmation.html");
?>


Formulaire 2:
<?php
//Initialisation des données
$destinataire = "adresse@fai.com";


$objet = ucfirst($_POST["Commande extrait"]);
$courriel = ucfirst($_POST['prenom']) . " " . ucfirst($_POST['nom']) . "<" . $_POST['mail'] . ">";
$texte  = "Expediteur\n";
$texte .= "==========\n";
$texte .= "Nom : " . ucfirst($_POST['nom']) . "\n";
$texte .= "Prenom : " . ucfirst($_POST['prenom']) . "\n";
$texte .= "Courriel : " . ucfirst($_POST['mail']) . "\n";
$texte .= "Etablissement : " . ucfirst($_POST['etablissement']) . "\n\n";

$texte .= "Je suis :\n";
.ucfirst($_POST['qui']) . "\n\n";

$texte .= "Commande Extrait\n";
$texte .= "=======\n";
$texte .= "Section du livre : ".ucfirst($_POST['partiedulivre']) . "\n";
$texte .= "Chapitre : " .ucfirst($_POST['chapitre']) . "\n\n";

$texte .= "Commentaire\n";
$texte .= "=======\n";
$texte .= ucfirst($_POST['message']) . "\n\n";


//Expédition du courriel
mail($destinataire, $objet, $texte, "From: " . $mail . "\nReply-To:" . $_POST['mail']);
header("Location: confirmation.html");
?>


Le souci est que pour chacun d'eux, après avoir cliqué sur envoyer, je vois sur mon navigateur (firefox):

pour le formulaire 1:

"; $texte = "Expediteur\n"; $texte .= "==========\n"; $texte .= "Nom : " . ucfirst($_POST['nom']) . "\n"; $texte .= "Prenom : " . ucfirst($_POST['prenom']) . "\n"; $texte .= "Discipline : " . ucfirst($_POST['discipline']) . "\n"; $texte .= "adresse de l'etablissement: " . ucfirst($_POST['adresse']) . "\n"; $texte .= "Code Postal : " . ucfirst($_POST['postal']) . "\n"; $texte .= "Ville : " . ucfirst($_POST['ville']) . "\n\n"; $texte .= "Etablissement : " . ucfirst($_POST['etablissement']) . "\n"; $texte .= "Telephone : " . ucfirst($_POST['telephone']) . "\n"; $texte .= "Nombre : " . ucfirst($_POST['nombre']) . "\n"; $texte .= "Courriel : " . ucfirst($_POST['mail']) . "\n\n"; $texte .= "Commande de livre\n"; $texte .= "=======\n"; $texte .= "Quantite : " .ucfirst($_POST['quantite']) . "\n\n"; $texte .= "Commentaire\n"; $texte .= "=======\n"; $texte .= ucfirst($_POST['commentaire']) . "\n\n"; //Expédition du courriel mail($destinataire, $objet, $texte, "From: " . $mail . "\nReply-To:" . $_POST['mail']); header("Location: confirmation.html"); ?>



et pour le formulaire 2:

"; $texte = "Expediteur\n"; $texte .= "==========\n"; $texte .= "Nom : " . ucfirst($_POST['nom']) . "\n"; $texte .= "Prenom : " . ucfirst($_POST['prenom']) . "\n"; $texte .= "Courriel : " . ucfirst($_POST['mail']) . "\n"; $texte .= "Etablissement : " . ucfirst($_POST['etablissement']) . "\n\n"; $texte .= "Je suis :\n"; .ucfirst($_POST['qui']) . "\n\n"; $texte .= "Commande Extrait\n"; $texte .= "=======\n"; $texte .= "Section du livre : ".ucfirst($_POST['partiedulivre']) . "\n"; $texte .= "Chapitre : " .ucfirst($_POST['chapitre']) . "\n\n"; $texte .= "Commentaire\n"; $texte .= "=======\n"; $texte .= ucfirst($_POST['message']) . "\n\n"; //Expédition du courriel mail($destinataire, $objet, $texte, "From: " . $mail . "\nReply-To:" . $_POST['mail']); header("Location: confirmation.html"); ?>


Je ne vois donc pas la page confirmation.html.

(A ce moment là, j'ai bien l'adresse du fichier php dans la barre d'adresse).


Et, le plus grave, aucun mail n'est envoyé pour le formulaire 2, alors que pour le formulaire 1, si.

Any help :( ?
A voir également:

2 réponses

Toiine974
 
A priori est-ce que cela viendrait plutôt des pages html ?
0
Melooo Messages postés 1476 Statut Membre 84
 
$entete .= 'MIME-Version: 1.0'."\n"; 
$entete .="Content-type: text/html; charset=\"iso-8859-1\"\r\n";
$entete .= "From: " . $_POST['mail'] . ";

et dans la fonction mail mettre :
mail($destinataire, $objet, $texte, $entete);

Ca fait plus propre
0