FONCTION MAIL( ) en PHP ne marche pas...
Profil bloqué
-
Profil bloqué -
Profil bloqué -
Bonjour, voilà ça fait quelques jours que j'essaye de faire fonctionner ma fonction mail() mais en vain... je ne reçois aucun mail...
SVP AIDEZ MOI A CORRIGER LES ERREURS DE MON CODE !!!!!!
Merci d'avance
Sandy
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Contact</title>
<!-- inclusion de la feuille CSS -->
<link href="../CSS/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!-- Bannière du site -->
<center><img class="bordure1" src="images/bordure1.jpg">
<img class="bordure2" src="images/bordure2.jpg"></center>
<img class="banniere" src="images/banniere.jpg">
<a href="index.html" class="bouton1" style="background-image:url(images/bout.gif)">Accueil</a>
<a href="Telephonie.html" class="bouton2" style="background-image:url(images/bout.gif)">Téléphonie</a>
<a href="Informatique.html" class="bouton3" style="background-image:url(images/bout.gif)">Informatique</a>
<a href="Situation.html" class="bouton4" style="background-image:url(images/bout.gif)">Situation</a>
<a href="Contact.php" class="bouton5" style="background-image:url(images/bout.gif)">Contact</a>
<!-- Corps du site -->
<div id="page_contenu">
<div id="titre" style="margin-left:4%"><br><br><h3><u> NOUS CONTACTER </u></h3></div>
<img src="images/arobas.jpg" id="contact_mail">
<a href="mailto:fumel.communication@orange.fr"><div id="mail">fumel.communication@orange.fr </div></a>
<img src="images/tel.jpg" id="contact_tel"> <div id="tel"><b> 05 53 750 762 </b></div>
<FORM METHOD="POST" ACTION="Contact.php" name="contact">
<?php if(!empty($_POST['validcontact'])) {
$nom = $_POST['nom'];
$mail = $_POST['mail'];
$subject = $_POST['subject'];
$message = $_POST['message'];
if (!empty($message)) {
if (validmail($mail) == "OK" ) {
$destinataire = "fumel.communication@orange.fr" ;
$subject = "Sujet du mail" ;
$message = "Email : " . $mail . "<br>";
$message .= "Nom : " . $nom . "<br>";
$message .= "Message : " . $message . "<br>";
$mailheaders = "From : " . $mail ."\n";
$mailheaders .='Content-Type: text/html; charset="iso-8859-1"'."\n";
$mailheaders .='Content-Transfer-Encoding: 8bit';
mail($destinataire, $subject, $message, $mailheaders) ;
echo '<SCRIPT language="Javascript">
alert("Votre message a bien été envoyé. Merci.");
window.location.replace(\'Contact.php\');
</SCRIPT>';
} else { echo '<span id="alert">' . validmail($mail) . '</span>'; }
} else { echo '<span id="alert">Le champ Message est obligatoire</span>';}
} ?>
<table cellpadding="12" cellspacing="4" border=3 bordercolor="#0099CC" class="form" align="right">
<tr>
<td>
<b>Nom :</b>
</td>
<td>
<input type="text" name="nom" size="30" maxlength="40" style="color:#0099CC" <?php if (!empty($nom)) { echo "value=" . $nom; }?>>
</td>
</tr>
<tr>
<td>
<b>Email * :</b>
</td>
<td>
<input type="text" name="mail" size="30" maxlength="40" style="color:#0099CC" <?php if (!empty($mail)) { echo "value=" . $mail; }?>>
</td>
</tr>
<tr>
<td>
<b>Sujet :</b>
</td>
<td>
<input type="text" name="subject" size="30" class="inputbox" style="color:#0099CC" <?php if (!empty($subject)) { echo $subject; }?>>
<!-- Valeur par défaut de l'objet du mail -->
<input type="hidden" name="subject" value="Vous avez un nouveau message" style="color:#0099CC">
</td>
</tr>
<tr>
<td>
<b>Message * :</b>
</td>
<td>
<textarea name="message" cols="37" rows="6" onFocus="this.value=''" value="Tapez ici votre message" style="color:#0099CC"><?php if (!empty($message)) { echo $message; }?>Tapez ici votre message</textarea>
</td>
</tr>
<tr>
<th colspan=2>
<input id="button" type="submit" name="validcontact" value=" Envoyer " style="color:#0099CC">
<input id="button" type="reset" name="annulercontact" value=" Annuler " style="color:#0099CC">
<p align="right" style="font-size: 13px; color: #ED7A25;">* Champs obligatoires</p>
</th>
</tr>
</table>
</form>
<!-- Pied de page -->
<div id="pied_page">
¤ ® Copyright telephonestore-fumel.com 2008 ¤
</div>
</div>
</body>
</html>
SVP AIDEZ MOI A CORRIGER LES ERREURS DE MON CODE !!!!!!
Merci d'avance
Sandy
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Contact</title>
<!-- inclusion de la feuille CSS -->
<link href="../CSS/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!-- Bannière du site -->
<center><img class="bordure1" src="images/bordure1.jpg">
<img class="bordure2" src="images/bordure2.jpg"></center>
<img class="banniere" src="images/banniere.jpg">
<a href="index.html" class="bouton1" style="background-image:url(images/bout.gif)">Accueil</a>
<a href="Telephonie.html" class="bouton2" style="background-image:url(images/bout.gif)">Téléphonie</a>
<a href="Informatique.html" class="bouton3" style="background-image:url(images/bout.gif)">Informatique</a>
<a href="Situation.html" class="bouton4" style="background-image:url(images/bout.gif)">Situation</a>
<a href="Contact.php" class="bouton5" style="background-image:url(images/bout.gif)">Contact</a>
<!-- Corps du site -->
<div id="page_contenu">
<div id="titre" style="margin-left:4%"><br><br><h3><u> NOUS CONTACTER </u></h3></div>
<img src="images/arobas.jpg" id="contact_mail">
<a href="mailto:fumel.communication@orange.fr"><div id="mail">fumel.communication@orange.fr </div></a>
<img src="images/tel.jpg" id="contact_tel"> <div id="tel"><b> 05 53 750 762 </b></div>
<FORM METHOD="POST" ACTION="Contact.php" name="contact">
<?php if(!empty($_POST['validcontact'])) {
$nom = $_POST['nom'];
$mail = $_POST['mail'];
$subject = $_POST['subject'];
$message = $_POST['message'];
if (!empty($message)) {
if (validmail($mail) == "OK" ) {
$destinataire = "fumel.communication@orange.fr" ;
$subject = "Sujet du mail" ;
$message = "Email : " . $mail . "<br>";
$message .= "Nom : " . $nom . "<br>";
$message .= "Message : " . $message . "<br>";
$mailheaders = "From : " . $mail ."\n";
$mailheaders .='Content-Type: text/html; charset="iso-8859-1"'."\n";
$mailheaders .='Content-Transfer-Encoding: 8bit';
mail($destinataire, $subject, $message, $mailheaders) ;
echo '<SCRIPT language="Javascript">
alert("Votre message a bien été envoyé. Merci.");
window.location.replace(\'Contact.php\');
</SCRIPT>';
} else { echo '<span id="alert">' . validmail($mail) . '</span>'; }
} else { echo '<span id="alert">Le champ Message est obligatoire</span>';}
} ?>
<table cellpadding="12" cellspacing="4" border=3 bordercolor="#0099CC" class="form" align="right">
<tr>
<td>
<b>Nom :</b>
</td>
<td>
<input type="text" name="nom" size="30" maxlength="40" style="color:#0099CC" <?php if (!empty($nom)) { echo "value=" . $nom; }?>>
</td>
</tr>
<tr>
<td>
<b>Email * :</b>
</td>
<td>
<input type="text" name="mail" size="30" maxlength="40" style="color:#0099CC" <?php if (!empty($mail)) { echo "value=" . $mail; }?>>
</td>
</tr>
<tr>
<td>
<b>Sujet :</b>
</td>
<td>
<input type="text" name="subject" size="30" class="inputbox" style="color:#0099CC" <?php if (!empty($subject)) { echo $subject; }?>>
<!-- Valeur par défaut de l'objet du mail -->
<input type="hidden" name="subject" value="Vous avez un nouveau message" style="color:#0099CC">
</td>
</tr>
<tr>
<td>
<b>Message * :</b>
</td>
<td>
<textarea name="message" cols="37" rows="6" onFocus="this.value=''" value="Tapez ici votre message" style="color:#0099CC"><?php if (!empty($message)) { echo $message; }?>Tapez ici votre message</textarea>
</td>
</tr>
<tr>
<th colspan=2>
<input id="button" type="submit" name="validcontact" value=" Envoyer " style="color:#0099CC">
<input id="button" type="reset" name="annulercontact" value=" Annuler " style="color:#0099CC">
<p align="right" style="font-size: 13px; color: #ED7A25;">* Champs obligatoires</p>
</th>
</tr>
</table>
</form>
<!-- Pied de page -->
<div id="pied_page">
¤ ® Copyright telephonestore-fumel.com 2008 ¤
</div>
</div>
</body>
</html>
A voir également:
- FONCTION MAIL( ) en PHP ne marche pas...
- Fonction si et - Guide
- Publipostage mail - Accueil - Word
- Windows live mail - Télécharger - Mail
- Créer une adresse mail hotmail - Guide
- Fonction filtre excel n'existe pas - Forum Excel
3 réponses
Bonjour
Ca ne fait rien c'est à dire ? As-tu un message d'erreur de PHP ?
Eventuellement remplace
par
pour afficher la valeur retournée
Tes essais tu les fais depuis chez toi en local ou après avoir uploader ta page chez ton hébergeur ?
Es-tu sûr que ton hébergeur t'autorise à envoyer des mails ?
Si tu essais depuis chez toi en local il faut configure le SMTP et l'adresse mail dans php.ini
Ca ne fait rien c'est à dire ? As-tu un message d'erreur de PHP ?
Eventuellement remplace
mail($destinataire, $subject, $message, $mailheaders) ;
par
echo "mail=".mail($destinataire, $subject, $message, $mailheaders) ;
pour afficher la valeur retournée
Tes essais tu les fais depuis chez toi en local ou après avoir uploader ta page chez ton hébergeur ?
Es-tu sûr que ton hébergeur t'autorise à envoyer des mails ?
Si tu essais depuis chez toi en local il faut configure le SMTP et l'adresse mail dans php.ini
Mon site est ligne et mon hébergeur est OVH donc il gère bien la fonction mail()