PHP Class Phalcon\Mailer\Message

Show file Open project: phalcon/incubator

Protected Properties

Property Type Description
$failedRecipients array An array of email which failed send to recipients.
$manager Manager
$message Swift_Message

Public Methods

Method Description
__construct ( Manager $manager ) Create a new Message using $mailer for sending from SwiftMailer
attachment ( string $file, array $options = [] ) Attach a file to the message.
attachmentData ( string $data, string $name, array $options = [] ) : Message Attach in-memory data as an attachment.
bcc ( string | array $email, string | null $name = null ) Set the Bcc addresses of this message.
cc ( string | array $email, string | null $name = null ) Set the Cc addresses of this message.
charset ( string $charset ) Set the character set of this message.
content ( mixed $content, string $contentType = self::CONTENT_TYPE_HTML, string $charset = null ) Set the body of this message, either as a string, or as an instance of {@link \Swift_OutputByteStream}.
contentType ( string $contentType ) Set the Content-type of this message.
embed ( string $file ) : string Embed a file in the message and get the CID.
embedData ( string $data, string $name, string $contentType = null ) : string Embed in-memory data in the message and get the CID.
from ( string | array $email, string | null $name = null ) Set the from address of this message.
getBcc ( ) : array Get the Bcc addresses of this message.
getCc ( ) : array Get the Cc address of this message.
getCharset ( ) : string Get the character set of this message.
getContent ( ) : string Get the body of this message as a string.
getContentType ( ) : string Get the Content-type of this message.
getFailedRecipients ( ) : array An array of email which failed send to recipients.
getFormat ( ) : string Get the format of this message (i.e. flowed or fixed).
getFrom ( ) : string Get the from address of this message.
getManager ( ) : Manager Return a {@link \Phalcon\Mailer\Manager} instance
getMessage ( ) : Swift_Message Return a {@link \Swift_Message} instance
getPriority ( ) : integer Get the priority of this message.
getReadReceiptTo ( ) : string Get the addresses to which a read-receipt will be sent.
getReplyTo ( ) : string Get the reply-to address of this message.
getReturnPath ( ) : string Get the return-path (bounce address) of this message.
getSender ( ) : string Get the sender of this message.
getSubject ( ) : string Get the subject of this message.
getTo ( ) : array Get the To addresses of this message.
priority ( integer $priority ) Set the priority of this message.
replyTo ( string | array $email, string | null $name = null ) Set the reply-to address of this message.
send ( ) : integer Send the given Message like it would be sent in a mail client.
sender ( string | array $email, string | null $name = null ) Set the sender of this message.
setFormat ( string $format ) : string Set the format of this message (flowed or fixed).
setReadReceiptTo ( array $email ) Ask for a delivery receipt from the recipient to be sent to $addresses
setReturnPath ( string $email ) Set the return-path (the bounce address) of this message.
subject ( string $subject ) Set the subject of this message.
to ( string | array $email, string | null $name = null ) Set the to addresses of this message.

Protected Methods

Method Description
createAttachmentViaData ( string $data, string $name ) : Swift_Attachment Create a Swift Attachment instance from data.
createAttachmentViaPath ( string $file ) : Swift_Attachment Create a Swift new Attachment from a filesystem path.
createEmbedViaData ( string $data, string | null $name = null ) : Swift_Image Create a Swift new Image.
createEmbedViaPath ( string $file ) : Swift_Image Create a Swift new Image from a filesystem path.
normalizeEmail ( $email ) : array | string Normalize IDN domains.
prepareAttachment ( Swift_Attachment $attachment, array $options = [] ) Prepare and attach the given attachment.

Method Details

__construct() public method

Create a new Message using $mailer for sending from SwiftMailer
public __construct ( Manager $manager )
$manager Manager

attachment() public method

Events: - mailer:beforeAttachFile - mailer:afterAttachFile
See also: Phalcon\Mailer\Message::createAttachmentViaPath()
See also: Phalcon\Mailer\Message::prepareAttachment()
public attachment ( string $file, array $options = [] )
$file string
$options array optional

