NullMailer
in package
implements
Mailer
Mailer that sends nothing.
Returned by MailerTrait::initializeMailer()
(used by SendEmailTrait and the email queue) when the safeguard params.1.mail.blocked is on in neon.
IMPORTANT: it deliberately reports success, not failure. Calling code (registration, order, password reset) builds its own error messages and rollbacks on a failed send, so a safeguard that failed would block those operations too. The safeguard must stop mail, not the website.
Every dropped email is logged, so Tracy shows that mail is withheld on purpose and nobody hunts for a nonexistent SMTP bug.
Table of Contents
Interfaces
- Mailer
Properties
- $reason : string
Methods
- __construct() : mixed
- send() : void
- formatRecipients() : string
- Describes the recipients as a count and address fingerprints, never the addresses.
Properties
$reason read-only
private
string
$reason
= ''
Methods
__construct()
public
__construct([string $reason = '' ]) : mixed
Parameters
- $reason : string = ''
send()
public
send(Message $mail) : void
Parameters
- $mail : Message
formatRecipients()
Describes the recipients as a count and address fingerprints, never the addresses.
private
formatRecipients(Message $mail) : string
Per Nette the To header is either an array address => name or a plain string. Without
the distinction array_keys() would fail on a string, exactly when the safeguard runs
and nobody is watching.
Parameters
- $mail : Message