• Reading time ~ 1 min
  • 15.06.2023

Resend for Laravel is a package that provides Resend API integration with mailers. This API is designed to be developer-friendly, making it easy to develop and send emails effortlessly.

Here's the most basic example of how easy it is to send an email directly with the Resend API:

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

$resend->emails->send([
  'from' => '[email protected]',
  'to' => '[email protected]',
  'subject' => 'hello world',
  'html' => '<strong>it works!</strong>',
]);

The Laravel version has a facade you can use to email directly with the API, or you can integrate it as a mailer:

// Using the API
Resend::email()->send([
    'from' => '[email protected]',
    'to' => $request->user()->email,
    'subject' => 'hello world',
    'html' => (new OrderShipped($order))->render(),
]);
// Via the Mail facade
Mail::to($request->user())->send(new OrderShipped($order));

If you'd like to see more examples, there is a example repo for Laravel and a vanilla PHP example. The official docs have everything you need to set up Resend in Laravel along with the API reference docs.

Comments

No comments yet
Yurij Finiv

Yurij Finiv

Full stack

ABOUT

Professional Fullstack Developer with extensive experience in website and desktop application development. Proficient in a wide range of tools and technologies, including Bootstrap, Tailwind, HTML5, CSS3, PUG, JavaScript, Alpine.js, jQuery, PHP, MODX, and Node.js. Skilled in website development using Symfony, MODX, and Laravel. Experience: Contributed to the development and translation of MODX3 i...

About author CrazyBoy49z
WORK EXPERIENCE
Contact
Ukraine, Lutsk
+380979856297