attachmentData() public method

Attach in-memory data as an attachment.
See also: Phalcon\Mailer\Message::createAttachmentViaData()
See also: Phalcon\Mailer\Message::prepareAttachment()
public attachmentData ( string $data, string $name, array $options = [] ) : Message
$data string
$name string
$options array optional
return Message

bcc() public method

If multiple recipients will receive the message an array should be used. Example: ['[email protected]', '[email protected]' => 'A name'] If $name is passed and the first parameter is a string, this name will be associated with the address.
See also: Swift_Message::setBcc()
public bcc ( string | array $email, string | null $name = null )
$email string | array
$name string | null optional

cc() public method

If multiple recipients will receive the message an array should be used. Example: ['[email protected]', '[email protected]' => 'A name'] If $name is passed and the first parameter is a string, this name will be associated with the address.
See also: Swift_Message::setCc()
public cc ( string | array $email, string | null $name = null )
$email string | array
$name string | null optional

charset() public method

Set the character set of this message.
See also: Swift_Message::setCharset()
public charset ( string $charset )
$charset string

content() public method

Set the body of this message, either as a string, or as an instance of {@link \Swift_OutputByteStream}.
See also: Swift_Message::setBody()
public content ( mixed $content, string $contentType = self::CONTENT_TYPE_HTML, string $charset = null )
$content mixed
$contentType string optional
$charset string optional

contentType() public method

Set the Content-type of this message.
See also: Swift_Message::setContentType()
public contentType ( string $contentType )
$contentType string

createAttachmentViaData() protected method

Create a Swift Attachment instance from data.
See also: Swift_Attachment::newInstance()
protected createAttachmentViaData ( string $data, string $name ) : Swift_Attachment
$data string
$name string optional
return Swift_Attachment

createAttachmentViaPath() protected method

Create a Swift new Attachment from a filesystem path.
See also: Swift_Attachment::fromPath()
protected createAttachmentViaPath ( string $file ) : Swift_Attachment
$file string
return Swift_Attachment

createEmbedViaData() protected method

Create a Swift new Image.
See also: Swift_Image::newInstance()
protected createEmbedViaData ( string $data, string | null $name = null ) : Swift_Image
$data string
$name string | null optional
return Swift_Image

createEmbedViaPath() protected method

Create a Swift new Image from a filesystem path.
See also: Swift_Image::fromPath()
protected createEmbedViaPath ( string $file ) : Swift_Image
$file string
return Swift_Image

embed() public method

Embed a file in the message and get the CID.
public embed ( string $file ) : string
$file string
return string

embedData() public method

Embed in-memory data in the message and get the CID.
public embedData ( string $data, string $name, string $contentType = null ) : string
$data string
$name string
$contentType string
return string

from() public method

You may pass an array of addresses if this message is from multiple people. Example: ['[email protected]', '[email protected]' => 'A name'] If $name is passed and the first parameter is a string, this name will be associated with the address.
See also: Swift_Message::setFrom()
public from ( string | array $email, string | null $name = null )
$email string | array
$name string | null optional

getBcc() public method

Get the Bcc addresses of this message.
See also: Swift_Message::getBcc()
public getBcc ( ) : array
return array

getCc() public method

Get the Cc address of this message.
See also: Swift_Message::getCc()
public getCc ( ) : array
return array

getCharset() public method

Get the character set of this message.
See also: Swift_Message::getCharset()
public getCharset ( ) : string
return string

getContent() public method

Get the body of this message as a string.
See also: Swift_Message::getBody()
public getContent ( ) : string
return string

getContentType() public method

Get the Content-type of this message.
See also: Swift_Message::getContentType()
public getContentType ( ) : string
return string

getFailedRecipients() public method

An array of email which failed send to recipients.
public getFailedRecipients ( ) : array
return array

getFormat() public method

Get the format of this message (i.e. flowed or fixed).
See also: Swift_Message::getFormat()
public getFormat ( ) : string
return string

