How to get PHPMailer to work without composer

Hi, i personally dont like composer and would rather not use it. I am trying to get the new version 6.10 PHPMailer to work without composer.

I discovered that when you get the instance you have to use

$mail = new PHPMailer\PHPMailer\PHPMailer(true);

But now it tells me that the class smtp is not found, so i checked the loaded classes and its not there.

How do i load the smtp class, here is the line its tripping up on

$mail->SMTPDebug = SMTP::DEBUG_SERVER;  

Thanks… :slight_smile:

Have you included the SMTP class file?

Hi yes, i have all three included

 require LOCAL_LIBRARIES.'PHPMailer/src/Exception.php';
 require LOCAL_LIBRARIES.'PHPMailer/src/PHPMailer.php';
 require LOCAL_LIBRARIES.'PHPMailer/src/SMTP.php';

I did finally find the issue, since i never use “use” i had no clude that it had to be at the very top of the file. When i tried to put that code in the email section of my code my editor gave me a syntax error. So i was like WTH. After some reading i found where it does say that those “use” lines of code MUST go at the very top of my php file. I never knew that… Once i moved them now it works just like the instructions say and now i can just call the instance like so

$mail = new PHPMailer(true);

When i ran it, it spat out a bunch of verbose results, so yeah its working now… Horayyyy i actually have been trying to get PHPMailer to work for years but never could so i gave up.

Seems we are limited on what we can use for SMTP authentication. I have heard that cPanel may be looking at developing something of their own to provide an inbox solution. I really hope they do it.

Honestly i am not so warm and fuzzy about PHPMailer now days, its been 60 days since their last release and they already have 45 issues, that is pretty sad.

Beggers cant be choosers and i know i cant complain too much when its free, but this issue has been an ongoing thing for many years and its about time the panel warlords in the industry come up with something inbox.

Anyway its working, sorry to be so long winded… :slight_smile: Thanks

1 Like

Hi, i figured it out and posted the solution, but this site blocked it for some reason, i waiting for an admin to approve the reply. :slight_smile:

1 Like

Post was marked spam somehow. It’s visible now :+1:

1 Like

Strange, thank you sir for fixing that. :slight_smile:

Now all i have to do is jump hurdles between PHPMailer and outlook to see if i can get a plain text email lol hee hee

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.