PHP code example of maantje / react-email
1. Go to this page and download the library: Download maantje/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/ */
maantje / react-email example snippets
use App\Models\User;
use Maantje\ReactEmail\ReactMailable;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Mail\Mailables\Content;
use Maantje\ReactEmail\ReactMailView;
class NewUser extends ReactMailable // Extend, from \Maantje\ReactEmail\ReactMailable
{
use ReactMailView; // or use \Maantje\ReactEmail\ReactMailView
public function __construct(public User $user)
{
// Public properties will be passed as props to the React email component.
// Alternatively, use the `with` property of `content`.
}
public function envelope()
{
return new Envelope(
subject: 'New User',
);
}
public function content()
{
return new Content(
view: 'new-user', // Component filename without the extension
);
}
}
bash
php artisan make:mail NewUser