PHPMailer doesn't work

I checked your code, and I think the issue is caused by an include loop.

In the code you shared, you have the line require ("PHPMailer.php");. However, I have checked this file “PHPMailer.php”, but that file also contains a script like what you’ve shared here.

Can you please make sure the file PHPMailer.php contains the actual PHPMailer library, and see if you can have another script which uses that library?