[RESOLU] Erreur SMTP phpmailer

Eléphant du PHP | 194 Messages

16 mars 2023, 06:11

Bonjour à tous,

J'utilise phpmailer sur mon site, lorsque j'envoie un mail pas de soucis pendant l'inscription et autre.
La je met en place l'envoie d'un mail a tous les utilisateurs, et je me retrouve avec cette erreur : SMTP connect() failed
plus précisément :

Erreur lors de l'envoi de l'email : SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/ ... ct(Mail)#2 (1) { ["_mailer":"Mail":private]=> object(PHPMailer\PHPMailer\PHPMailer)#3 (74) { ["Priority"]=> NULL ["CharSet"]=> string(10) "iso-8859-1" ["ContentType"]=> string(10) "text/plain" ["Encoding"]=> string(4) "7bit" ["ErrorInfo"]=> string(82) "SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/ ... leshooting" ["From"]=> string(20) "[email protected]" ["FromName"]=> string(8) "Easykode" ["Sender"]=> string(20) "[email protected]" ["Subject"]=> string(25) "ferrffrferfrefreferferfer" ["Body"]=> string(23) "ferferferferferfeferfer" ["AltBody"]=> string(0) "" ["Ical"]=> string(0) "" ["MIMEBody":protected]=> string(25) "ferferferferferfeferfer " ["MIMEHeader":protected]=> string(404) "Date: Wed, 15 Mar 2023 19:43:38 +0100 To: [email protected], [email protected], [email protected] From: Easykode Subject: ferrffrferfrefreferferfer Message-ID: <[email protected]> X-Mailer: PHPMailer 6.5.0 (https://github.com/PHPMailer/PHPMailer) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 " ["mailHeader":protected]=> string(0) "" ["WordWrap"]=> int(0) ["Mailer"]=> string(4) "smtp" ["Sendmail"]=> string(18) "/usr/sbin/sendmail" ["UseSendmailOptions"]=> bool(true) ["ConfirmReadingTo"]=> string(0) "" ["Hostname"]=> string(0) "" ["MessageID"]=> string(0) "" ["MessageDate"]=> string(0) "" ["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) "" ["oauth":protected]=> NULL ["Timeout"]=> int(300) ["dsn"]=> string(0) "" ["SMTPDebug"]=> int(0) ["Debugoutput"]=> string(4) "html" ["SMTPKeepAlive"]=> bool(false) ["SingleTo"]=> bool(false) ["SingleToArray":protected]=> array(0) { } ["do_verp"]=> bool(false) ["AllowEmpty"]=> bool(false) ["DKIM_selector"]=> string(0) "" ["DKIM_identity"]=> string(0) "" ["DKIM_passphrase"]=> string(0) "" ["DKIM_domain"]=> string(0) "" ["DKIM_copyHeaderFields"]=> bool(true) ["DKIM_extraHeaders"]=> array(0) { } ["DKIM_private"]=> string(0) "" ["DKIM_private_string"]=> string(0) "" ["action_function"]=> string(0) "" ["XMailer"]=> string(0) "" ["smtp":protected]=> object(PHPMailer\PHPMailer\SMTP)#7 (12) { ["do_debug"]=> int(0) ["Debugoutput"]=> string(4) "html" ["do_verp"]=> bool(false) ["Timeout"]=> int(300) ["Timelimit"]=> int(300) ["smtp_transaction_id_patterns":protected]=> array(8) { ["exim"]=> string(20) "/[\d]{3} OK id=(.*)/" ["sendmail"]=> string(28) "/[\d]{3} 2.0.0 (.*) Message/" ["postfix"]=> string(34) "/[\d]{3} 2.0.0 Ok: queued as (.*)/" ["Microsoft_ESMTP"]=> string(56) "/[0-9]{3} 2.[\d].0 (.*)@(?:.*) Queued mail for delivery/" ["Amazon_SES"]=> string(17) "/[\d]{3} Ok (.*)/" ["SendGrid"]=> string(28) "/[\d]{3} Ok: queued as (.*)/" ["CampaignMonitor"]=> string(35) "/[\d]{3} 2.0.0 OK:([a-zA-Z\d]{48})/" ["Haraka"]=> string(33) "/[\d]{3} Message Queued \((.*)\)/" } ["last_smtp_transaction_id":protected]=> NULL ["smtp_conn":protected]=> bool(false) ["error":protected]=> array(4) { ["error"]=> string(0) "" ["detail"]=> string(0) "" ["smtp_code"]=> string(0) "" ["smtp_code_ex"]=> string(0) "" } ["helo_rply":protected]=> NULL ["server_caps":protected]=> NULL ["last_reply":protected]=> string(0) "" } ["to":protected]=> array(3) { [0]=> array(2) { [0]=> string(24) "[email protected]" [1]=> string(0) "" } [1]=> array(2) { [0]=> string(24) "[email protected]" [1]=> string(0) "" } [2]=> array(2) { [0]=> string(19) "[email protected]" [1]=> string(0) "" } } ["cc":protected]=> array(0) { } ["bcc":protected]=> array(0) { } ["ReplyTo":protected]=> array(0) { } ["all_recipients":protected]=> array(3) { ["[email protected]"]=> bool(true) ["[email protected]"]=> bool(true) ["[email protected]"]=> bool(true) } ["RecipientsQueue":protected]=> array(0) { } ["ReplyToQueue":protected]=> array(0) { } ["attachment":protected]=> array(0) { } ["CustomHeader":protected]=> array(0) { } ["lastMessageID":protected]=> string(66) "<[email protected]>" ["message_type":protected]=> string(5) "plain" ["boundary":protected]=> array(3) { [1]=> string(45) "b1_1D3roHBXMijlaDqSQ8QRR34j5epEwwfRBZcdWsQZgw" [2]=> string(45) "b2_1D3roHBXMijlaDqSQ8QRR34j5epEwwfRBZcdWsQZgw" [3]=> string(45) "b3_1D3roHBXMijlaDqSQ8QRR34j5epEwwfRBZcdWsQZgw" } ["language":protected]=> array(21) { ["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: " ["invalid_hostentry"]=> string(19) "Invalid hostentry: " ["invalid_host"]=> string(14) "Invalid host: " ["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(42) "1D3roHBXMijlaDqSQ8QRR34j5epEwwfRBZcdWsQZgw" } }

En regardant bien je retrouve bien les mails des inscrits ainsi que le sujet et le corps du mail.
Merci par avance pour vos pistes et votre aide.
@+ Filou

Avatar du membre
Mammouth du PHP | 1609 Messages

16 mars 2023, 13:19

Salut, d'après le message, phpmailer n'arrive pas à se connecter au serveur SMTP. Il y a donc à priori un problème à ce niveau (adresse du serveur, port, login, password ?).
Développeur web depuis + de 20 ans