Salut,
Voila je suis débutant en PHP et je cherche a utiliser la fonction mail pour une page "Nous Contacter" sur mon site.
Cependant j'y arrive pas.
Je vous donne tout d'abord mon code :
<?php
$headers ='From: "'$_POST[`nom`]'"<'$_POST[`mail`]'>'."\n";
$headers .='Reply-To: monadresse@test.fr'."\n";
$headers .='Content-Type: text/plain; charset="iso-8859-1"'."\n";
$headers .='Content-Transfer-Encoding: 8bit';
$message = $_POST[`message`];
if(mail($_POST[`mail`], $message, $headers))
{
echo 'Le message a bien été envoyé';
}
else
{
echo 'Le message n\'a pu être envoyé';
}
?>
Et l'erreur :
Notice: Undefined variable: headers in C:\wamp\www\Projet\app\mail.php on line 3
Notice: Undefined index: in C:\wamp\www\Projet\app\mail.php on line 6
Notice: Undefined index: in C:\wamp\www\Projet\app\mail.php on line 9
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\Projet\app\mail.php on line 9.
Travaillant sous localhost pour le moment, j'ai essayé de mettre le SMTP de mon FAI dans le fichier php.ini, mais même erreur..
Je m'en remets alors à vous pour m'aider, cette fonction mail semble particulierement simple a utiliser pourtant...
Merci d'avance pour votre aide.