resend-php icon indicating copy to clipboard operation
resend-php copied to clipboard

feat: Add a fluent interface

Open jayanratna opened this issue 2 years ago • 0 comments

To improve the development experience it might be handy to create a fluent interface to easily send emails:

use Resend\Email;

$resend = Resend::client('re_123456789');

$email = (new Email())
    ->to('...')
    ->from('...')
    ->subject('...')
    ->text('...');

if ($user->is_premium) {
    $email->html('...');
}

$resend->sendEmail($email);

jayanratna avatar Feb 02 '23 01:02 jayanratna