Je vais envoyer un courriel aux utilisateurs qui sont remplit mon formulaire… sous le serveur Windows Server Web 2007.
Pour cela, il faut que je configure mon fichier php.ini.
Actuellement les valeurs [sendmail_from] et [sendmail_path] sont [no value].
En outre la valuer [Internal Sendmail Support for Windows] est [enabled]
Et voici ce qu’il y a dans le fichier :
Code : Tout sélectionner
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
;sendmail_from = [email protected]
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
Et voici mon code en php :
$var_civilite=$_POST["civilite"];
$var_nom=$_POST["nom"];
// Pour traiter les accents
$var_nom= htmlspecialchars($var_nom, ENT_QUOTES);
$var_courriel=$_POST["courriel"];
// Pour traiter les accents
$var_courriel= htmlspecialchars($var_courriel, ENT_QUOTES);
If (!empty($var_email))
{
$recipient = "[email protected]";
$subject = "confirmation de votre engregistrement…" ;
$msg = "Bonjour \t$var_civilite \t$var_nom\n";
$msg .= "Courriel : \t$var_email\n";
$msg = "Merci de votre inscription sur notre liste d’envoi. Vous faites maintenant partie de ce vaste réseau\n\n";
$mailheaders = "From: toto.com<> \n";
}
mail($recipient, $subject, $msg, $mailheaders);
est ce que mon code en php est correct ?Bonne soirée