PHP code example of mscode-pl / laravel-react-email
1. Go to this page and download the library: Download mscode-pl/laravel-react-email library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mscode-pl / laravel-react-email example snippets
use MsCodePL\LaravelReactEmail\ReactMailable;
use Illuminate\Mail\Mailables\{Content, Envelope};
class WelcomeEmail extends ReactMailable
{
public function __construct(
public string $userName,
public string $activationUrl,
) {}
public function envelope(): Envelope
{
return new Envelope(subject: 'Welcome!');
}
public function content(): Content
{
return new Content(
html: 'react-email.welcome-email',
text: 'react-email.welcome-email-text',
);
}
}
Mail::to($user)->send(
new WelcomeEmail(
userName: $user->name,
activationUrl: route('activate', $user->activation_token),
)
);