Having Incomprehensible problems with Nette/Mail/Message Please help

desupink
Member | 4
+
0
-

I am trying to set up Messaging so I can do some tests with “user registration” and “forgot password” but I'm getting an error I can't understand, ALSO for some reason Google is not my friend today.

I'm using PHP&MySQL for the fun stuff and will be using Apache when this all goes live.

I am currently using XAMPP for my environment on a Windows 10 PC


Now for the error ..

Fatal error: Uncaught Error: Class 'Nette\Mail\Message' not found in C:\xampp\htdocs\((project))\((file)).php:66 Stack trace: #0 {main} thrown in C:\xampp\htdocs\((project))\((file)).php on line 66

No idea why this is happening (from what I can tell it can't find the class?) ..

Yet at the top of the file along with all my other includes and require's I have:

use Nette\Mail\Message;

And this is the block of code I am trying to execute

$mail = new Message;
$mail->setFrom('<dummy@email.com>')
        ->addTo($makeEmails)
        ->setSubject($sub)
        ->setBody($body);

$mailer = new Nette\Mail\SmtpMailer([
    'host' => 'smtp.gmail.com',
    'username' => '((my gmail addy))',
    'password' => '((password))',
    'secure' => 'ssl',
    'context' =>  [
        'ssl' => [
            'capath' => '/path/to/my/trusted/ca/folder', //I left this as is and pretty sure it isn't causing the error
        ],
    ],
]);
$mailer->send($mail);

Any ideas ?

I'm desperate

Ondřej Kubíček
Member | 494
+
0
-

How are you loading the class Message ? standard way through the composer ?

desupink
Member | 4
+
0
-

Ondřej Kubíček wrote:

How are you loading the class Message ? standard way through the composer ?

Thanks so much for replying,

I used composer in my project folder..

CZechBoY
Member | 3608
+
+1
-

And did you required/included vendor/autoload.php?

Last edited by CZechBoY (2018-01-25 09:32)

desupink
Member | 4
+
0
-

CZechBoY wrote:

And did you required/included vendor/autoload.php?

JUST included autoload and now I am getting a new error. Please hold on so I can try and figure it out. I will be back to let you guys know what happened.

Thank you ♥

desupink
Member | 4
+
0
-

CZechBoY wrote:

And did you required/included vendor/autoload.php?

YOU ARE INCREDIBLE!!!

It gave me new errors that I fixed and now it's working perfectly! Thank you SO much for your help you really helped me BIG time.

Thanks CZechBoY ♥

CZechBoY
Member | 3608
+
+1
-

you are welcome :-)