PHP : envoi d'email sous wampserver (cours)
Bonjour,
je suis encore debutant ,je cherche des cours pour savoir comment utiliser Php pour envoyer des mail ,via mail() ou phpmailer, je voudrais tout aprendre du debut a la fin.
comment configurer httpd et php.ini
j'utilise wampserveur sous windows
Code:
1 2 3 4 5 6 7
| $to = 'truc@server.com';
// Subject
$subject = 'Developpez.com - Test Mail';
// Message
$msg = 'Developpez.com - Message du mail ...';
// Function mail()
mail($to, $subject, $msg); |
le message d'erreur
Citation:
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 D:\wamp\www\mail2.php on line 16
merci
Apres changement dans php.ini ,le resultats :
Citation:
Warning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. x6sm11312466gvf.24 in D:\wamp\www\mail2.php on line 23
Votre message n'a pas pu être envoyé
Avec un autre script :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| <?php
require "phpmailer/class.phpmailer.php";
$mail = new PHPmailer();
$mail->From='votre@adresse';
$mail->AddAddress('upload/');
$mail->AddReplyTo('votre@adresse');
$mail->Subject='Exemple trouvé sur DVP';
$mail->Body='Voici un exemple d\'e-mail au format Texte';
if(!$mail->Send()){ //Teste le return code de la fonction
echo $mail->ErrorInfo; //Affiche le message d'erreur (ATTENTION:voir section 7)
}
else{
echo 'Mail envoyé avec succès';
}
echo 'aaa'.$mail.'aaaa';
?> |
Citation:
Language string failed to load: instantiate
Catchable fatal error: Object of class PHPMailer could not be converted to string in D:\wamp\www\mail.php on line 23
COMMENT UTILISER PHPMAILER ,?
merci