Methods

Driver constructor

__construct(array $config) 

Parameters

$config

array

driver config

Sets the alt body

alt_body(string $alt_body) : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Parameters

$alt_body

string

The message alt body

Returns

Attaches a file to the email.

attach(string $file, bool $inline, string $cid, string $mime, string $name) : \Email\Email_Driver

This method will search for the file in the attachment paths set (config/email.php) in the attach_paths array

fluent This method is part of a fluent interface and will return the same instance

Parameters

$file

string

The file to attach

$inline

bool

Whether to include the file inline

$cid

string

The content identifier. Used when attaching inline images

$mime

string

The file's mime-type

$name

string

The attachment's name

Exceptions

\InvalidAttachmentsException Could not read attachment or attachment is empty

Returns

Add to the bcc recipients list.

bcc(string | array $email, string | bool $name) : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Parameters

$email

stringarray

Email address or list of email addresses, array(email => name, email)

$name

stringbool

Recipient name, false, null or empty for no name

Returns

Sets the body

body(string $body) : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Parameters

$body

string

The message body

Returns

Add to the cc recipients list.

cc(string | array $email, string | bool $name) : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Parameters

$email

stringarray

Email address or list of email addresses, array(email => name, email)

$name

stringbool

Recipient name, false, null or empty for no name

Returns

Clear all address lists.

clear_addresses() : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Returns

Clear the attachments list.

clear_attachments() : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Returns

Clear the 'bcc' recipient list.

clear_bcc() : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Returns

Clear the 'cc' recipient list.

clear_cc() : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Returns

Clear all recipient lists.

clear_recipients() : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Returns

Clear the 'reply to' recipient list.

clear_reply_to() : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Returns

Clear the 'to' recipient list.

clear_to() : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Returns

Sets the from address and name

from(string $email, bool | string $name) : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Parameters

$email

string

The from email address

$name

boolstring

The optional from name

Returns

Gets to bcc recipients list.

get_bcc() : array

Returns

arrayto bcc recipients list

Gets the body

get_body() : string

Returns

stringthe message body

Gets to cc recipients list.

get_cc() : array

Returns

arrayto cc recipients list

Get a driver config setting.

get_config(string $key, string $default) : mixed

Parameters

$key

string

Config key

$default

string

Default value

Returns

mixedthe config setting value

Gets from address and name

get_from() : array

Returns

arrayfrom address and name

Get the invalid addresses

get_invalid_addresses() : array

Returns

arrayAn array of invalid email addresses

Gets to 'reply to' recipients list.

get_reply_to() : array

Returns

arrayto 'reply to' recipients list

Gets the message subject

get_subject() : string

Returns

stringthe message subject

Gets to recipients list.

get_to() : array

Returns

arrayto recipients list

Sets custom headers.

header(string | array $header, string $value) : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Parameters

$header

stringarray

Header type or array of headers

$value

string

Header value

Returns

Sets the html body and optionally a generated alt body.

html_body(string $html, bool $generate_alt, bool $auto_attach) : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Parameters

$html

string

The body html

$generate_alt

bool

Whether to generate the alt body, will set is html to true

$auto_attach

bool

Whether to auto attach inline files

Returns

Enables or disables driver pipelining.

pipelining(bool $pipelining) : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Parameters

$pipelining

bool

Whether or not to enable pipelining

Returns

Sets the mail priority

priority(string $priority) : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Parameters

$priority

string

The message priority

Returns

Add to the 'reply to' list.

reply_to(string | array $email, string | bool $name) : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Parameters

$email

stringarray

Email address or list of email addresses, array(email => name, email)

$name

stringbool

The name, false, null or empty for no name

Returns

Sets the return-path address

return_path(string $email) : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Parameters

$email

string

The return-path email address

Returns

Initiates the sending process.

send(bool $validate) : bool

Parameters

$validate

bool

Whether to validate the addresses, falls back to config setting

Exceptions

\EmailValidationFailedException One or more email addresses did not pass validation
\FuelException Cannot send without from address/Cannot send without recipients

Returns

bool

Set a driver config setting.

set_config(string $key, mixed $value) : object

Parameters

$key

string

the config key

$value

mixed

the new config value

Returns

object$this

Attach a file using string input

string_attach(string $contents, string $filename, string $cid, bool $inline, string $mime) : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Parameters

