• Czas czytania ~1 min
  • 15.06.2023

Resend for Laravel to pakiet, który zapewnia integrację Resend API z mailerami. Ten interfejs API został zaprojektowany tak, aby był przyjazny dla programistów, co ułatwia tworzenie i wysyłanie wiadomości e-mail bez wysiłku.

Oto najbardziej podstawowy przykład tego, jak łatwo jest wysłać wiadomość e-mail bezpośrednio za pomocą interfejsu API ponownego wysyłania:Wersja Laravel ma fasadę, której można użyć do wysłania wiadomości e-mail bezpośrednio za pomocą interfejsu API, lub można ją zintegrować jako mailer:

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

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

// 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));

Jeśli chcesz zobaczyć więcej przykładów, istnieje przykładowe repozytorium dla Laravel i przykład waniliowy PHP. Oficjalne dokumenty mają wszystko, czego potrzebujesz, aby skonfigurować Resend w Laravel wraz z dokumentami referencyjnymi API.

Comments

No comments yet
Yurij Finiv

Yurij Finiv

Full stack

O

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...

O autorze CrazyBoy49z
WORK EXPERIENCE
Kontakt
Ukraine, Lutsk
+380979856297