I trying to use Postmark for Laravel Mailbox for catch mails, but it returns a HTTP status code of 405 when using the below webhook url,
Inbound Webhook : https://laravel-mailbox:[email protected]/laravel-mailbox/postmark
If I add a "/" sign at the end of URL it returns a status code with 200. like below,
Inbound Webhook : https://laravel-mailbox:[email protected]/laravel-mailbox/postmark/
but it not catching any mails from Postmark.
Here is the my mailbox.php,
<?php
return [
/*
* The driver to use when listening for incoming emails.
* It defaults to the mail driver that you are using.
*
* Supported drivers: "log", "mailgun", "sendgrid", "postmark"
*/
'driver' => 'postmark',
/*
* The model class to use when converting an incoming email to a message.
* It must extend the default model class
*/
'model' => \BeyondCode\Mailbox\InboundEmail::class,
/*
* The path for driver specific routes. This is where
* you need to point your driver specific callbacks
* to.
*
* For example: /laravel-mailbox/sendgrid/
*/
'path' => 'laravel-mailbox/postmark/',
/*
* The amount of days that incoming emails should be stored in your
* application. You can use the cleanup artisan command to
* delete all older inbound emails on a regular basis.
* Set to INF to disable the cleanup artisan command.
*/
'store_incoming_emails_for_days' => 7,
/*
* By default, this package only stores incoming email messages
* when they match one of your mailboxes. To store all incoming
* messages, modify this value.
*/
'only_store_matching_emails' => true,
/*
* Some services do not have their own authentication methods to
* verify the incoming request. For these services, you need
* to use this username and password combination for HTTP
* basic authentication.
*
* See the driver specific documentation if it applies to your
* driver.
*/
'basic_auth' => [
'username' => 'laravel-mailbox',
'password' => 'testing',
],
/*
* Third party service configuration.
*/
'services' => [
'postmark' => [
'key' => '2d1cf750-050c-484f-857a-d819c4beafc5',
],
],
];
and the AppServiceProvider.php,
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Laravel\Cashier\Cashier;
use App\Models\Tenant;
use App\Models\MailboxInboundEmails;
use App\Models\Subscription;
use BeyondCode\Mailbox\InboundEmail;
use BeyondCode\Mailbox\Facades\Mailbox;
class AppServiceProvider extends ServiceProvider
{
public function register(): void
{
}
public function boot(): void
{
Cashier::useCustomerModel(Tenant::class);
Cashier::useSubscriptionModel(Subscription::class);
Mailbox::catchAll(static function(InboundEmail $email) {
// Handle the incoming email
Log::info('#-------------------------------------------------------------------------------------------#');
Log::info($email);
Log::info('#-------------------------------------------------------------------------------------------#');
});
}
}
Please help me with this code. Thank you.