Skip to content

SendMail

Viames Marino edited this page Oct 19, 2026 · 3 revisions

Pair framework: Sendmail

Pair\Services\Sendmail extends the Mailer base class and sends HTML email through PHP's mail() transport. Use the exact Sendmail spelling so Composer can autoload src/Services/Sendmail.php on case-sensitive filesystems.

Main method

send(array $recipients, string $subject, string $title, string $text, array $attachments = [], array $ccs = []): void

Sends an HTML email with recipients and carbon copies normalized by the base mail helper. The attachments argument is accepted for the shared signature but is not used by this transport; use another mailer when attachments are required. A failed mail() call raises EMAIL_FAILURE.

Implementation example

use Pair\Services\Sendmail;

$mailer = new Sendmail([
	'fromAddress' => 'noreply@example.com',
	'fromName' => 'Example app',
	'adminEmails' => ['developer@example.com'],
]);
$mailer->send(
    [['name' => 'John', 'email' => 'john@example.com']],
    'Welcome',
    'Welcome to Pair',
    'Your account is ready.'
);

The server must provide a working PHP mail transport. Non-production recipient routing follows the base Mailer rules and requires configured administrator addresses.

See also: Mailer, AmazonSes, SmtpMailer.

Clone this wiki locally