Use Zoho account with phpmailer

Use Zoho account with phpmailer

Hello everyone.

I am using phpmailer to send emails.
In Gmail it works for me, but in Zoho I give me mistakes.
In Zoho, I have activated 2 step authentication and created an app, as well as Hize in Gmail.

Thanks in advance.

The code I use for Gmail is the following ...


*********************************************

<?php

echo 'PHP_Mailer';

require 'PHPMailer-6.9.3/PHPMailer-6.9.3/src/PHPMailer.php';
require 'PHPMailer-6.9.3/PHPMailer-6.9.3/src/SMTP.php';
require 'PHPMailer-6.9.3/PHPMailer-6.9.3/src/Exception.php';

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
// I see that in Zoho there are smtp.zoho.com, smtp.zoho.eu, and the same but smtppro.zoho

$mail->SMTPAuth = true;

$mail->Username = 'sender@gmail.com';
// Here, I don't know if I have to put the email with which I register in Zoho, or an email that points to my domain ( contact@domain.es )


$mail->Password = 'password';
// 16 characters generated by the app ( I see that Zoho creates a 12 characters code )

$mail->SMTPSecure = 'tls';
$mail->Port = 587;

$mail->setFrom('sender@gmail.com', 'Sender Name');
$mail->addAddress('recipient@gmail.com', 'Recipient Name');
// Here, I use a second Gmail account, which I have to test.

$mail->isHTML(true);
$mail->Subject = 'Subject Text';
$mail->Body = 'Body Text';


if (!$mail->send()) {
echo 'Error: ' . $mail->ErrorInfo;
} else {
echo 'Email sent successfully!';
}

?>
    • 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