Skip to main content

PHP Quickstart

Learn how to send your first email using Lettr with PHP.

Prerequisites

  • PHP 8.1 or higher
  • Composer installed
  • A Lettr API key

Installation

Install the Lettr PHP SDK via Composer:
composer require lettr/lettr-php

Send Your First Email

<?php

require 'vendor/autoload.php';

use Lettr\Lettr;

$lettr = new Lettr('your-api-key');

$lettr->emails->send([
    'from' => 'you@example.com',
    'to' => ['recipient@example.com'],
    'subject' => 'Hello from Lettr',
    'html' => '<p>Welcome to Lettr!</p>'
]);

Next Steps