0
votes

I've been here since 9:15 AM DETERMINED to find others with the same problem I have. 95% of these PHPMailer look a lot like mine. The main difference is "MINE DOES NOT WORK!!" Please guys, take a "close"look at what I have and tell me where did I go wrong. (My coding below):

<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'vendor/autoload.php';

$mail = new PHPMailer();

$mail->HOST = "smtp.gmail.com";

$mail->isSMTP();

$mail->SMTPAuth = true;

$mail->Username = "[email protected]";

$mail->Password = "xxxxxxxxxxxxxxxxxx";


$mail->SMTPSecure = 'ssl';

$mail->Port = 465;

$mail->Subject = "Test Email";

$mail->Body = "This Is Our Body.....";

$mail->setFrom("[email protected]", "Robert");

$mail->addAddress("[email protected]", "Mothers Board");

if ($mail->send())
  echo "Mail sent";

?>

I'm using PHPMailer 6.0

1

1 Answers

0
votes

PHP is case sensitive for property and variable names.

$mail->HOST = "smtp.gmail.com";

Should be

$mail->Host = "smtp.gmail.com";

It would help if you based your code on the examples provided, since they do not contain basic errors like this.

Aside from that, when posting a question, you need to specify what the problem is; “it doesn’t work” is not enough.