API / Minn\Mail / Mailer

Mailer final readonly class

Minn\Mail\Mailer · public/minn/src/Minn/Mail/Mailer.php · 88 lines

Sends a Message through the configured transport. Failures are logged and reported as false; nothing here throws into a request.

Constants and properties

privatereadonly Minn\Mail\MailSettings $settings

Promoted from the constructor.

privatereadonly string $logFile

Promoted from the constructor.

Public

new__construct(Minn\Mail\MailSettings $settings, string $logFile)#
staticforSite(Minn\Content\Site $site): self#

A mailer using the site's own settings.

staticmail(array|string $to, string $subject, string $body): bool#

The one-line send: a recipient, a subject, a body, through the site's transport and sender, with nothing to construct at the call site.

staticnoticesFor(Minn\Content\Site $site): Minn\Mail\Notices#

The engine's own notices, worded once, from this site's name and address.

methodsend(Minn\Mail\Message $message): bool#

Sends one message; false on failure. With WordPress's mail function loaded the message goes through wp_mail(), so its filters and the phpmailer_init hook (an SMTP plugin's way in) apply as they do on the reference; otherwise through the configured transport directly.

Internals 3

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privateviaSmtp(string $from, string $fromName, array $to, Minn\Mail\Message $message): bool#
$tolist<string>
privateviaMail(string $from, string $fromName, array $to, Minn\Mail\Message $message): bool#
$tolist<string>
privatedraft(string $mailer, string $from, string $fromName, array $to, Minn\Mail\Message $message): Minn\Mail\Draft#
$tolist<string>