\Disco\classesEmail

Email class.

Handle sending emails through different setup accounts. This class relies on the settings set in your application mail config app/config/mail.config.php.

Summary

Methods
Properties
Constants
__construct()
getSetting()
setSetting()
setCurrentAccount()
getCurrentAccount()
setCurrentServer()
getCurrentServer()
plainText()
delay()
send()
addAtachments()
getMessage()
sendMessage()
$plainTextOnly
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$settings
$delay
N/A

Properties

$plainTextOnly

$plainTextOnly : boolean

Type

boolean — Send emails as plain text only?

$settings

$settings : array

Type

array — Holds config data from `app/config/email.php`.

$delay

$delay : integer

Type

integer — The delay to apply to the next email sent.

Methods

__construct()

__construct() : void

Load our Email setting from `app/config/email.php` over riding any values set in `app/config/dev.email.php` if the application is in `DEV_MODE`.

getSetting()

getSetting(string  $key) : mixed

Get a email configuration setting.

Parameters

string $key

The key of the config.

Returns

mixed

setSetting()

setSetting(string  $key, mixed  $value) : void

Set a email configuration setting.

Parameters

string $key

The key of the config.

mixed $value

The value of the config

setCurrentAccount()

setCurrentAccount(string  $key) : void

Set the account to send emails through.

Parameters

string $key

The account key.

getCurrentAccount()

getCurrentAccount() : array

Get the account currently configuration to send emails through.

Returns

array —

The account configuration.

setCurrentServer()

setCurrentServer(string  $key) : void

Set the server configuration used to send emails through.

Parameters

string $key

The key of the server.

getCurrentServer()

getCurrentServer() : array

Get the server configuration currently being used to send emails through.

Returns

array —

The server confiuration.

plainText()

plainText(boolean  $bool = true) : void

Should we send the emails as plain text only?

Parameters

boolean $bool

Plain text only? True, False.

delay()

delay(integer  $s) : self

Push a Email job onto the Queue with a specified delay (in seconds).

Parameters

integer $s

The seconds to send the email after.

Returns

self

send()

send(string|array  $toEmail, string  $subject, string  $body, null|array  $attach = null) : boolean

Send an email through the current active account.

Parameters

string|array $toEmail

The email addresses to send this email to.

string $subject

The subject line of this email.

string $body

The body of this email.

null|array $attach

The attachments to include with this email.

Returns

boolean —

Success?

addAtachments()

addAtachments(\Swift_Message  $message, string|array  $attach) : \Swift_Message

Add attachments by absolute path to a \Swift_Message.

Parameters

\Swift_Message $message

The message to add the attachments to.

string|array $attach

The aboslute paths of the attachments.

Returns

\Swift_Message —

The message with the attachments

getMessage()

getMessage(string|array  $toEmail, string  $subject, string  $body) : \Swift_Message

Get a \Swift_Message thats preloaded with the to, subject, and body.

Parameters

string|array $toEmail

The email addresses to send this email to.

string $subject

The subject line of this email.

string $body

The body of this email.

Returns

\Swift_Message —

The message.

sendMessage()

sendMessage(\Swift_Message  $message) : boolean

Send a swiftmailer message.

Parameters

\Swift_Message $message

The message to send.

Throws

\Disco\exceptions\Email
\Swift_TransportException
\Exception

Returns

boolean