TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Core\Mail\MailMessage Class Reference
Inheritance diagram for TYPO3\CMS\Core\Mail\MailMessage:

Public Member Functions

 send ()
 
 isSent ()
 
 getFailedRecipients ()
 
 setReturnPath ($address)
 
 setSender ($address, $name=null)
 
 setFrom ($addresses, $name=null)
 
 setReplyTo ($addresses, $name=null)
 
 setTo ($addresses, $name=null)
 
 setCc ($addresses, $name=null)
 
 setBcc ($addresses, $name=null)
 
 setReadReceiptTo ($addresses)
 

Protected Member Functions

 idnaEncodeAddresses ($addresses)
 
 idnaEncodeAddress ($email)
 

Protected Attributes

 $mailer
 
 $mailerHeader = 'TYPO3'
 
 $sent = false
 
 $failedRecipients = []
 

Private Member Functions

 initializeMailer ()
 

Detailed Description

Adapter for Swift_Mailer to be used by TYPO3 extensions

Definition at line 20 of file MailMessage.php.

Member Function Documentation

◆ getFailedRecipients()

TYPO3\CMS\Core\Mail\MailMessage::getFailedRecipients ( )

Returns the recipients for which the mail was not accepted for delivery.

Returns
array the recipients who were not accepted for delivery

Definition at line 82 of file MailMessage.php.

References TYPO3\CMS\Core\Mail\MailMessage\$failedRecipients.

◆ idnaEncodeAddress()

TYPO3\CMS\Core\Mail\MailMessage::idnaEncodeAddress (   $email)
protected

IDNA encode the domain part of an email address if it contains non ASCII characters

Parameters
mixed$email
Returns
mixed
See also
::validEmail

Definition at line 243 of file MailMessage.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\idnaEncode().

Referenced by TYPO3\CMS\Core\Mail\MailMessage\idnaEncodeAddresses().

◆ idnaEncodeAddresses()

TYPO3\CMS\Core\Mail\MailMessage::idnaEncodeAddresses (   $addresses)
protected

◆ initializeMailer()

TYPO3\CMS\Core\Mail\MailMessage::initializeMailer ( )
private
Returns
void

Definition at line 49 of file MailMessage.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Referenced by TYPO3\CMS\Core\Mail\MailMessage\send().

◆ isSent()

TYPO3\CMS\Core\Mail\MailMessage::isSent ( )

Checks whether the message has been sent.

Returns
bool

Definition at line 72 of file MailMessage.php.

References TYPO3\CMS\Core\Mail\MailMessage\$sent.

◆ send()

TYPO3\CMS\Core\Mail\MailMessage::send ( )

Sends the message.

Returns
int the number of recipients who were accepted for delivery

Definition at line 59 of file MailMessage.php.

References TYPO3\CMS\Core\Mail\MailMessage\initializeMailer().

◆ setBcc()

TYPO3\CMS\Core\Mail\MailMessage::setBcc (   $addresses,
  $name = null 
)

Set the Bcc addresses of this message.

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

Parameters
string | array$addresses
string$nameoptional
Returns

Definition at line 195 of file MailMessage.php.

References TYPO3\CMS\Core\Mail\MailMessage\idnaEncodeAddresses().

◆ setCc()

TYPO3\CMS\Core\Mail\MailMessage::setCc (   $addresses,
  $name = null 
)

Set the Cc addresses of this message.

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

Parameters
string | array$addresses
string$nameoptional
Returns

Definition at line 179 of file MailMessage.php.

References TYPO3\CMS\Core\Mail\MailMessage\idnaEncodeAddresses().

◆ setFrom()

TYPO3\CMS\Core\Mail\MailMessage::setFrom (   $addresses,
  $name = null 
)

Set the from address of this message.

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.

Parameters
string | array$addresses
string$nameoptional
Returns

Definition at line 126 of file MailMessage.php.

References TYPO3\CMS\Core\Mail\MailMessage\idnaEncodeAddresses().

◆ setReadReceiptTo()

TYPO3\CMS\Core\Mail\MailMessage::setReadReceiptTo (   $addresses)

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

Parameters
array$addresses
Returns

Definition at line 207 of file MailMessage.php.

References TYPO3\CMS\Core\Mail\MailMessage\idnaEncodeAddresses().

◆ setReplyTo()

TYPO3\CMS\Core\Mail\MailMessage::setReplyTo (   $addresses,
  $name = null 
)

Set the reply-to address of this message.

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.

Parameters
string | array$addresses
string$nameoptional
Returns

Definition at line 144 of file MailMessage.php.

References TYPO3\CMS\Core\Mail\MailMessage\idnaEncodeAddresses().

◆ setReturnPath()

TYPO3\CMS\Core\Mail\MailMessage::setReturnPath (   $address)

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

Parameters
string$address
Returns

Definition at line 93 of file MailMessage.php.

References TYPO3\CMS\Core\Mail\MailMessage\idnaEncodeAddresses().

◆ setSender()

TYPO3\CMS\Core\Mail\MailMessage::setSender (   $address,
  $name = null 
)

Set the sender of this message.

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

Parameters
string$address
string$nameoptional
Returns

Definition at line 108 of file MailMessage.php.

References TYPO3\CMS\Core\Mail\MailMessage\idnaEncodeAddresses().

◆ setTo()

TYPO3\CMS\Core\Mail\MailMessage::setTo (   $addresses,
  $name = null 
)

Set the to addresses of this message.

If multiple recipients will receive the message an array should be used. Example: array('recei.nosp@m.ver@.nosp@m.domai.nosp@m.n.or.nosp@m.g', 'other.nosp@m.@dom.nosp@m.ain.o.nosp@m.rg' => 'A name')

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

Parameters
string | array$addresses
string$nameoptional
Returns

Definition at line 163 of file MailMessage.php.

References TYPO3\CMS\Core\Mail\MailMessage\idnaEncodeAddresses().

Member Data Documentation

◆ $failedRecipients

TYPO3\CMS\Core\Mail\MailMessage::$failedRecipients = []
protected

Definition at line 44 of file MailMessage.php.

Referenced by TYPO3\CMS\Core\Mail\MailMessage\getFailedRecipients().

◆ $mailer

TYPO3\CMS\Core\Mail\MailMessage::$mailer
protected

Definition at line 25 of file MailMessage.php.

◆ $mailerHeader

TYPO3\CMS\Core\Mail\MailMessage::$mailerHeader = 'TYPO3'
protected

Definition at line 30 of file MailMessage.php.

◆ $sent

TYPO3\CMS\Core\Mail\MailMessage::$sent = false
protected

Definition at line 37 of file MailMessage.php.

Referenced by TYPO3\CMS\Core\Mail\MailMessage\isSent().