Send Transactional Email from your PHP Applications

Andrea Pollastri
2 min readFeb 20, 2024

Transactional emails are automated emails sent from one sender to one recipient, usually related to account notifications or activity or a commercial transaction.

If you need to send emails from your PHP application, you have to be sure that users will receive them so you should use an authenticated SMTP on a fully trusted domain within a high daily send limit service. Maybe you would also track when your users receive and when they open your messages.

For several years I have used Sendgrid (https://sendgrid.com) but recently I discovered “Resend” (https://resend.com). The slogan on the home page of Resend Website is “The best way to reach humans instead of spam folders. Deliver transactional and marketing emails at scale.” They keep their promise with a simple dashboard, easy to configure, and with out-of-the-box SDK packages to integrate their service into any application.

There are FREE and PRO plans, in the pro plan, you can increment the amount of monthly emails to send, remove the daily limit, and use multiple domains.

To try out it you have to:

  • Sign Up for a free plan
  • Add your domain to the “Domains” dashboard and set DNS into your provider
  • Generate an API Key into the “API Key” dashboard
  • Install an SDK into your application (https://resend.com/docs/sdks)

Now you are ready to send transactional emails like a Pro!

These are two steps for a simple integration via PHP:

Step 1 — SDK installation

composer require resend/resend-php

Step 2 — Code Integration

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

$resend->emails->send([
'from' => 'My Application <noreply@myapplication.ltd>',
'to' => ['john.doe@myusers.ltd'],
'subject' => 'This is a Test!',
'html' => 'This is a simple test, and <strong>it works!</strong>',
]);

I hope this will be useful for you and your business or hobby projects!

--

--