Closed jhayg12 closed 2 years ago
Suggestions
composer dumpautoload
to resolve the class not foundIn AppServiceProvider.php
:
protected function setupMailboxCatchAll() : void
{
Mailbox::catchAll(static function (InboundEmail $email) {
$email->forward('you@your.domain');
});
}
Hi @colinmackinlay thanks for the reply and I've tried both of your suggestions but still getting the error:
Class 'BeyondCode\Mailbox\Facades\Mailbox' not found
Hi @colinmackinlay thanks for the reply and I've tried both of your suggestions but still getting the error:
Class 'BeyondCode\Mailbox\Facades\Mailbox' not found
That's all I do and it works fine for forwarding mail.
It does seem though as if the package is not registering.
What happens if you run php artisan package:discover --ansi
?
You should see Discovered Package: beyondcode/laravel-mailbox
in the output
@colinmackinlay the error is gone now I've tried to uninstall install the package and verify it using the php artisan package:discover --ansi
and it shows there but it seems the Mailbox facade is still not working as expected
I've tried to use it on web.php
Route::post('/laravel-mailbox/sendgrid', function () use ($router) {
\Log::info('Webhook arrives');
Mailbox::from(config('mail.from.address'), function (InboundEmail $email) {
// Handle the incoming email
\Log::info(['id' => $email->id]);
\Log::info(['subject' => $email->subject]);
\Log::info(['message' => $email->message]);
});
});
and in AppServiceProvider.php
boot method
Mailbox::from(config('mail.from.address'), function (InboundEmail $email) {
// Handle the incoming email
\Log::info(['id' => $email->id]);
\Log::info(['subject' => $email->subject]);
\Log::info(['message' => $email->message]);
});
and
protected function setupMailboxCatchAll() : void
{
Mailbox::catchAll(static function (InboundEmail $email) {
$email->forward('test@mailinator.com');
});
}
But I did not receive any logs or forwarded emails.
I was trying to implement the laravel-mailbox on our project but got this error saying:
Class 'BeyondCode\Mailbox\Facades\Mailbox' not found
I've used something like this on the
web.php
file: