PHP : SMTP server response: 501 Bad address syntax

PHP : SMTP server response: 501 Bad address syntax - PHP - Programmation

Marsh Posté le 29-02-2008 à 18:11:35    

Bonjour,
Je souhaite créer un formulaire pour mon site, les informations le contenant me seront envoyées par e-mail. Voici le code HTML :
 
<html>
 <head>
 <head>
 <body background="fond.jpg" bgproperties="fixed">
 <center><font size="7" color="red">Contact</font></center>
 <br><br><br>
 <font size="4" color="#FFCC00">
 <center>
 <form method="POST" action="envoi.php">
 Titre : M.<input type="radio" name="titre">  Mme<input type="radio" name="titre"> Mlle<input type="radio" name="titre"><br><br>
 Nom : <input type="text" name="nom"><br><br>
 Prénom : <input type="text" name="prenom"><br><br>
 E-mail : <input type="text" name="email"><br><br>
 Sujet : <select name="sujet"><br><br>
   <option>Choisissez</option>
   <option>Déclarer une erreur</option>
   <option>Ajouter une information</option>
   <option>Autre</option>
   </select><br><br>
 Message :<br><br>
 <textarea name="message" cols=30 rows=5>Tapez votre message ici</textarea><br><br>
 <input type="submit" value="Envoyer" name="envoyer"><br><br>
 </form>
 </center>
 </font>
 </body>
 </html>
 
Et le code PHP :
 
<?php
$titre=$_POST['titre'];
$nom=$_POST['nom'];
$prenom=$_POST['prenom'];
$email=$_POST['email'];
$message=$_POST['message'];
$msg="Titre : $titre\n";
$msg .="Nom : $nom\n";
$msg .="Prénom : $prenom\n";
$msg .="E-mail : $email\n";
$msg .="Message :\n $message\n\n";
$recipient="ttceci@wanadoo.fr";
$subject=$_POST['sujet'];
$mailheaders = "From: Formulaire <> \n";
$mailheaders .= "Reply-To: $email\n\n";  
mail($recipient, $subject, $msg, $mailheaders);
echo "<html><head>";
echo "<title>Envoi du formulaire</title></head><body background=\"fond.jpg\">";
echo "<font size=\"4\" color=\"#FFCC00\">$nom $prenom,votre formulaire a bien été envoyé</font>";
echo "</body></html>";
?>
 
Le problème est que j'obtiens le message d'erreur suivant :
 
Warning: mail() [function.mail]: SMTP server response: 501 Bad address syntax in C:\wamp\www\site\envoi.php on line 16
 
En recherchant sur Internet j'ai vu que le problème venait du fichier php.ini qui été mal configuré.
Je l'ai alors modifié ainsi :
 
[mail function]
; For Win32 only.
SMTP = smtp.orange.fr
smtp_port = 25
 
; For Win32 only.
;sendmail_from = ttceci@wanadoo.fr
 
Cela ne marche toujours pas même après avoir redémarrer Apache.
 
Merci de me donner une solution.
 

Reply

Marsh Posté le 29-02-2008 à 18:11:35   

Reply

Marsh Posté le 29-02-2008 à 19:13:37    

Petit up.

Reply

Marsh Posté le 29-02-2008 à 20:57:55    

J'ai trouvé le problème :
il suffit de supprimer le ; au niveau de sendmail_from et de redémarrer Apache :
 
[mail function]
; For Win32 only.
SMTP = smtp.orange.fr
smtp_port = 25
 
; For Win32 only.
sendmail_from = ttceci@wanadoo.fr

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed