username: epiz_29328120
Website with the issue: stepsfordancing.com
In the register section, when submitting some information, Chrome gives me:
Full name is:
Email address is:
Phone number is:
How did you hear about this workshop is:
How many months are you signing for is: twomonths
Error while sending Email.object(PHPMailer\PHPMailer\PHPMailer)#1 (74) { ["Priority"]=> NULL ["CharSet"]=> string(10) "iso-8859-1" ["ContentType"]=> string(21) "multipart/alternative" ["Encoding"]=> string(4) "8bit" ["ErrorInfo"]=> string(82) "SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting" ["From"]=> string(25) "[email protected]" ["FromName"]=> string(11) "DOLLY GOYAL" ["Sender"]=> string(25) "[email protected]" ["Subject"]=> string(28) "New Registration on Website!" ["Body"]=> string(159) "Full name is:
Email address is:
Phone number is:
How did you hear about this workshop is:
How many months are you signing for is: twomonths
" ["AltBody"]=> string(139) "Full name is: Email address is: Phone number is: How did you hear about this workshop is: How many months are you signing for is: twomonths" ["Ical"]=> string(0) "" ["MIMEBody":protected]=> string(593) "This is a multi-part message in MIME format. --b1_K07J7tOjPUKOKRrfqWQpBHGpiBrj5cNrME8wlPFPU Content-Type: text/plain; charset=us-ascii Full name is: Email address is: Phone number is: How did you hear about this workshop is: How many months are you signing for is: twomonths --b1_K07J7tOjPUKOKRrfqWQpBHGpiBrj5cNrME8wlPFPU Content-Type: text/html; charset=us-ascii Full name is:
Email address is:
Phone number is:
How did you hear about this workshop is:
How many months are you signing for is: twomonths
--b1_K07J7tOjPUKOKRrfqWQpBHGpiBrj5cNrME8wlPFPU-- " ["MIMEHeader":protected]=> string(517) "Date: Wed, 4 Aug 2021 23:10:56 -0400 To: DOLLY GOYAL From: DOLLY GOYAL Reply-To: DOLLY GOYAL Subject: New Registration on Website! Message-ID: X-Mailer: PHPMailer 6.5.0 (https://github.com/PHPMailer/PHPMailer) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="b1_K07J7tOjPUKOKRrfqWQpBHGpiBrj5cNrME8wlPFPU" Content-Transfer-Encoding: 8bit " ["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(14) "smtp.gmail.com" ["Port"]=> int(587) ["Helo"]=> string(0) "" ["SMTPSecure"]=> string(3) "tls" ["SMTPAutoTLS"]=> bool(true) ["SMTPAuth"]=> bool(true) ["SMTPOptions"]=> array(0) { } ["Username"]=> string(24) "[email protected]" ["Password"]=> string(13) "SoumilDhruv21" ["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)#2 (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]=> NULL ["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(56) "221 2.0.0 closing connection n8sm7166174wms.11 - gsmtp " } ["to":protected]=> array(1) { [0]=> array(2) { [0]=> string(25) "[email protected]" [1]=> string(11) "DOLLY GOYAL" } } ["cc":protected]=> array(0) { } ["bcc":protected]=> array(0) { } ["ReplyTo":protected]=> array(1) { ["[email protected]"]=> array(2) { [0]=> string(25) "[email protected]" [1]=> string(11) "DOLLY GOYAL" } } ["all_recipients":protected]=> array(1) { ["[email protected]"]=> bool(true) } ["RecipientsQueue":protected]=> array(0) { } ["ReplyToQueue":protected]=> array(0) { } ["attachment":protected]=> array(0) { } ["CustomHeader":protected]=> array(0) { } ["lastMessageID":protected]=> string(67) "" ["message_type":protected]=> string(3) "alt" ["boundary":protected]=> array(3) { [1]=> string(44) "b1_K07J7tOjPUKOKRrfqWQpBHGpiBrj5cNrME8wlPFPU" [2]=> string(44) "b2_K07J7tOjPUKOKRrfqWQpBHGpiBrj5cNrME8wlPFPU" [3]=> string(44) "b3_K07J7tOjPUKOKRrfqWQpBHGpiBrj5cNrME8wlPFPU" } ["language":protected]=> array(26) { ["authenticate"]=> string(35) "SMTP Error: Could not authenticate." ["buggy_php"]=> string(250) "Your version of PHP is affected by a bug that may result in corrupted messages. To fix it, switch to sending using SMTP, disable the mail.add_x_header option in your php.ini, switch to MacOS or Linux, or upgrade your PHP to version 7.0.17+ or 7.1.3+." ["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: " ["extension_missing"]=> string(19) "Extension missing: " ["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_header"]=> string(28) "Invalid header name or value" ["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_code"]=> string(11) "SMTP code: " ["smtp_code_ex"]=> string(22) "Additional SMTP info: " ["smtp_connect_failed"]=> string(22) "SMTP connect() failed." ["smtp_detail"]=> string(8) "Detail: " ["smtp_error"]=> string(19) "SMTP server error: " ["variable_set"]=> string(30) "Cannot set or reset variable: " } ["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(41) "K07J7tOjPUKOKRrfqWQpBHGpiBrj5cNrME8wlPFPU" }
My PHP is:
<?php use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; require 'PHPMailer-master/PHPMailer-master/src/Exception.php'; require 'PHPMailer-master/PHPMailer-master/src/PHPMailer.php'; require 'PHPMailer-master/PHPMailer-master/src/SMTP.php'; $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPDebug = 0; $mail->SMTPAuth = TRUE; $mail->SMTPSecure = "tls"; $mail->Port = 587; $mail->Host = "smtp.gmail.com"; $mail->Username = "**********"; $mail->Password = "*********"; $mail->IsHTML(true); $mail->AddAddress("[email protected]", "DOLLY GOYAL"); $mail->SetFrom("[email protected]", "DOLLY GOYAL"); $mail->AddReplyTo("[email protected]", "DOLLY GOYAL"); $mail->Subject = "New Registration on Website!"; if (isset($_POST['submit'])) { $name = $_POST["name"]; $email = $_POST["email"]; $phonenumber = $_POST["phonenumber"]; $howdidyouhear = $_POST["howdidyouhear"]; $howmanymonths = $_POST["howmanymonths"]; $finalmessage = ""; $allanswers = array( "Full name" => $name, "Email address" => $email, "Phone number" => $phonenumber, "How did you hear about this workshop" => $howdidyouhear, "How many months are you signing for" => $howmanymonths,); foreach ($allanswers as $x => $value) { $finalmessage = $finalmessage . "$x is: $value"; } echo "$finalmessage"; } $content = "$finalmessage"; $mail->MsgHTML($content); if(!$mail->Send()) { echo "Error while sending Email."; var_dump($mail); } else { echo "Email sent successfully"; } header("location: index.html") ?>
This code is sending emails perfectly in localhost, it gives the above error on the website. I have the latest PHP mailer, and my information (username and password) are censored here, but are correct. May I please know the way to solve this issue so that I can send emails in my website like I am able to in localhost? Thank you!