|
|
|
|
Bonjour,
j'ai un site internet qui héberge une page contact avec un formulaire email en php.
Ce formulaire marche très bien sauf que je ne reçois pas les mail lorsque la personne qui me l'envoi a une adresse email qui fini en hotmail.fr.
J'ai essayé et ça marche très bien avec hotmail.com, wanadoo.fr, voila.fr.
J'ai essayé avec plusieurs personnes qui ont un email en hotmail.fr et ça ne marche jamais.
Quelqu'un peut il m'aider ?
Merci d'avance.
Configuration: Windows Vista Internet Explorer 7.0
Voici,
|
Il faudrait que tu fasse un test pour vérifier si le mail est bien envoyé :
if (mail($destinataire,$objet,$message,$from)) echo "Mail envoyé avec succès"; else echo "Erreur dans l'envoi du mail"; Mais en fait, je viens de trouver un truc très intéressant ! http://fr.php.net/manual/fr/function.mail.php : dans les commentaires, le commentaire apdhanushka at yahoo dot com du 30-Jan-2008 01:21 : Are you getting spammed while sendig emails using php mail() function to yahoo or hotmail? It is a common problem for all using php mail function. To solve this there are so many answers I have seen in the internet and they do not hit problem correctly. Actually the problem here is if we send mails using php mail function we do not have a signature and other mailing systems thinks that we are spamers. So the solution is using a free remote smtp host like gmail to send our mails. It is not hard because we have a free php smtp project called PHPMailer. You can download it from http://sourceforge.net/project/showfiles.php?group_id=26031. You do not need to install it on your server and you can upload it to the server with your code. It is very easy to understand how it is used to send mails using examples zipped with PHPMailer. The following code is to send emails using gmail and to do that you have to have a gmail mail account. Which can easily be created by visiting http://gmail.com. Your mails will send using that mail account and they will never become spams... You can follow the following link to get the code to send emails using gmail's free smtp service. http://bestdeveloper.blogspot.com/ Bref, pour résumer : utiliser la fonction mail de PHP n'est pas une bonne idée. Il vaut mieux utiliser des classes d'envoi de mail qui sont faites pour ça, sont plus robustes et plus finies. mail est une fonction trop brute : - swiftmailer : http://www.swiftmailer.org/ - phpmailer : http://phpmailer.codeworxtech.com/ Un petit exemple d'envoi de mail avec PHPMailer : <?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.example.com"; // SMTP server
$mail->From = "from@example.com";
$mail->AddAddress("myfriend@example.net");
$mail->Subject = "First PHPMailer Message";
$mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
$mail->WordWrap = 50;
if(!$mail->Send())
{
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
}
else
{
echo 'Message has been sent.';
}
?>
Et pour Swift Mailer 3 : <?php
//Load in the files we'll need
require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";
//Start Swift
$swift =& new Swift(new Swift_Connection_SMTP("smtp.your-host.tld"));
//Create the message
$message =& new Swift_Message("My subject", "My body");
//Now check if Swift actually sends it
if ($swift->send($message, "foo@bar.tld", "me@mydomain.com")) echo "Sent";
else echo "Failed";
Bon, vraiment pas sorcier, hein ?! Raph |
Bonjour à tous,
|