getFrom() public method

Get the from address of this message.
See also: Swift_Message::getFrom()
public getFrom ( ) : string
return string

getManager() public method

Return a {@link \Phalcon\Mailer\Manager} instance
public getManager ( ) : Manager
return Manager

getMessage() public method

Return a {@link \Swift_Message} instance
public getMessage ( ) : Swift_Message
return Swift_Message

getPriority() public method

The returned value is an integer where 1 is the highest priority and 5 is the lowest.
See also: Swift_Message::getPriority()
public getPriority ( ) : integer
return integer

getReadReceiptTo() public method

Get the addresses to which a read-receipt will be sent.
See also: Swift_Message::getReadReceiptTo()
public getReadReceiptTo ( ) : string
return string

getReplyTo() public method

Get the reply-to address of this message.
See also: Swift_Message::getReplyTo()
public getReplyTo ( ) : string
return string

getReturnPath() public method

Get the return-path (bounce address) of this message.
See also: Swift_Message::getReturnPath()
public getReturnPath ( ) : string
return string

getSender() public method

Get the sender of this message.
See also: Swift_Message::getSender()
public getSender ( ) : string
return string

getSubject() public method

Get the subject of this message.
See also: Swift_Message::getSubject()
public getSubject ( ) : string
return string

getTo() public method

Get the To addresses of this message.
See also: Swift_Message::getTo()
public getTo ( ) : array
return array

normalizeEmail() protected method

Normalize IDN domains.
protected normalizeEmail ( $email ) : array | string
$email
return array | string

prepareAttachment() protected method

Prepare and attach the given attachment.
See also: Swift_Message::attach()
protected prepareAttachment ( Swift_Attachment $attachment, array $options = [] )
$attachment Swift_Attachment
$options array optional

priority() public method

The value is an integer where 1 is the highest priority and 5 is the lowest.
See also: Swift_Message::setPriority()
public priority ( integer $priority )
$priority integer

replyTo() public method

You may pass an array of addresses if replies will go to multiple people. Example: ['[email protected]', '[email protected]' => 'A name'] If $name is passed and the first parameter is a string, this name will be associated with the address.
See also: Swift_Message::setReplyTo()
public replyTo ( string | array $email, string | null $name = null )
$email string | array
$name string | null optional

send() public method

All recipients (with the exception of Bcc) will be able to see the other recipients this message was sent to. Recipient/sender data will be retrieved from the Message object. The return value is the number of recipients who were accepted for delivery. Events: - mailer:beforeSend - mailer:afterSend
See also: Swift_Mailer::send()
public send ( ) : integer
return integer

sender() public method

This does not override the From field, but it has a higher significance.
See also: Swift_Message::setSender()
public sender ( string | array $email, string | null $name = null )
$email string | array
$name string | null optional

setFormat() public method

Set the format of this message (flowed or fixed).
See also: Swift_Message::setFormat()
public setFormat ( string $format ) : string
$format string
return string

setReadReceiptTo() public method

Ask for a delivery receipt from the recipient to be sent to $addresses
See also: Swift_Message::setReadReceiptTo()
public setReadReceiptTo ( array $email )
$email array

setReturnPath() public method

Set the return-path (the bounce address) of this message.
See also: Swift_Message::setReturnPath()
public setReturnPath ( string $email )
$email string

subject() public method

Set the subject of this message.
See also: Swift_Message::setSubject()
public subject ( string $subject )
$subject string

to() public method

If multiple recipients will receive the message an array should be used. Example: ['[email protected]', '[email protected]' => 'A name'] If $name is passed and the first parameter is a string, this name will be associated with the address.
See also: Swift_Message::setTo()
public to ( string | array $email, string | null $name = null )
$email string | array
$name string | null optional

Property Details

$failedRecipients protected property

An array of email which failed send to recipients.
protected array $failedRecipients
return array

$manager protected property

protected Manager,Phalcon\Mailer $manager
return Manager

$message protected property

protected Swift_Message $message
return Swift_Message