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

    • Pocket from Mozilla is closing shop. Don’t lose your favorites . Move them to Zoho Mail Bookmarks now! 📥🔖

      The end of Pocket shouldn't mean the end of your important links and content. Easily import them into Zoho Mail's Bookmarks and continue right where you left off. You can bring over your entire Saves, Collections, and tags just the way they are. Bookmarks
    • 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
    • Workplace - Zoholics Europe Customer Awards

      Dear Zoho Mail Community! 📣 We're excited to announce that at this year's Zoholics events across Europe, we're holding customer awards for the first time ever! Workplace - Zoholics Europe Customer Awards This is your chance to shout about the amazing
    • 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