PHPMailer authentication error

PHPMailer authentication error

Hello,

I'm setting up PHP Mailer to send emails from my website's form,  but I'm receiving an authentication error.
I also tried creating an APP password for this account, but still not working.

The username /password are the same used to login into my dashboard.

Here is the code I'm using:
    $mail->isSMTP();
    $mail->Host = 'smtppro.zoho.com';
    $mail->SMTPSecure = 'ssl';
    $mail->Port='465';  
    $mail->SMTPAuth=true;
    $mail->Username="myusername@domain.com";
    $mail->Password="##REMOVED##"; //APP Password
    $mail->SMTPOptions = array('ssl' => array('verify_peer' => false,'verify_peer_name' => false,'allow_self_signed' => true));
    $mail->setFrom('contact@mywebsite.com', 'My Name);
    $mail->addAddress("customeremail@email.com", "Cust Name");     // Add a recipient

    $mail->isHTML(true); 
    $mail->Subject = "Website Form";
    $mail->Body    = "Message goes here...";
    $mail->AltBody = 'You need a HTML email client to see this message';
    $mail->send();

And this is the log:

2023-12-21 18:13:28 Connection: opened

2023-12-21 18:13:28 SMTP INBOUND: "220-mi3-ss120.a2hosting.com ESMTP Exim 4.96.2 #2 Thu, 21 Dec 2023 13:13:28 -0500"

2023-12-21 18:13:28 SMTP INBOUND: "220-We do not authorize the use of this system to transport unsolicited,"

2023-12-21 18:13:28 SMTP INBOUND: "220 and/or bulk e-mail."

2023-12-21 18:13:28 SERVER -> CLIENT: 220-mi3-ss120.a2hosting.com ESMTP Exim 4.96.2 #2 Thu, 21 Dec 2023 13:13:28 -0500 

                                     220-We do not authorize the use of this system to transport unsolicited, 

                                     220 and/or bulk e-mail.

2023-12-21 18:13:28 CLIENT -> SERVER: EHLO mi3-ss120.a2hosting.com

2023-12-21 18:13:28 SMTP INBOUND: "250-mi3-ss120.a2hosting.com Hello mi3-ss120.a2hosting.com [66.198.240.49]"

2023-12-21 18:13:28 SMTP INBOUND: "250-SIZE 78643200"

2023-12-21 18:13:28 SMTP INBOUND: "250-8BITMIME"

2023-12-21 18:13:28 SMTP INBOUND: "250-PIPELINING"

2023-12-21 18:13:28 SMTP INBOUND: "250-PIPECONNECT"

2023-12-21 18:13:28 SMTP INBOUND: "250-AUTH PLAIN LOGIN"

2023-12-21 18:13:28 SMTP INBOUND: "250 HELP"

2023-12-21 18:13:28 SERVER -> CLIENT: 250-mi3-ss120.a2hosting.com Hello mi3-ss120.a2hosting.com [66.198.240.49]

                                     250-SIZE 78643200

                                     250-8BITMIME

                                     250-PIPELINING

                                     250-PIPECONNECT

                                     250-AUTH PLAIN LOGIN

                                     250 HELP

2023-12-21 18:13:28 Auth method requested: UNSPECIFIED

2023-12-21 18:13:28 Auth methods available on the server: PLAIN,LOGIN

2023-12-21 18:13:28 Requested auth method not available:

2023-12-21 18:13:28 Auth method selected: LOGIN

2023-12-21 18:13:28 CLIENT -> SERVER: AUTH LOGIN

2023-12-21 18:13:28 SMTP INBOUND: "334 VXNlcm5hbWU6"

2023-12-21 18:13:28 SERVER -> CLIENT: 334 VXNlcm5hbWU6

2023-12-21 18:13:28 CLIENT -> SERVER: c29zQHRoZXJhaWRzcGVjaWFsaXN0LmNvbQ==

2023-12-21 18:13:28 SMTP INBOUND: "334 UGFzc3dvcmQ6"

2023-12-21 18:13:28 SERVER -> CLIENT: 334 UGFzc3dvcmQ6

2023-12-21 18:13:28 CLIENT -> SERVER: OVkwUHVTSlpXbWFD

2023-12-21 18:13:30 SMTP INBOUND: "535 Incorrect authentication data"

2023-12-21 18:13:30 SERVER -> CLIENT: 535 Incorrect authentication data

2023-12-21 18:13:30 SMTP ERROR: Password command failed: 535 Incorrect authentication data

2023-12-21 18:13:30 SMTP Error: Could not authenticate.

2023-12-21 18:13:30 CLIENT -> SERVER: QUIT

2023-12-21 18:13:30 SMTP INBOUND: "221 mi3-ss120.a2hosting.com closing connection"

2023-12-21 18:13:30 SERVER -> CLIENT: 221 mi3-ss120.a2hosting.com closing connection

2023-12-21 18:13:30 Connection: closed

2023-12-21 18:13:30 SMTP Error: Could not authenticate.


Any idea on what is going on?

      • Sticky Posts

      • Zoho Mail POP & IMAP Server Details

        Hello all! We have been receiving a number of requests regarding the errors while configuring or using Zoho Mail account in POP/ IMAP clients. The server details vary based on your account type and the Datacenter in which your account is setup. Ensure
      • Important update on Group Management | Zoho Mail

        Dear Zoho Mail Community, This post is to inform you all of the following updates on the Group Management in Zoho Mail. Group Member Addition: If a group member is added to an organization group in a Zoho Application, the member will be automatically
      • Mastering email etiquette and best practices to follow in Zoho Mail

        Hello Zoho Mail Community, We’re thrilled to invite you all to our upcoming webinar: Mastering email etiquette and best practices to follow in Zoho Mail. Join our live webinar for expert etiquette tips to enhance your professionalism and elevate your
      • 📣 📣 ZUG Meetups India - Explore Hybrid Workspaces using Zoho Workplace - Meet and Learn! 🧑🏽‍💻🧑🏽‍💻

        We are excited to announce the User Community initiative to meet you all in person and help you explore the need of the hour - Hybrid Workspaces using Zoho Workplace. We aim to help you to setup your Digital Workplace effectively so that your employees
      • Announcing Zoho Mail - Inactive user Policy

        Dear Zoho Mail users, Thanks to all of you for your continuous support.  We have recently started implementing the Inactive User Policy, for Zoho Mail.  A user is considered as inactive, if the user has not logged in to the Zoho mail account for a period of more than 120 days. The login through POP, IMAP and Active Sync are all taken into account for tracking the period of inactivity.  Whoever received the communication need not panic, as we have just communicated our policy to all the users.  To