Elgg  Version master
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Elgg\Email Class Reference

Email message. More...

Public Member Functions

 setSender (mixed $sender)
 Sets email sender. More...
 
 getSender ()
 Returns sender. More...
 
 setFrom (Address $from)
 Sets sender address. More...
 
 getFrom ()
 Returns sender address. More...
 
 setTo (mixed $recipient)
 Sets recipient address. More...
 
 getTo ()
 Returns recipient address. More...
 
 setCc (mixed $recipient)
 Sets recipient address in cc. More...
 
 getCc ()
 Returns recipient address from cc. More...
 
 setBcc (mixed $recipient)
 Sets recipient address in bcc. More...
 
 getBcc ()
 Returns recipient address from bcc. More...
 
 setSubject (string $subject='')
 Sets email subject. More...
 
 getSubject ()
 Returns the subject. More...
 
 setBody (string $body='')
 Sets the email message body. More...
 
 getBody ()
 Returns email body. More...
 
 setParams (array $params=[])
 Sets additional params. More...
 
 getParams ()
 Returns additional params. More...
 
 addHeader (string $name, mixed $value)
 Adds/replaces an HTTP/IMF header. More...
 
 setHeaders (array $headers=[])
 Replaces header bag. More...
 
 getHeaders ()
 Returns headers. More...
 
 addAttachment (mixed $attachment)
 Add an attachment. More...
 
 getAttachments ()
 Get all attachments. More...
 
 createEntityMessageID (\ElggEntity $entity, bool $add_microtime=false)
 Create a Message-ID header string for the given entity. More...
 

Static Public Member Functions

static factory (array $options=[])
 Create an email instance form an array of options. More...
 

Protected Member Functions

 prepareRecipients (mixed $recipients)
 Converts mixed input to an array of Symfony address instances. More...
 

Static Protected Member Functions

static prepareFrom (mixed $from)
 Converts mixed input to an instance of \Symfony\Component\Mime\Address. More...
 

Protected Attributes

Address $from = null
 
array $to = []
 
array $cc = []
 
array $bcc = []
 
Address $sender = null
 
string $subject = ''
 
string $body = null
 
array $params = []
 
array $headers = []
 
array $attachments = []
 

Detailed Description

Email message.

Definition at line 14 of file Email.php.

Member Function Documentation

◆ addAttachment()

Elgg\Email::addAttachment ( mixed  $attachment)

Add an attachment.

Parameters
mixed$attachment\Symfony\Component\Mime\Part\DataPart or \Elgg\Email\Attachment or \ElggFile or an array
See also
\Elgg\Email\Attachment::factory()
Returns
self

Definition at line 312 of file Email.php.

◆ addHeader()

Elgg\Email::addHeader ( string  $name,
mixed  $value 
)

Adds/replaces an HTTP/IMF header.

Parameters
string$nameHeader name
mixed$valueHeader value
Returns
self

Definition at line 277 of file Email.php.

◆ createEntityMessageID()

Elgg\Email::createEntityMessageID ( \ElggEntity  $entity,
bool  $add_microtime = false 
)

Create a Message-ID header string for the given entity.

Parameters
\ElggEntity$entityThe entity to generate the header for
bool$add_microtimeAdd a microtime to the header (used for non create events)
Returns
string
Since
4.2

Definition at line 345 of file Email.php.

◆ factory()

static Elgg\Email::factory ( array  $options = [])
static

Create an email instance form an array of options.

Parameters
array$optionsOptions 'from' - ElggEntity, or email string, or \Symfony\Component\Mime\Address 'to' - ElggEntity, or email string, or \Symfony\Component\Mime\Address, or an array of one of these types 'cc' - ElggEntity, or email string, or \Symfony\Component\Mime\Address, or an array of one of these types 'bcc' - ElggEntity, or email string, or \Symfony\Component\Mime\Address, or an array of one of these types 'subject' - subject string 'body' - body string 'params' - additional parameters 'headers' - HTTP/IMF headers
Returns
Email

Definition at line 63 of file Email.php.

◆ getAttachments()

Elgg\Email::getAttachments ( )

Get all attachments.

Returns
DataPart[]

Definition at line 332 of file Email.php.

◆ getBcc()

Elgg\Email::getBcc ( )

Returns recipient address from bcc.

Returns
Address[]

Definition at line 200 of file Email.php.

◆ getBody()

Elgg\Email::getBody ( )

Returns email body.

Returns
string|null

Definition at line 244 of file Email.php.

◆ getCc()

Elgg\Email::getCc ( )

Returns recipient address from cc.

Returns
Address[]

Definition at line 179 of file Email.php.

◆ getFrom()

