KKL Michael
KKL Michael

Reputation: 795

PHPMailer library

I am first time to use the PHPMailer.

(A)

require_once "./PHPMailerAutoload.php";
...

(B)

require_once "./class.phpmailer.php";
...

What is the differences between them? I see some page was used A, some page was used B. Are they perform the same thing?

Upvotes: 0

Views: 259

Answers (2)

Trung Bui
Trung Bui

Reputation: 180

There's nothing different between two ways using phpmailer. But from PHPMailer version 5.2.7, it's recommended that you use PHPMailerAutoload to include PHPMailer.

Upvotes: 0

Alex Tartan
Alex Tartan

Reputation: 6826

If you check the source code of PHPMailerAutoload.php, you'll see it sets up the autoloader via spl_autoload_register();

The second option lets you include the class manually

For an extended usage of a package it is recommended to use the autoloader, as you might need to instantiate other classes in that package and it would avoid the need to manually require_once every file, one-by-one.

Upvotes: 2

Related Questions