0

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 = "johnm010247@gmail.com";

$mail->Password = "xxxxxxxxxxxxxxxxxx";


$mail->SMTPSecure = 'ssl';

$mail->Port = 465;

$mail->Subject = "Test Email";

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

$mail->setFrom("johnm010247@gmail.com", "Robert");

$mail->addAddress("mothers@bcbc-church.org", "Mothers Board");

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

?>

I'm using PHPMailer 6.0

1 Answers1

0

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.

Synchro
  • 29,823
  • 14
  • 69
  • 85
  • Thanks, Synchro. I'm getting Mailer Error: SMTP Error: Could not authenticate. And SMTP ERROR: Password command failed: 534-5.7.14. – J. McCray Mar 17 '18 at 07:16
  • So your Id or password are wrong, or you need to set `SMTPDebug = 2` so you can see what the server is saying, just as the troubleshooting guide suggests. – Synchro Mar 17 '18 at 07:18