Documentation

Mailer
in package

Mailer class

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
5.0.0

Table of Contents

Properties

$defaultFrom  : string|null
Default from address
$transport  : TransportInterface|null
Transport object

Methods

__construct()  : mixed
Constructor
getDefaultFrom()  : string|null
Get default from address
hasDefaultFrom()  : bool
Has default from address
send()  : mixed
Send message
sendFromDir()  : int
Send messages from email messages saved to disk in a directory
sendFromQueue()  : int
Send messages from mail queue
setDefaultFrom()  : Mailer
Set default from address
transport()  : TransportInterface
Get the transport object
dispatch()  : int
Send a batch of already-prepared messages, preferring the transport's native batch API when it supports one

Properties

$defaultFrom

Default from address

protected string|null $defaultFrom = null

Methods

__construct()

Constructor

public __construct(TransportInterface $transport[, string|null $defaultFrom = null ]) : mixed

Instantiate the message object

Parameters
$transport : TransportInterface
$defaultFrom : string|null = null

getDefaultFrom()

Get default from address

public getDefaultFrom() : string|null
Return values
string|null

hasDefaultFrom()

Has default from address

public hasDefaultFrom() : bool
Return values
bool

sendFromDir()

Send messages from email messages saved to disk in a directory

public sendFromDir(string $dir) : int

If the transport implements BatchTransportInterface, all loaded messages are handed to it in one call instead of being sent one at a time (see sendFromQueue()).

Parameters
$dir : string
Tags
throws
Exception
Return values
int

sendFromQueue()

Send messages from mail queue

public sendFromQueue(Queue $queue) : int

If the transport implements BatchTransportInterface, all prepared messages are handed to it in one call instead of being sent one at a time, so batch-capable transports can use their provider's native bulk-send endpoint.

Parameters
$queue : Queue
Return values
int

setDefaultFrom()

Set default from address

public setDefaultFrom(string $from) : Mailer
Parameters
$from : string
Return values
Mailer

dispatch()

Send a batch of already-prepared messages, preferring the transport's native batch API when it supports one

private dispatch(array<string|int, Message$messages) : int
Parameters
$messages : array<string|int, Message>
Return values
int

        
On this page

Search results