PHP Class SimpleEmailServiceMessage

Mostra file Open project: daniel-zahariev/php-aws-ses Class Usage Examples

Public Properties

Property Type Description
$attachments
$bcc these are not to be used outside of the SimpleEmailService class!
$cc these are not to be used outside of the SimpleEmailService class!
$customHeaders
$from
$messageHtmlCharset
$messageTextCharset
$messagehtml
$messagetext
$recipientsCharset these are not to be used outside of the SimpleEmailService class!
$replyto these are not to be used outside of the SimpleEmailService class!
$returnpath
$subject
$subjectCharset
$to these are not to be used outside of the SimpleEmailService class!

Public Methods

Method Description
__construct ( )
addAttachmentFromData ( string $name, string $data, string $mimeType = 'application/octet-stream', string $contentId = null, string $attachmentType = 'attachment' ) : SimpleEmailServiceMessage Add email attachment by directly passing the content
addAttachmentFromFile ( string $name, string $path, string $mimeType = 'application/octet-stream', string $contentId = null, string $attachmentType = 'attachment' ) : boolean Add email attachment by passing file path
addAttachmentFromUrl ( string $name, string $url, string $mimeType = 'application/octet-stream', string $contentId = null, string $attachmentType = 'attachment' ) : boolean Add email attachment by passing file path
addBCC ( $bcc )
addCC ( $cc )
addCustomHeader ( string $header ) : SimpleEmailServiceMessage Add custom header - this works only with SendRawEmail
addReplyTo ( $replyto )
addTo ( $to ) addTo, addCC, addBCC, and addReplyTo have the following behavior: If a single address is passed, it is appended to the current list of addresses.
clearBCC ( ) Clear the BCC: email address(es) for the message
clearCC ( ) Clear the CC: email address(es) for the message
clearRecipients ( ) Clear all of the message recipients in one go
clearReplyTo ( ) Clear the Reply-To: email address(es) for the message
clearTo ( ) Clear the To: email address(es) for the message
encodeRecipients ( $recipient ) : string Encode recipient with the specified charset in recipientsCharset
getRawMessage ( ) : string Get the raw mail message
hasInlineAttachments ( ) : boolean Get the existence of attached inline messages
setFrom ( $from )
setMessageCharset ( $textCharset, $htmlCharset = null )
setMessageFromFile ( $textfile, $htmlfile = null )
setMessageFromString ( $text, $html = null )
setMessageFromURL ( $texturl, $htmlurl = null )
setRecipientsCharset ( $charset )
setReturnPath ( $returnpath )
setSubject ( $subject )
setSubjectCharset ( $charset )
validate ( ) : boolean Validates whether the message object has sufficient information to submit a request to SES.

Method Details

__construct() public method

public __construct ( )

addAttachmentFromData() public method

Add email attachment by directly passing the content
public addAttachmentFromData ( string $name, string $data, string $mimeType = 'application/octet-stream', string $contentId = null, string $attachmentType = 'attachment' ) : SimpleEmailServiceMessage
$name string The name of the file attachment as it will appear in the email
$data string The contents of the attachment file
$mimeType string Specify custom MIME type
$contentId string Content ID of the attachment for inclusion in the mail message
$attachmentType string Attachment type: attachment or inline
return SimpleEmailServiceMessage $this

addAttachmentFromFile() public method

Add email attachment by passing file path
public addAttachmentFromFile ( string $name, string $path, string $mimeType = 'application/octet-stream', string $contentId = null, string $attachmentType = 'attachment' ) : boolean
$name string The name of the file attachment as it will appear in the email
$path string Path to the attachment file
$mimeType string Specify custom MIME type
$contentId string Content ID of the attachment for inclusion in the mail message
$attachmentType string Attachment type: attachment or inline
return boolean Status of the operation

addAttachmentFromUrl() public method

Add email attachment by passing file path
public addAttachmentFromUrl ( string $name, string $url, string $mimeType = 'application/octet-stream', string $contentId = null, string $attachmentType = 'attachment' ) : boolean
$name string The name of the file attachment as it will appear in the email
$url string URL to the attachment file
$mimeType string Specify custom MIME type
$contentId string Content ID of the attachment for inclusion in the mail message
$attachmentType string Attachment type: attachment or inline
return boolean Status of the operation

addBCC() public method

See also: addTo()
public addBCC ( $bcc )

addCC() public method

See also: addTo()
public addCC ( $cc )

addCustomHeader() public method

Add custom header - this works only with SendRawEmail
public addCustomHeader ( string $header ) : SimpleEmailServiceMessage
$header string Your custom header
return SimpleEmailServiceMessage $this

addReplyTo() public method

See also: addTo()
public addReplyTo ( $replyto )

addTo() public method

If an array of addresses is passed, that array is merged into the current list.
public addTo ( $to )

clearBCC() public method

Clear the BCC: email address(es) for the message
public clearBCC ( )

clearCC() public method

Clear the CC: email address(es) for the message
public clearCC ( )

clearRecipients() public method

Clear all of the message recipients in one go
public clearRecipients ( )

clearReplyTo() public method

Clear the Reply-To: email address(es) for the message
public clearReplyTo ( )

clearTo() public method

Clear the To: email address(es) for the message
public clearTo ( )

encodeRecipients() public method

Encode recipient with the specified charset in recipientsCharset
public encodeRecipients ( $recipient ) : string
return string Encoded recipients joined with comma

getRawMessage() public method

Get the raw mail message
public getRawMessage ( ) : string
return string

hasInlineAttachments() public method

Get the existence of attached inline messages
public hasInlineAttachments ( ) : boolean
return boolean

setFrom() public method

public setFrom ( $from )

setMessageCharset() public method

public setMessageCharset ( $textCharset, $htmlCharset = null )

setMessageFromFile() public method

public setMessageFromFile ( $textfile, $htmlfile = null )

setMessageFromString() public method

public setMessageFromString ( $text, $html = null )

setMessageFromURL() public method

public setMessageFromURL ( $texturl, $htmlurl = null )

setRecipientsCharset() public method

public setRecipientsCharset ( $charset )

setReturnPath() public method

public setReturnPath ( $returnpath )

setSubject() public method

public setSubject ( $subject )

setSubjectCharset() public method

public setSubjectCharset ( $charset )

validate() public method

This does not guarantee the message will arrive, nor that the request will succeed; instead, it makes sure that no required fields are missing. This is used internally before attempting a SendEmail or SendRawEmail request, but it can be used outside of this file if verification is desired. May be useful if e.g. the data is being populated from a form; developers can generally use this function to verify completeness instead of writing custom logic.
public validate ( ) : boolean
return boolean

Property Details

$attachments public_oe property

public $attachments

$bcc public_oe property

these are not to be used outside of the SimpleEmailService class!
public $bcc

$cc public_oe property

these are not to be used outside of the SimpleEmailService class!
public $cc

$customHeaders public_oe property

public $customHeaders

$from public_oe property

public $from

$messageHtmlCharset public_oe property

public $messageHtmlCharset

$messageTextCharset public_oe property

public $messageTextCharset

$messagehtml public_oe property

public $messagehtml

$messagetext public_oe property

public $messagetext

$recipientsCharset public_oe property

these are not to be used outside of the SimpleEmailService class!
public $recipientsCharset

$replyto public_oe property

these are not to be used outside of the SimpleEmailService class!
public $replyto

$returnpath public_oe property

public $returnpath

$subject public_oe property

public $subject

$subjectCharset public_oe property

public $subjectCharset

$to public_oe property

these are not to be used outside of the SimpleEmailService class!
public $to