IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

PhpMailer - Ajout lien impossible


Sujet :

Langage PHP

  1. #1
    Membre du Club
    Homme Profil pro
    Cobol sur Mainframe et Unix AIX
    Inscrit en
    Mars 2012
    Messages
    196
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Cobol sur Mainframe et Unix AIX

    Informations forums :
    Inscription : Mars 2012
    Messages : 196
    Points : 69
    Points
    69
    Par défaut PhpMailer - Ajout lien impossible
    Bonjour,

    J'ai une variable $corp_mail qui reçoit tout le message.

    J'utilise PHPMailer comme suit en HTML :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    // Création d'un nouvel objet $mail
    	$mail = new PHPMailer();
     
    	$mail->setLanguage('fr','classes/PHPMailer/language/phpmailer.lang-fr.php');
     
    	$mail->IsHTML(true);
    	$mail->CharSet = "UTF-8";
     
    	$mail->setFrom($expediteur, $lib_expediteur);
    	$mail->AddReplyTo($expediteur);
     
    	$mail->Subject = $sujet;
     
    	$mail->MsgHTML($corp_mail);
            $mail->addAddress($unDest);
            $mail->Send();
    Avant que j'insère un lien hypertexte, pas de souci, le mail est bien reçu correctement.

    Quand j'ajout le lien,
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     $corp_mail .= $corp_mail. "<a href='http://http://www.xxxx.asso.fr'>ici</a>";
    là patatraque ... j'ai l'erreur :Could not instantiate mail function

    En mettant $mai dans var_dump, je vois :

    "CustomHeader":protected]=> array(0) { } ["lastMessageID":protected]=> string(50) "" ["message_type":protected]=> string(3) "alt" ["boundary":protected]=> array(3) { [1]=> string(35) "b1_b348feeaf0cb2fe7f6fd30121ce0b5e0" [2]=> string(35) "b2_b348feeaf0cb2fe7f6fd30121ce0b5e0" [3]=> string(35) "b3_b348feeaf0cb2fe7f6fd30121ce0b5e0" } ["language":protected]=> array(19) { ["authenticate"]=> string(35) "SMTP Error: Could not authenticate." ["connect_host"]=> string(43) "SMTP Error: Could not connect to SMTP host." ["data_not_accepted"]=> string(30) "SMTP Error: data not accepted." ["empty_message"]=> string(18) "Message body empty" ["encoding"]=> string(18) "Unknown encoding: " ["execute"]=> string(19) "Could not execute: " ["file_access"]=> string(23) "Could not access file: " ["file_open"]=> string(33) "File Error: Could not open file: " ["from_failed"]=> string(35) "The following From address failed: " ["instantiate"]=> string(36) "Could not instantiate mail function." ["invalid_address"]=> string(17) "Invalid address: " ["mailer_not_supported"]=> string(25) " mailer is not supported." ["provide_address"]=> string(54) "You must provide at least one recipient email address." ["recipients_failed"]=> string(45) "SMTP Error: The following recipients failed: " ["signing"]=> string(15) "Signing Error: " ["smtp_connect_failed"]=> string(22) "SMTP connect() failed." ["smtp_error"]=> string(19) "SMTP server error: " ["variable_set"]=> string(30) "Cannot set or reset variable: " ["extension_missing"]=> string(19) "Extension missing: " } ["error_count":protected]=> int(1) ["sign_cert_file":protected]=> string(0) "" ["sign_key_file":protected]=> string(0) "" ["sign_extracerts_file":protected]=> string(0) "" ["sign_key_pass":protected]=> string(0) "" ["exceptions":protected]=> bool(false) ["uniqueid":protected]=> string(32) "b348feeaf0cb2fe7f6fd30121ce0b5e0" }
    Pourquoi j'ai :
    "Could not access file:
    Invalid address:
    SMTP Error: The following recipients failed
    Si j'enlève :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <a href='http://http://www.xxxx.asso.fr'>ici</a>
    ça refonctionne.

    Avez-vous une explication ?

    Merci de votre aide.

    Eddy

  2. #2
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Tu as une faute de syntaxe :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $corp_mail .= "<a href='http://http://www.xxxx.asso.fr'>ici</a>";
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  3. #3
    Membre du Club
    Homme Profil pro
    Cobol sur Mainframe et Unix AIX
    Inscrit en
    Mars 2012
    Messages
    196
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Cobol sur Mainframe et Unix AIX

    Informations forums :
    Inscription : Mars 2012
    Messages : 196
    Points : 69
    Points
    69
    Par défaut
    J'avais corrigé mais pas forcément sur mon post.

    Quand je mets ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $corp_mail.="<a href='http://www.xxx.asso.fr'>Vers le SCF</a>";
    ça fonctionne, mais quand je mets ceci, non
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $corp_mail.="<a href='http://www.xxx.asso.fr/core/pages/certif_xxxxxxxxxx_xxxxxxxxxx_imprimable.php'>ici</a>";
    pourquoi ?

  4. #4
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Tu devrais activer le mode debug de phpmailer.
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  5. #5
    Membre du Club
    Homme Profil pro
    Cobol sur Mainframe et Unix AIX
    Inscrit en
    Mars 2012
    Messages
    196
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Cobol sur Mainframe et Unix AIX

    Informations forums :
    Inscription : Mars 2012
    Messages : 196
    Points : 69
    Points
    69
    Par défaut
    J'ai ajouté ceci : $mail->SMTPDebug = true;

    Voici ce que j'ai (mais je l'avais avais également)
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    2016-11-19 13:50:53	Could not instantiate mail function. object(PHPMailer)#58 (75) { ["Version"]=> string(6) "5.2.15" ["Priority"]=> NULL ["CharSet"]=> string(5) "UTF-8" ["ContentType"]=> string(21) "multipart/alternative" ["Encoding"]=> string(4) "8bit" ["ErrorInfo"]=> string(36) "Could not instantiate mail function." ["From"]=> string(21) "technique@xxx.asso.fr" ["FromName"]=> string(35) "Site du XXX- Responsable Technique" ["Sender"]=> string(21) "technique@xxx.asso.fr" ["ReturnPath"]=> string(0) "" ["Subject"]=> string(50) "XXXX - Adhérents avec certificat médical périmé" ["Body"]=> string(1127) "	Bonjour ......"
    " ["MIMEHeader":protected]=> string(402) "Date: Sat, 19 Nov 2016 14:50:53 +0100 From: Site du XXXX- Responsable Technique Reply-To: technique@XXXX.asso.fr Message-ID: X-Mailer: PHPMailer 5.2.15 (https://github.com/PHPMailer/PHPMailer) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="b1_b325894891a88a6f3c867782d903933c" Content-Transfer-Encoding: 8bit " ["mailHeader":protected]=> string(132) "To: xxxxxxxxxxi@gmail.com Subject: =?UTF-8?Q?SCF_-_Adh=C3=A9rents_avec_certificat_m=C3=A9dical_p=C3=A9rim?= =?UTF-8?Q?=C3=A9?= " ["WordWrap"]=> int(0) ["Mailer"]=> string(4) "mail" ["Sendmail"]=> string(18) "/usr/sbin/sendmail" ["UseSendmailOptions"]=> bool(true) ["PluginDir"]=> string(0) "" ["ConfirmReadingTo"]=> string(0) "" ["Hostname"]=> string(0) "" ["MessageID"]=> string(0) "" ["MessageDate"]=> string(31) "Sat, 19 Nov 2016 14:50:53 +0100" ["Host"]=> string(9) "localhost" ["Port"]=> int(25) ["Helo"]=> string(0) "" ["SMTPSecure"]=> string(0) "" ["SMTPAutoTLS"]=> bool(true) ["SMTPAuth"]=> bool(false) ["SMTPOptions"]=> array(0) { } ["Username"]=> string(0) "" ["Password"]=> string(0) "" ["AuthType"]=> string(0) "" ["Realm"]=> string(0) "" ["Workstation"]=> string(0) "" ["Timeout"]=> int(300) ["SMTPDebug"]=> bool(true) ["Debugoutput"]=> string(4) "echo" ["SMTPKeepAlive"]=> bool(false) ["SingleTo"]=> bool(false) ["SingleToArray"]=> array(0) { } ["do_verp"]=> bool(false) ["AllowEmpty"]=> bool(false) ["LE"]=> string(1) " " ["DKIM_selector"]=> string(0) "" ["DKIM_identity"]=> string(0) "" ["DKIM_passphrase"]=> string(0) "" ["DKIM_domain"]=> string(0) "" ["DKIM_private"]=> string(0) "" ["action_function"]=> string(0) "" ["XMailer"]=> string(0) "" ["smtp":protected]=> NULL ["to":protected]=> array(1) { [0]=> array(2) { [0]=> string(25) "xxxxxxi@gmail.com" [1]=> string(0) "" } } ["cc":protected]=> array(0) { } ["bcc":protected]=> array(0) { } ["ReplyTo":protected]=> array(1) { ["technique@xxx.asso.fr"]=> array(2) { [0]=> string(21) "technique@xxxx.asso.fr" [1]=> string(0) "" } } ["all_recipients":protected]=> array(1) { ["xxxxxi@gmail.com"]=> bool(true) } ["RecipientsQueue":protected]=> array(0) { } ["ReplyToQueue":protected]=> array(0) { } ["attachment":protected]=> array(0) { } ["CustomHeader":protected]=> array(0) { } ["lastMessageID":protected]=> string(50) "" ["message_type":protected]=> string(3) "alt" ["boundary":protected]=> array(3) { [1]=> string(35) "b1_b325894891a88a6f3c867782d903933c" [2]=> string(35) "b2_b325894891a88a6f3c867782d903933c" [3]=> string(35) "b3_b325894891a88a6f3c867782d903933c" } ["language":protected]=> array(19) { ["authenticate"]=> string(35) "SMTP Error: Could not authenticate." ["connect_host"]=> string(43) "SMTP Error: Could not connect to SMTP host." ["data_not_accepted"]=> string(30) "SMTP Error: data not accepted." ["empty_message"]=> string(18) "Message body empty" ["encoding"]=> string(18) "Unknown encoding: " ["execute"]=> string(19) "Could not execute: " ["file_access"]=> string(23) "Could not access file: " ["file_open"]=> string(33) "File Error: Could not open file: " ["from_failed"]=> string(35) "The following From address failed: " ["instantiate"]=> string(36) "Could not instantiate mail function." ["invalid_address"]=> string(17) "Invalid address: " ["mailer_not_supported"]=> string(25) " mailer is not supported." ["provide_address"]=> string(54) "You must provide at least one recipient email address." ["recipients_failed"]=> string(45) "SMTP Error: The following recipients failed: " ["signing"]=> string(15) "Signing Error: " ["smtp_connect_failed"]=> string(22) "SMTP connect() failed." ["smtp_error"]=> string(19) "SMTP server error: " ["variable_set"]=> string(30) "Cannot set or reset variable: " ["extension_missing"]=> string(19) "Extension missing: " } ["error_count":protected]=> int(1) ["sign_cert_file":protected]=> string(0) "" ["sign_key_file":protected]=> string(0) "" ["sign_extracerts_file":protected]=> string(0) "" ["sign_key_pass":protected]=> string(0) "" ["exceptions":protected]=> bool(false) ["uniqueid":protected]=> string(32) "b325894891a88a6f3c867782d903933c" } 
    
    
    Echec de l'envoi du mail, Erreur: Could not instantiate mail function.

  6. #6
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    c'est
    Essaie en utilisant le mode SMTP plutôt que la fonction mail.
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  7. #7
    Membre du Club
    Homme Profil pro
    Cobol sur Mainframe et Unix AIX
    Inscrit en
    Mars 2012
    Messages
    196
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Cobol sur Mainframe et Unix AIX

    Informations forums :
    Inscription : Mars 2012
    Messages : 196
    Points : 69
    Points
    69
    Par défaut
    c'est à dire ?

  8. #8
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

Discussions similaires

  1. [PHPMailer] Ajout d'un objet incorporé
    Par mathieugamin dans le forum Bibliothèques et frameworks
    Réponses: 2
    Dernier message: 18/12/2009, 10h52
  2. IE7 KO clic lien impossible
    Par pop_up dans le forum Mise en page CSS
    Réponses: 9
    Dernier message: 11/03/2008, 10h59
  3. Pb ajout entrée impossible
    Par chanteur06 dans le forum Requêtes
    Réponses: 2
    Dernier message: 21/10/2007, 16h43
  4. [Configuration] Ajouter liens sur listing de fichiers
    Par m-mas dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 4
    Dernier message: 28/02/2007, 14h03
  5. [VBA]Ajout module impossible
    Par ip203 dans le forum Access
    Réponses: 1
    Dernier message: 19/05/2006, 10h19

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo