MailMessage extends Email

Adapter for Symfony Mime to be used by TYPO3 extensions, also provides some backwards-compatibility for previous TYPO3 installations where send() was baked into the MailMessage object.

Table of Contents

Properties

$mailer  : MailerInterface
$sent  : bool
TRUE if the message has been sent.

Methods

addBcc()  : static
addCc()  : static
addFrom()  : static
addReplyTo()  : static
addTo()  : static
isSent()  : bool
Checks whether the message has been sent.
send()  : bool
Sends the message.
setBcc()  : self
Set the Bcc addresses of this message.
setCc()  : self
Set the Cc addresses of this message.
setDate()  : self
Set the origination date of the message as a UNIX timestamp.
setFrom()  : self
Set the from address of this message.
setReadReceiptTo()  : self
Ask for a delivery receipt from the recipient to be sent to $addresses.
setReplyTo()  : self
Set the reply-to address of this message.
setReturnPath()  : self
Set the return-path (the bounce address) of this message.
setSender()  : self
Set the sender of this message.
setSubject()  : self
Set the subject of the message.
setTo()  : self
Set the to addresses of this message.
checkArguments()  : void
convertAddresses()  : array<string|int, Address>
Converts Addresses into Address/NamedAddress objects.
convertNamedAddress()  : array<string|int, Address>
Converts address from [email, name] into Address objects.

Properties

$sent

TRUE if the message has been sent.

protected bool $sent = false

Methods

addBcc()

public addBcc(Address|string|null|array<string|int, mixed> ...$addresses) : static
Parameters
$addresses : Address|string|null|array<string|int, mixed>
Return values
static

addCc()

public addCc(Address|string|null|array<string|int, mixed> ...$addresses) : static
Parameters
$addresses : Address|string|null|array<string|int, mixed>
Return values
static

addFrom()

public addFrom(Address|string|null|array<string|int, mixed> ...$addresses) : static
Parameters
$addresses : Address|string|null|array<string|int, mixed>
Return values
static

addReplyTo()

public addReplyTo(Address|string|null|array<string|int, mixed> ...$addresses) : static
Parameters
$addresses : Address|string|null|array<string|int, mixed>
Return values
static

addTo()

public addTo(Address|string|null|array<string|int, mixed> ...$addresses) : static
Parameters
$addresses : Address|string|null|array<string|int, mixed>
Return values
static

isSent()

Checks whether the message has been sent.

public isSent() : bool
Return values
bool

send()

Sends the message.

public send() : bool

This is a short-hand method. It is however more useful to create a Mailer instance which can be used via Mailer->send($message);

Return values
bool

whether the message was accepted or not

setBcc()

Set the Bcc addresses of this message.

public setBcc(string|array<string|int, mixed> $addresses[, string $name = null ]) : self

If multiple recipients will receive the message an array should be used. Example: array('receiver@domain.org', 'other@domain.org' => 'A name')

If $name is passed and the first parameter is a string, this name will be associated with the address. If $name is passed and the first parameter is not a string, an exception is thrown.

Parameters
$addresses : string|array<string|int, mixed>
$name : string = null

optional

Return values
self

setCc()

Set the Cc addresses of this message.

public setCc(string|array<string|int, mixed> $addresses[, string $name = null ]) : self

If multiple recipients will receive the message an array should be used. Example: array('receiver@domain.org', 'other@domain.org' => 'A name')

If $name is passed and the first parameter is a string, this name will be associated with the address. If $name is passed and the first parameter is not a string, an exception is thrown.

Parameters
$addresses : string|array<string|int, mixed>
$name : string = null

optional

Return values
self

setDate()

Set the origination date of the message as a UNIX timestamp.

public setDate(int $date) : self
Parameters
$date : int
Return values
self

setFrom()

Set the from address of this message.

public setFrom(string|array<string|int, mixed> $addresses[, string $name = null ]) : self

You may pass an array of addresses if this message is from multiple people.

If $name is passed and the first parameter is a string, this name will be associated with the address. If $name is passed and the first parameter is not a string, an exception is thrown.

Parameters
$addresses : string|array<string|int, mixed>
$name : string = null

optional

Return values
self

setReadReceiptTo()

Ask for a delivery receipt from the recipient to be sent to $addresses.

public setReadReceiptTo(string $address) : self
Parameters
$address : string
Return values
self

setReplyTo()

Set the reply-to address of this message.

public setReplyTo(string|array<string|int, mixed> $addresses[, string $name = null ]) : self

You may pass an array of addresses if replies will go to multiple people.

If $name is passed and the first parameter is a string, this name will be associated with the address. If $name is passed and the first parameter is not a string, an exception is thrown.

Parameters
$addresses : string|array<string|int, mixed>
$name : string = null

optional

Return values
self

setReturnPath()

Set the return-path (the bounce address) of this message.

public setReturnPath(string $address) : self
Parameters
$address : string
Return values
self

setSender()

Set the sender of this message.

public setSender(string $address[, string $name = null ]) : self

This does not override the From field, but it has a higher significance.

Parameters
$address : string
$name : string = null

optional

Return values
self

setSubject()

Set the subject of the message.

public setSubject(string $subject) : self
Parameters
$subject : string
Return values
self

setTo()

Set the to addresses of this message.

public setTo(string|array<string|int, mixed> $addresses[, string $name = null ]) : self

If multiple recipients will receive the message an array should be used. Example: array('receiver@domain.org', 'other@domain.org' => 'A name')

If $name is passed and the first parameter is a string, this name will be associated with the address. If $name is passed and the first parameter is not a string, an exception is thrown.

Parameters
$addresses : string|array<string|int, mixed>
$name : string = null

optional

Return values
self

checkArguments()

protected checkArguments(mixed $addresses[, string|null $name = null ]) : void
Parameters
$addresses : mixed
$name : string|null = null

convertAddresses()

Converts Addresses into Address/NamedAddress objects.

protected convertAddresses(string|array<string|int, mixed> $addresses) : array<string|int, Address>
Parameters
$addresses : string|array<string|int, mixed>
Return values
array<string|int, Address>

convertNamedAddress()

Converts address from [email, name] into Address objects.

protected convertNamedAddress(mixed ...$args) : array<string|int, Address>
Parameters
$args : mixed
Return values
array<string|int, Address>

        
On this page

Search results