You need to bind your own implementation of Laravel\Fortify\Contracts\VerifyEmailViewResponse in the FortifyServiceProvider class.
# app/Providers/FortifyServiceProvider.php
namespace App\Providers;
use App\Actions\Fortify\YourClassHere;
use Laravel\Fortify\Contracts\VerifyEmailViewResponse;
class FortifyServiceProvider extends ServiceProvider
{
public function boot()
{
app()->singleton(VerifyEmailViewResponse::class, YourClassHere::class);
}
}
# app/Actions/Fortify/YourClassHere.php
namespace App\Actions\Fortify;
use Laravel\Fortify\Contracts\VerifyEmailViewResponse;
class YourClassHere extends VerifyEmailResponse
{
public function toResponse($request)
{
// your logic here.
// since mailjet uses an api, perhaps return the response of a curl call,
// or a response form Http::get(...)
// or use a third-party package like laravel-mailjet (https://mailjet.github.io/laravel-mailjet/)
}
}
The logic that sends the verification email is part of the Illuminate\Auth\MustVerifyEmail trait. If you want to change it, you need to override it in your User model.
class User extends Authenticatable
{
/**
* Send the email verification notification.
*
* @return void
*/
public function sendEmailVerificationNotification()
{
// your logic here.
}
}