Qoraiche / laravel-mail-editor

MailEclipse :zap: Laravel Mail Editor
Other
2.08k stars 254 forks source link

No hint path defined for [maileclipse] #105

Closed maxhacker11 closed 3 years ago

maxhacker11 commented 3 years ago

Describe the bug Everything works fine on my local computer, but on the server, when I try to send emails I get this error:

No hint path defined for [maileclipse]

This is how the code looks where I call this:

$user->notify(new NotifyInactiveUser());

So it triggers a notification, which does this:

public function toMail($notifiable)
{
        return new \App\Mail\InactiveUserEmail($notifiable->name);
}

Then we have the InactiveUserEmail which has a constructor and does this in the build function:

return $this->markdown('maileclipse::templates.inactiveUser');

To Reproduce

  1. Add mail eclipse to your project
  2. Create templates and mailables localy
  3. Commit to github
  4. Pull on server
  5. Try to send emails

Laravel Application: 7.25.0

Maileclipse package version: ^2.0

ReeceM commented 3 years ago

Hi @maxhacker11, sorry for the late response.

I just want to check a few things, in your composer file, is MailEclipse under require-dev? If so, this means that if you did a composer install to exclude the development packages, it won't be on the server.

The reason also for that is because of the fact that maileclipse:: is a view hint path that is defined by the package, so if the package isn't in the vendor file then it isn't there.

Please could you check these and let us know?

Many thanks Reece

maxhacker11 commented 3 years ago

I just checked both on the server and on the local setup, in both places it is included under require in composer.json

I also did a composer --installed on the server and it listed out laravel-mail-editor, which is maileclipse as far as I know, so it should be installed.

I can access the admin panel, edit templates and everything on the server, I just can't seem to send emails :/

I also looked at the vendor folder, under quoraiche and it seems like all the files are there.

Any ideas what this could be?

ReeceM commented 3 years ago

Hi, okay, so not sure why that is happening.

What I will do is spin up a setup with the maileclipse and laravel version the same as yours and see if I can reproduce it.

Just as a confirmation, the error is coming from the mailable that you have created?

maxhacker11 commented 3 years ago

Hey! Thanks for replying fast! The error occurs once I try to send an email that I have created with mail eclipse :/ I am also using laravel deployer package in order to push to the server, but I don't think that causes problems.

ReeceM commented 3 years ago

I don't believe the deployer package would be causing issues, all the directories are usually symbolically linked and that is would still let everything function normally.

ReeceM commented 3 years ago

Hi @maxhacker11,

With regards the hint path not being found, when pulling to the server from git, do you have something that looks like the following in the terminal:

Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: fruitcake/laravel-cors
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Discovered Package: qoraiche/laravel-mail-editor

Note the last line ^

The hint path comes from the service provider, so it may not be autoloaded into the composer classmap.

What you could do is add the line below into config/app.php

        /*
         * Package Service Providers...
         */
        qoraiche\mailEclipse\mailEclipseServiceProvider::class,
maxhacker11 commented 3 years ago

Hello!:D Thanks for taking the time to help out:) I added the line you suggested in config/app.php, however it didn't fix the problem.

I double checked my setup. The laravel deployer package changes the structure of the project a bit. It moves everything inside the "current" folder, which holds the current release.

Since I created an artisan command that calls the above mentioned logic of sending emails - it turns out I was using these commands outside the "current" folder, so in an older version of the project. Once I cd into "current" and run the commands there, it works perfectly, almost, but that's not a problem with this package ;)

So for me the solution was to run my artisan command inside the "current" folder.

Thanks for the help, and sorry it turned out to be a dumb solution! Regards, Maksim

ReeceM commented 3 years ago

Hi @maxhacker11,

Really glad you were able to sort it (:

I use deployer and usually you have to be in the current folder to be able to run artisan commands and from there all things should work.

Not sure your setup, but usually, you would have all the app/* stuff set and then vendor and storage are symlinked, but being symlinked should still give the same results.

If there is something specific related to the package or if you have clearer idea of what a solution is, please post it here 👍

Kind Regards, Reece