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 ($sender)
 Sets email sender. More...
 
 getSender ()
 Returns sender. More...
 
 setFrom (Address $from)
 Sets sender address. More...
 
 getFrom ()
 Returns sender address. More...
 
 setTo ($recipient)
 Sets recipient address. More...
 
 getTo ()
 Returns recipient address. More...
 
 setCc ($recipient)
 Sets recipient address in cc. More...
 
 getCc ()
 Returns recipient address from cc. More...
 
 setBcc ($recipient)
 Sets recipient address in bcc. More...
 
 getBcc ()
 Returns recipient address from bcc. More...
 
 setSubject ($subject= '')
 Sets email subject. More...
 
 getSubject ()
 Returns the subject. More...
 
 setBody ($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 ($name, $value)
 Adds/replaces an HTTP/IMF header. More...
 
 setHeaders (array $headers=[])
 Replaces header bag. More...
 
 getHeaders ()
 Returns headers. More...
 
 addAttachment ($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 ($recipients)
 Converts mixed input to an array of Laminas address instances. More...
 

Static Protected Member Functions

static prepareFrom ($from)
 Converts mixed input to an instance of Laminas addres. More...
 

Protected Attributes

 $from
 
 $to = []
 
 $cc = []
 
 $bcc = []
 
 $sender
 
 $subject
 
 $body
 
 $params = []
 
 $headers = []
 
 $attachments = []
 

Detailed Description

Email message.

Definition at line 13 of file Email.php.

Member Function Documentation

Elgg\Email::addAttachment (   $attachment)

Add an attachment.

Parameters
mixed$attachmentor or or an array
See also
::factory()
Returns
self

Definition at line 323 of file Email.php.

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

Adds/replaces an HTTP/IMF header.

Parameters
string$nameHeader name
mixed$valueHeader value
Returns
self

Definition at line 288 of file Email.php.

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 361 of file Email.php.

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 'to' - ElggEntity, or email string, or , or an array of one of these types 'cc' - ElggEntity, or email string, or , or an array of one of these types 'bcc' - ElggEntity, or email string, or , or an array of one of these types 'subject' - subject string 'body' - body string 'params' - additional parameters 'headers' - HTTP/IMF headers
Returns

Definition at line 80 of file Email.php.

Elgg\Email::getAttachments ( )

Get all attachments.

Returns
[]

Definition at line 348 of file Email.php.

Elgg\Email::getBcc ( )

Returns recipient address from bcc.

Returns
[]

Definition at line 211 of file Email.php.

Elgg\Email::getBody ( )

Returns email body.

Returns
string

Definition at line 255 of file Email.php.

Elgg\Email::getCc ( )

Returns recipient address from cc.

Returns
[]

Definition at line 190 of file Email.php.

Elgg\Email::getFrom ( )

Returns sender address.

Returns

Definition at line 148 of file Email.php.

Elgg\Email::getHeaders ( )

Returns headers.

Returns
array

Definition at line 310 of file Email.php.

Elgg\Email::getParams ( )

Returns additional params.

Returns
array

Definition at line 276 of file Email.php.

Elgg\Email::getSender ( )

Returns sender.

Returns
mixed

Definition at line 127 of file Email.php.

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 234 of file Email.php.

Elgg\Email::getTo ( )

Returns recipient address.

Returns
[]

Definition at line 169 of file Email.php.

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

Converts mixed input to an instance of Laminas addres.

Parameters
mixed$fromFrom input
Returns
Address
Exceptions
InvalidArgumentException

Definition at line 382 of file Email.php.

Elgg\Email::prepareRecipients (   $recipients)
protected

Converts mixed input to an array of Laminas address instances.

Parameters
mixed$recipientsrecipients input
Returns
Address[]
Exceptions
InvalidArgumentException

Definition at line 420 of file Email.php.

Elgg\Email::setBcc (   $recipient)

Sets recipient address in bcc.

Parameters
mixed$recipientElggEntity, or email string, or , or an array of one of these types
Returns
self

Definition at line 201 of file Email.php.

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

Sets the email message body.

Parameters
string$bodyBody
Returns
self

Definition at line 245 of file Email.php.

Elgg\Email::setCc (   $recipient)

Sets recipient address in cc.

Parameters
mixed$recipientElggEntity, or email string, or , or an array of one of these types
Returns
self

Definition at line 180 of file Email.php.

Elgg\Email::setFrom ( Address  $from)

Sets sender address.

Parameters
\Elgg\Email\Address$fromSender address
Returns
self

Definition at line 138 of file Email.php.

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

Replaces header bag.

Parameters
array$headersHeaders
Returns
self

Definition at line 300 of file Email.php.

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

Sets additional params.

Parameters
array$paramsParams
Returns
self

Definition at line 266 of file Email.php.

Elgg\Email::setSender (   $sender)

Sets email sender.

Parameters
mixed$senderOriginal sender of the Email
Returns
self

Definition at line 117 of file Email.php.

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

Sets email subject.

Parameters
string$subjectSubject
Returns
self

Definition at line 222 of file Email.php.

Elgg\Email::setTo (   $recipient)

Sets recipient address.

Parameters
mixed$recipientElggEntity, or email string, or , or an array of one of these types
Returns
self

Definition at line 159 of file Email.php.

Member Data Documentation

Elgg\Email::$attachments = []
protected

Definition at line 63 of file Email.php.

Elgg\Email::$bcc = []
protected

Definition at line 33 of file Email.php.

Elgg\Email::$body
protected

Definition at line 48 of file Email.php.

Elgg\Email::$cc = []
protected

Definition at line 28 of file Email.php.

Elgg\Email::$from
protected

Definition at line 18 of file Email.php.

Elgg\Email::$headers = []
protected

Definition at line 58 of file Email.php.

Elgg\Email::$params = []
protected

Definition at line 53 of file Email.php.

Elgg\Email::$sender
protected

Definition at line 38 of file Email.php.

Elgg\Email::$subject
protected

Definition at line 43 of file Email.php.

Elgg\Email::$to = []
protected

Definition at line 23 of file Email.php.


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