Send an email with Thinwrap (PHP)
Send transactional email via the Thinwrap unified Email facade in PHP — same call shape for SendGrid, AWS SES, Resend, and every other supported provider.
1. Install
composer require thinwrap/notifications2. Send the call
use Thinwrap\Notifications\Email;
use Thinwrap\Notifications\Enum\NotificationProviderId;
use Thinwrap\Notifications\Providers\Sendgrid\SendgridConfig;
use Thinwrap\Notifications\DTO\Email\EmailSendInput;
$email = new Email(
NotificationProviderId::Sendgrid,
new SendgridConfig(
apiKey: getenv('SENDGRID_API_KEY'),
from: 'noreply@example.com',
),
);
$result = $email->send(new EmailSendInput(
from: 'noreply@example.com',
to: 'user@example.com',
subject: 'Hello from Thinwrap',
text: 'Hello world',
));
// $result->status is one of 'sent' | 'queued' | 'rejected' | 'suppressed' | 'unknown'
echo $result->status, ' ', $result->providerMessageId ?? '(no id)', PHP_EOL;
Same code works for all supported providers — just change the provider ID.