Je veux envoyer un mail depuis le formulaire de contact qui suit.
J'utilise un fichier contactForm.php qui contient le formulaire de contact et qui l'envoie en post à send_email.php.
J'utilise en localhost le logiciel wampserver constitué de Apach 2.2.1.11 et php 5.3.0 et Mysql.
Il semblerait que la configuration du php.ini n'est pas correcte.
J'écris à la suite l'ensemble des script.
Merci de vos réponses ou remarques.
///contactForm.php///
<form name="contactForm" action="send_email.php" method="POST">
<input name="name" type="text">
<input name="email" type="text">
<textarea name="body" rows="10" cols="20"></textarea>
<input type="submit" value="solicitar" />
</form>
///send_email.php///
<?php
$nom = stripslashes($_POST['name']);
$expediteur = stripslashes($_POST['email']);
$message = stripslashes($_POST['body']);
$host = "ssl://smtp.gmail.com";
$username = "fecoucou@gmail.com";
$password = "motdepasse";//ça, c'est pour pas dire mon mot de passe, désolé
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp', //c'est là que firefox me dit erreur
array ('host' => $host,
'port' => 587,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
?>
///extrait de php.ini///
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.gmail.com
; http://php.net/smtp-port
smtp_port = 587
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = fecoucou@gmail.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;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 =
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = On
; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log =