PHP code example of stechstudio / laravel-helo-email

1. Go to this page and download the library: Download stechstudio/laravel-helo-email library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

stechstudio / laravel-helo-email example snippets


'helo-newsletter' => [
    'transport' => 'helo',
    'key' => env('HELO_NEWSLETTER_API_KEY'),
    'channel_id' => env('HELO_NEWSLETTER_CHANNEL_ID'),
    'mail_type' => 'broadcast',
],

Mail::mailer('helo-newsletter')->to($user)->send(new Newsletter);

(new OrderShipped($order))->tag('receipt')->metadata('order_id', $order->id);

$this->withSymfonyMessage(function (Email $message) {
    $message->getHeaders()->addTextHeader('X-Helo-TrackOpens', 'true');
    $message->getHeaders()->addTextHeader('X-Helo-TrackLinks', 'false');
});

use STS\HeloEmail\HeloResult;

$sent = Mail::to($user)->send(new Welcome);
$result = HeloResult::from($sent); // null if the mail didn't go through Helo

$result->messageId;
$result->status;       // "accepted" or "delayed"
$result->suppressions; // ["[email protected]"]

use STS\HeloEmail\Facades\Helo;

// Send
Helo::send()->transactional([
    'from' => ['email' => '[email protected]'],
    'to' => [['email' => '[email protected]']],
    'subject' => 'Hi',
    'html' => '<p>Hi</p>',
], idempotencyKey: 'welcome-42');
Helo::send()->broadcastMessage($message);
Helo::send()->transactionalBatch([$first, $second]);
Helo::send()->broadcast($broadcast);

// Suppressions: one list per channel and mail type
Helo::suppressions()->list(mailType: 'broadcast', reason: 'bounce');
Helo::suppressions()->add(['[email protected]'], mailType: 'broadcast');
Helo::suppressions()->remove(['[email protected]']);

// Webhooks
$webhook = Helo::webhooks()->create('https://app.example/webhooks/helo', ['email-delivered', 'email-bounced']);
$webhook->payloadSigningKey;
Helo::webhooks()->list();
Helo::webhooks()->update($id, ['enabled' => false]);
Helo::webhooks()->regenerateSigningKey($id);
Helo::webhooks()->delete($id);

// Channels
Helo::channels()->create('ABC Construction', trackOpens: true);
Helo::channels()->list(name: 'ABC');
Helo::channels()->update($id, ['name' => 'ABC Builders']);

// Domains
Helo::domains()->create('mail.example.com', channelIds: [$channelId]);
$check = Helo::domains()->verify($id);
$check->domainKeyActive['status'];
Helo::domains()->rotateKey($id);

// Activity
Helo::activity()->events(recipient: '[email protected]', eventTypes: ['email-bounced']);
Helo::activity()->messages(status: 'sent', tags: ['receipt']);
Helo::activity()->message($messageId)->events;

// Broadcasts
Helo::broadcasts()->list(status: 'completed');
Helo::broadcasts()->failures($broadcastId);
Helo::broadcasts()->suppressions($broadcastId);

// Statistics
Helo::statistics()->daily('2026-10-01', '2026-10-31', timezone: 'America/New_York');
Helo::statistics()->hourly(now()->subDay(), now());
Helo::statistics()->totals(now()->startOfMonth(), now());

foreach (Helo::suppressions()->list(mailType: 'broadcast')->lazy() as $suppression) {
    $suppression->email;
}

Helo::forChannel($tenant->helo_channel_id, $tenant->helo_api_key)->suppressions()->list();

Helo::suppressions()->list(extra: ['newFilter' => 'value']);

Http::fake([
    'api.helohq.com/*' => Http::response(['status' => 'accepted', 'messageId' => 'test-id']),
]);

Mail::to('[email protected]')->send(new Welcome);

Http::assertSent(fn ($request) => $request->url() === 'https://api.helohq.com/send/transactional');
bash
php artisan vendor:publish --tag=helo-config
bash
HELO_API_KEY=... HELO_CHANNEL_ID=... HELO_FROM=you@your-domain [email protected] \
  php scripts/live-check.php