PHP Build a Basic PHP Website (2018) Adding a Basic Form Using A Third-Party Library

Joshua Bowden
Joshua Bowden
Full Stack JavaScript Techdegree Graduate 29,312 Points

I can't find the class.phpmailer.php file on github

I can't find the class.phpmailer.php file on github can someone link it?

5 Answers

Joshua Bowden
Joshua Bowden
Full Stack JavaScript Techdegree Graduate 29,312 Points

I am not sure the lesson says to include the file class.phpmailer.php which I can't find there.

Matt Brock
Matt Brock
28,305 Points

You could create a new file called class.phpmailer.php and just copy/paste the contents from that Github page. It looks like the maintainers have re-organized the Github repo a bit.

Matt Brock
Matt Brock
28,305 Points

Yep... in her video, the current PHPmailer version is 5.2.14, which was released Nov. 2, 2015.

Dave StSomeWhere
Dave StSomeWhere
19,805 Points

Yep, the new version doesn't have that class individually for download. The instructions show how to do it that way, but I chose to adjust and use the new version following the recommended install via composer locally. It was straight forward and also added in using the gmail SMTP server to actually send mail (was in the examples). Just let me know if you want any details.

ilanaguttman
ilanaguttman
2,700 Points

I'm having the same problem. Not following the solution.

Looks like there was a massive update on the PHPMailer. I hope this will help you. I had to read the docs on GitHub to figure it out. Some tinkering around, finally got it.

Rather than one file, you actually will need two files added into your inc/phpmailer folder (1) Exception.php (2) PHPMailer.php

Next, in your suggest.php file, at the top write after the first line <?php you'll need to include:

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

Then, in where our instructor, Alena, says to include the require, there's two lines of code needed:

require 'inc/phpmailer/Exception.php'; require 'inc/phpmailer/PHPMailer.php';

The last difference is the following:

$mail = new PHPMailer(true);

The if-statement for ValidateAddress is still the same as instructed.