MailerFactory

class \TYPO3\CMS\Core\Mail\MailerFactory

Creates mailers for named mail profiles.

Inject this factory instead of the MailerInterface when an email must not be sent through the globally configured transport, for example when newsletters and transactional emails are delivered by different providers.

Mailers are kept per profile, so an established SMTP connection is reused for all emails sent through the same profile within one request.

Attributes

#[Autoconfigure]
$public: true

Table of Contents

Methods

__construct()  : mixed
getMailer()  : MailerInterface
Returns the mailer of the given profile, or the globally configured mailer without one.

Methods

getMailer()

Returns the mailer of the given profile, or the globally configured mailer without one.

public getMailer([string|null $profileName = null ]) : MailerInterface

Parameters

$profileName : string|null = null

Tags

throws
InvalidArgumentException

if the given profile is not configured

Return values

MailerInterface
On this page