Elgg\Email::getFrom ( )

Returns sender address.

Returns
Address|null

Definition at line 137 of file Email.php.

◆ getHeaders()

Elgg\Email::getHeaders ( )

Returns headers.

Returns
array

Definition at line 299 of file Email.php.

◆ getParams()

Elgg\Email::getParams ( )

Returns additional params.

Returns
array

Definition at line 265 of file Email.php.

◆ getSender()

Elgg\Email::getSender ( )

Returns sender.

Returns
Address

Definition at line 111 of file Email.php.

◆ getSubject()

Elgg\Email::getSubject ( )

Returns the subject.

It is possible to limit the length of the subject string. This is sometimes needed for certain mail servers / clients.

Returns
string

Definition at line 223 of file Email.php.

◆ getTo()

Elgg\Email::getTo ( )

Returns recipient address.

Returns
Address[]

Definition at line 158 of file Email.php.

◆ prepareFrom()

static Elgg\Email::prepareFrom ( mixed  $from)
staticprotected

Converts mixed input to an instance of \Symfony\Component\Mime\Address.

Parameters
mixed$fromFrom input
Returns
Address
Exceptions
InvalidArgumentException

Definition at line 365 of file Email.php.

◆ prepareRecipients()

Elgg\Email::prepareRecipients ( mixed  $recipients)
protected

Converts mixed input to an array of Symfony address instances.

Parameters
mixed$recipientsrecipients input
Returns
Address[]
Exceptions
InvalidArgumentException

Definition at line 402 of file Email.php.

◆ setBcc()

Elgg\Email::setBcc ( mixed  $recipient)

Sets recipient address in bcc.

Parameters
mixed$recipient\ElggEntity, or email string, or \Symfony\Component\Mime\Address, or an array of one of these types
Returns
self

Definition at line 190 of file Email.php.

◆ setBody()

Elgg\Email::setBody ( string  $body = '')

Sets the email message body.

Parameters
string$bodyBody
Returns
self

Definition at line 234 of file Email.php.

◆ setCc()

Elgg\Email::setCc ( mixed  $recipient)

Sets recipient address in cc.

Parameters
mixed$recipient\ElggEntity, or email string, or \Symfony\Component\Mime\Address, or an array of one of these types
Returns
self

Definition at line 169 of file Email.php.

◆ setFrom()

Elgg\Email::setFrom ( Address  $from)

Sets sender address.

Parameters
Address$fromSender address
Returns
self

Definition at line 127 of file Email.php.

◆ setHeaders()

Elgg\Email::setHeaders ( array  $headers = [])

Replaces header bag.

Parameters
array$headersHeaders
Returns
self

Definition at line 289 of file Email.php.

◆ setParams()

Elgg\Email::setParams ( array  $params = [])

Sets additional params.

Parameters
array$paramsParams
Returns
self

Definition at line 255 of file Email.php.

◆ setSender()

Elgg\Email::setSender ( mixed  $sender)

Sets email sender.

Parameters
mixed$senderOriginal sender of the Email
Returns
self

Definition at line 100 of file Email.php.

◆ setSubject()

Elgg\Email::setSubject ( string  $subject = '')

Sets email subject.

Parameters
string$subjectSubject
Returns
self

Definition at line 211 of file Email.php.

◆ setTo()

Elgg\Email::setTo ( mixed  $recipient)

Sets recipient address.

Parameters
mixed$recipient\ElggEntity, or email string, or \Symfony\Component\Mime\Address, or an array of one of these types
Returns
self

Definition at line 148 of file Email.php.

Member Data Documentation

◆ $attachments

array Elgg\Email::$attachments = []
protected

Definition at line 46 of file Email.php.

◆ $bcc

array Elgg\Email::$bcc = []
protected

Definition at line 31 of file Email.php.

◆ $body

string Elgg\Email::$body = null
protected

Definition at line 37 of file Email.php.

◆ $cc

array Elgg\Email::$cc = []
protected

Definition at line 26 of file Email.php.

◆ $from

Address Elgg\Email::$from = null
protected

Definition at line 16 of file Email.php.

◆ $headers

array Elgg\Email::$headers = []
protected

Definition at line 41 of file Email.php.

◆ $params

array Elgg\Email::$params = []
protected

Definition at line 39 of file Email.php.

◆ $sender

Address Elgg\Email::$sender = null
protected

Definition at line 33 of file Email.php.

◆ $subject

string Elgg\Email::$subject = ''
protected

Definition at line 35 of file Email.php.

◆ $to

array Elgg\Email::$to = []
protected

Definition at line 21 of file Email.php.


The documentation for this class was generated from the following file: