mini\mailer()
Function
Documentation
Get the mailer instance for sending emails
Returns a MailTransportInterface (by default a Mailer wrapping NativeMailTransport). The default Mailer handles:
- Automatic Bcc header stripping
- Envelope sender resolution (explicit > From header)
- Envelope recipient collection from To + Cc + Bcc
Usage: use function mini\mailer;
$email = (new Email()) ->withFrom('sender@example.com') ->withTo('recipient@example.com') ->withSubject('Hello') ->withTextBody('Hello World');
mailer()->send($email);
Configuration: Override by creating _config/mini/Mail/MailTransportInterface.php:
use mini\Mail\Mailer;
use mini\Mail\SendmailTransport;
return new Mailer(new SendmailTransport());
Signature
function mailer(): mini\Mail\MailTransportInterface