Pages

PHPmailer et smtp ? sujet

samedi 1 février 2014




Bonjour,
j'essaie d'utiliser PHPmailer pour la 1ère fois.

Je teste (formulaire "contact") :

Code:


                $mail = new PHPMailer();
                $mail->IsSMTP();                  // telling the class to use SMTP
                $mail->Host                    = 'smtp.nom-de-mon-site.com'; // SMTP server
                $mail->SMTPAuth                = false; // true - false : Enable SMTP authentication
                $mail->From                    = $client_Email;


N.B. étant chez OVH (guide email), SMTP est de la forme : 'smtp.nom-de-mon-site.com'

Mais j'ai une erreur :

Citation:









Mailer error: The following From address failed: [client_Email] : Called Mail() without being connected




Si je commente les 3 lignes concernant le SMTP (IsSMTP, Host, SMTPAuth), le mail est bien envoyé.

Question(s) :
  • Est-il obligatoire de déclarer le SMTP ?

  • Si oui, pourquoi et surtout comment ?


Merci.




Aucun commentaire:

Enregistrer un commentaire