$contents

string

File contents

$filename

string

The files name

$cid

string

The content identifier. Used when attaching inline images

$inline

bool

Whether it's an inline attachment

$mime

string

The file's mime-type

Returns

Sets the message subject

subject(string $subject) : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Parameters

$subject

string

The message subject

Returns

Add to the to recipients list.

to(string | array $email, string | bool $name) : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Parameters

$email

stringarray

Email address or list of email addresses, array(email => name, email)

$name

stringbool

Recipient name, false, null or empty for no name

Returns

Initiates the sending process.

_send() : bool

Returns

boolsuccess boolean

Add to a recipients list.

add_to_list(string $list, string | array $email, string | bool $name) : void

Parameters

$list

string

List to add to (to, cc, bcc)

$email

stringarray

Email address or list of email addresses, array(email => name, email)

$name

stringbool

Recipient name, false, null or empty for no name

Get the mimetype for an attachment

attachment_mime(string $file) : \Email\Email_Driver

fluent This method is part of a fluent interface and will return the same instance

Parameters

$file

string

The path to the attachment

Returns

Builds the headers and body

build_message(bool $no_bcc) : array

Parameters

$no_bcc

bool

Whether to exclude Bcc headers.

Returns

arrayAn array containing the headers and the body

Clear the a recipient list.

clear_list(string | array $list) : void

Parameters

$list

stringarray

List or array of lists

Encodes a mimeheader.

encode_mimeheader(string $header) : string

Parameters

$header

string

Header to encode

Returns

stringMimeheader encoded string

Encodes a string in the given encoding.

encode_string(string $string, string $encoding, string $newline) : string

Parameters

$string

string

String to encode

$encoding

string

The charset

$newline

string

Newline delimeter

Exceptions

\InvalidEmailStringEncoding Encoding is not a supported by encoding method

Returns

stringEncoded string

Finds an attachment.

find_attachment($file) : string

Parameters

$file

Exceptions

\AttachmentNotFoundException Email attachment not found

Returns

stringpath of the first found attachment

Returns a formatted string of email addresses.

format_addresses(array $addresses) : string

Parameters

$addresses

array

Array of adresses array(array(name=>name, email=>email));

Returns

stringCorrectly formatted email addresses

Generates an alt body

generate_alt(string $html, int $wordwrap, string $newline) : string

Parameters

$html

string

html Body to al body generate from

$wordwrap

int

Wordwrap length

$newline

string

Line separator to use

Returns

stringThe generated alt body

Get the attachment headers

get_attachment_headers($type, $boundary) 

Parameters

$type

$boundary

Returns the content type

get_content_type(string $mail_type, $boundary) : string

Parameters

$mail_type

string

Type of email (plain, html, html_inline, etc…)

$boundary

Exceptions

\FuelException Invalid content-type

Returns

stringMail content type

Gets the header

get_header(string $header, bool $formatted) : string | array

Parameters

$header

string

The header name. Will return all headers, if not specified

$formatted

bool

Adds newline as suffix and colon as prefix, if true

Returns

stringarrayMail header or array of headers

Returns the mail's type

get_mail_type() : string

Returns

stringMail type

Get a unique message id

get_message_id() : string

Returns

stringThe message id

Standardize newlines.

prep_newlines(string $string, string $newline) : string

Parameters

$string

string

String to prep

$newline

string

The newline delimiter

Returns

stringString with standardized newlines

Sets unique message boundaries

set_boundaries() 

Sets the message headers

set_header(string $header, string $value) 

Parameters

$header

string

The header type

$value

string

The header value

Validates all the email addresses.

validate_addresses() : bool | array

Returns

boolarrayTrue if all are valid or an array of recipients which failed validation.

 Properties

 

Message alt body

$alt_body 

 

Attachments array

$attachments 

 

Bcc recipients list

$bcc 

 

Message body

$body 

 

Message boundaries

$boundaries 

 

Cc recipients list

$cc 

 

Driver config

$config 

 

Custom headers

$extra_headers 

 

Message headers

$headers 

 

Invalid addresses

$invalid_addresses 

 

Pipelining enabled?

$pipelining 

 

Reply to list

$reply_to 

 

Message subject

$subject 

 

To recipients list

$to 

 

Mail type

$type