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  : Mailer
$sent  : bool
TRUE if the message has been sent.

Methods

addBcc()  : Email
addCc()  : Email
addFrom()  : Email
addReplyTo()  : Email
addTo()  : Email
isSent()  : bool
Checks whether the message has been sent.
send()  : bool
Sends the message.
setBcc()  : MailMessage
Set the Bcc addresses of this message.
setCc()  : MailMessage
Set the Cc addresses of this message.
setDate()  : MailMessage
Set the origination date of the message as a UNIX timestamp.
setFrom()  : MailMessage
Set the from address of this message.
setReadReceiptTo()  : MailMessage
Ask for a delivery receipt from the recipient to be sent to $addresses.
setReplyTo()  : MailMessage
Set the reply-to address of this message.
setReturnPath()  : MailMessage
Set the return-path (the bounce address) of this message.
setSender()  : MailMessage
Set the sender of this message.
setSubject()  : MailMessage
Set the subject of the message.
setTo()  : MailMessage
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(mixed ...$addresses) : Email
Parameters
$addresses : mixed
Return values
Email

addCc()

public addCc(mixed ...$addresses) : Email
Parameters
$addresses : mixed
Return values
Email

addFrom()

public addFrom(mixed ...$addresses) : Email
Parameters
$addresses : mixed
Return values
Email

addReplyTo()

public addReplyTo(mixed ...$addresses) : Email
Parameters
$addresses : mixed
Return values
Email

addTo()

public addTo(mixed ...$addresses) : Email
Parameters
$addresses : mixed
Return values
Email

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 ]) : MailMessage

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
MailMessage

setCc()

Set the Cc addresses of this message.

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

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
MailMessage

setDate()

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

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

setFrom()

Set the from address of this message.

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

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
MailMessage

setReadReceiptTo()

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

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

setReplyTo()

Set the reply-to address of this message.

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

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
MailMessage

setReturnPath()

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

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

setSender()

Set the sender of this message.

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

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

Parameters
$address : string
$name : string = null

optional

Return values
MailMessage

setTo()

Set the to addresses of this message.

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

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
MailMessage

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