expMail
in package
This is the class expMail expMail is an integrator class, bringing the flexibility of SwiftMail into Exponent gracefully.
More docs to follow as I become more familiar with SwiftMail.
Tags
Table of Contents
- $bcc : mixed
- $cc : mixed
- $from : mixed
- $subject : mixed
- $to : mixed
- $errStack : mixed
- $log : mixed
- $mailer : mixed
- $message : mixed
- $postcalldata : mixed
- $postcallfunction : mixed
- $precalldata : mixed
- $precallfunction : mixed
- $transport : mixed
- __construct() : mixed
- __construct() - This function constructs the message to be send in this object, filling it out with connection information based on the site config.
- __destruct() : mixed
- expMail class destructor
- addBcc() : mixed
- addBcc() - This adds Blind Carbon Copy addresses to the message one at a time, so if you want to add multiple BCC's it is best to run through a loop in order to put them in.
- addCc() : mixed
- addCc() - This adds Carbon Copy addresses to the message one at a time, so if you want to add multiple CC's it is best to run through a loop in order to put them in.
- addFrom() : mixed
- addFrom() - This adds the singular From address, if you call it twice, it will replace the old from address.
- addHeaders() : mixed
- addHeaders() - Add text headers to the message. Limited to text headers for now.
- addHTML() : mixed
- addHTML() - This function is similar to setHTMLBody except that it includes the HTML in the message body rather than sets it as default. Many mail clients will read the HTML over plain text as default behavior, so even if you use setTextBody and addHTML, they will default to reading the HTML.
- addRaw() : mixed
- addRaw() - This is a wrapper around setHTMLBody for backwards compatibility
- addSubject() : mixed
- subject() - This will set the subject of the message, ensuring first that message has been instantiated.
- addText() : mixed
- addText() - This function is similar to the addHTML function above, it adds a plain text part to the message in case your recipient cannot receive HTML email, if you have added a text version of the email, they will have this to fall back on.
- addTo() : mixed
- addTo() - This adds people to the Recipient List in the To Field.
- attach_file_on_disk() : mixed
- attach_file_on_disk() - This function will utilize the swift mailer's ability to attach files that are on disk, unlike the one above, which just attached one that is available in memory.
- batchSend() : void
- batchSend() - Does not seem to be working correctly. Use at your own risk!
- clearBody() : mixed
- clearBody() - This function will set the body of the message to empty, a blank text string
- flushRecipients() : mixed
- flushRecipients() - this will clear all of the recipients in the To array, ignoring CC and BCC
- messageId() : array<string|int, mixed>
- messageId() - This will return the unique ID of the mail message.
- quickBatchSend() : bool|int
- quickBatchSend() - a quick way to send a batch of emails one at a time This function is similar to quickSend, but sends each email separately to protect others identity in the mailing
- quickSend() : int
- quickSend() - This is a quick method for sending email messages. It only requires a message value be passed in an associative array, (or else the message fails immediately).
- send() : int
- send() - This is the main method for sending email messages.If there is not a from address, it defaults to the one stored in the Exponent config.
- setHTMLBody() : mixed
- setHTMLBody() - This function sets the main version of the message to HTML.
- setTextBody() : mixed
- setTextBody() - This function sets the main version of the message to plain text. No HTML
- test() : mixed
- test() - Does the mail system seem to be working correctly? This is useless for the Native mail system
Properties
$bcc
public
mixed
$bcc
= \null
$cc
public
mixed
$cc
= \null
$from
public
mixed
$from
= \null
$subject
public
mixed
$subject
= \null
$to
public
mixed
$to
= \null
$errStack
private
mixed
$errStack
= \null
$log
private
mixed
$log
= \null
$mailer
private
mixed
$mailer
= \null
$message
private
mixed
$message
= \null
$postcalldata
private
mixed
$postcalldata
= \null
$postcallfunction
private
mixed
$postcallfunction
= \null
$precalldata
private
mixed
$precalldata
= \null
$precallfunction
private
mixed
$precallfunction
= \null
$transport
private
mixed
$transport
= \null
Methods
__construct()
__construct() - This function constructs the message to be send in this object, filling it out with connection information based on the site config.
public
__construct([array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $params : array<string|int, mixed> = array()
-
You can specify which method by which you would like to send mail.
Tags
Return values
mixed —__destruct()
expMail class destructor
public
__destruct() : mixed
Return values
mixed —addBcc()
addBcc() - This adds Blind Carbon Copy addresses to the message one at a time, so if you want to add multiple BCC's it is best to run through a loop in order to put them in.
public
addBcc(string|array<string|int, mixed> $email[, string $name = null ]) : mixed
Parameters
- $email : string|array<string|int, mixed>
-
This is the email address for the BCC.
- $name : string = null
-
This is the name associated with the above email address.
Tags
Return values
mixed —addCc()
addCc() - This adds Carbon Copy addresses to the message one at a time, so if you want to add multiple CC's it is best to run through a loop in order to put them in.
public
addCc(string|array<string|int, mixed> $email[, string $name = null ]) : mixed
Parameters
- $email : string|array<string|int, mixed>
-
This is the email address for the CC.
- $name : string = null
-
This is the name associated with the above email address.
Tags
Return values
mixed —addFrom()
addFrom() - This adds the singular From address, if you call it twice, it will replace the old from address.
public
addFrom([string|array<string|int, mixed> $email = null ]) : mixed
It also sets the private var from with whatever you desire. This is a relic from the Swift 3.x days and should be gutted out the next time someone upgrades the mailer.
Parameters
- $email : string|array<string|int, mixed> = null
-
This is the email address you want to use as the sender.
Tags
Return values
mixed —addHeaders()
addHeaders() - Add text headers to the message. Limited to text headers for now.
public
addHeaders(array<string|int, mixed> $headers) : mixed
Parameters
- $headers : array<string|int, mixed>
-
Array of text headers to add to the message
Tags
Return values
mixed —addHTML()
addHTML() - This function is similar to setHTMLBody except that it includes the HTML in the message body rather than sets it as default. Many mail clients will read the HTML over plain text as default behavior, so even if you use setTextBody and addHTML, they will default to reading the HTML.
public
addHTML(string $html) : mixed
setHTMLBody is to be preferred as the default for setting the body of the email.
Parameters
- $html : string
-
This is the html that you want added to the message.
Tags
Return values
mixed —addRaw()
addRaw() - This is a wrapper around setHTMLBody for backwards compatibility
public
addRaw( $body) : mixed
Parameters
Tags
Return values
mixed —addSubject()
subject() - This will set the subject of the message, ensuring first that message has been instantiated.
public
addSubject(string $subj) : mixed
Parameters
- $subj : string
-
This is the string that you want to be used as the subject for the message, it must be plain text.
Tags
Return values
mixed —addText()
addText() - This function is similar to the addHTML function above, it adds a plain text part to the message in case your recipient cannot receive HTML email, if you have added a text version of the email, they will have this to fall back on.
public
addText(string $text) : mixed
Every email send out should have an HTML version and a TEXT version.
Parameters
- $text : string
-
This is the text version of the email you are sending along with the HTML
Tags
Return values
mixed —addTo()
addTo() - This adds people to the Recipient List in the To Field.
public
addTo([array<string|int, mixed>|string $email = null ]) : mixed
If the first variable passed is an array, it assumes you are sending messages to multiple people. If you want to add people with their names associated with the email, you must use an outside for loop. This function does not yet support the parsing of associative arrays for a quick add to the To recipient list.
Parameters
- $email : array<string|int, mixed>|string = null
-
This is the string or array to send email to
Tags
Return values
mixed —attach_file_on_disk()
attach_file_on_disk() - This function will utilize the swift mailer's ability to attach files that are on disk, unlike the one above, which just attached one that is available in memory.
public
attach_file_on_disk(string $file_to_attach, string $file_type) : mixed
Parameters
- $file_to_attach : string
-
This is the path to the file that you want to attach to the message
- $file_type : string
-
This is the MIME type of the file that you are attaching
Tags
Return values
mixed —batchSend()
batchSend() - Does not seem to be working correctly. Use at your own risk!
public
batchSend() : void
This should probably be taken out as it look like a failed attempt to use the old-school AntiFlood plugin This is leftover code from Swift 3.x
Tags
Return values
void —clearBody()
clearBody() - This function will set the body of the message to empty, a blank text string
public
clearBody() : mixed
Tags
Return values
mixed —flushRecipients()
flushRecipients() - this will clear all of the recipients in the To array, ignoring CC and BCC
public
flushRecipients() : mixed
Tags
Return values
mixed —messageId()
messageId() - This will return the unique ID of the mail message.
public
messageId() : array<string|int, mixed>
Courtesy of the underlying Swift mailer:
ID headers contain identifiers for the entity (or the message). The most notable ID header is the Message-ID header on the message itself.
An ID that exists inside an ID header looks more-or-less less like an email address. For example, 1234955437.499becad62ec2@example.org. The part to the left of the @ sign is usually unique, based on the * current time and some random factor. The part on the right is usually a domain name.
Tags
Return values
array<string|int, mixed> —quickBatchSend()
quickBatchSend() - a quick way to send a batch of emails one at a time This function is similar to quickSend, but sends each email separately to protect others identity in the mailing
public
quickBatchSend([array<string|int, mixed> $params = array() ]) : bool|int
Parameters
- $params : array<string|int, mixed> = array()
Tags
Return values
bool|int —quickSend()
quickSend() - This is a quick method for sending email messages. It only requires a message value be passed in an associative array, (or else the message fails immediately).
public
quickSend([array<string|int, mixed> $params = array() ]) : int
Parameters
- $params : array<string|int, mixed> = array()
-
This is the associative array required to send the email. The minimum basics for sending an email are: -html_message or -text_message If a from or a to is not specified, the send method will pull the default SMTP_FROMADDRESS from the site config. Usable parameters include: -to -from -subject -html_message -text_message -headers
Tags
Return values
int —number of recipients to which the email was successfully sent.
send()
send() - This is the main method for sending email messages.If there is not a from address, it defaults to the one stored in the Exponent config.
public
send() : int
Tags
Return values
int —number of recipients to which the email was successfully sent.
setHTMLBody()
setHTMLBody() - This function sets the main version of the message to HTML.
public
setHTMLBody(string $html) : mixed
Parameters
- $html : string
-
This is the HTML that you want set as the body
Tags
Return values
mixed —setTextBody()
setTextBody() - This function sets the main version of the message to plain text. No HTML
public
setTextBody(string $text) : mixed
Parameters
- $text : string
-
This is the text version of the email you are sending
Tags
Return values
mixed —test()
test() - Does the mail system seem to be working correctly? This is useless for the Native mail system
public
test() : mixed