Email


The email library provides a way to simply send plain text or html email. It enables you to easily use some common transactional email services via their API. Postmark, SendGrid, and Mandrill are supported at this time.

send()

Send an HTML email via the provider set up in email.conf.ini. You can also send HTML email via the $this->zajlib->template->email() (see docs) which is usually the prefered method so the email copy and code is separatly in a view file instead of mixed with the controller code.

string $from The email which is displayed as the from field.
string $to The email to which this message should be sent.
string $subject A string with the email’s subject.
string $body The email’s body.
bool|string $bcc If set, a copy of the email will be sent (bcc) to the specified email address. By default, no copy is sent.
bool|array $additional_headers Any additional email headers you may want to send defined as a key/value pair. You can send a plain text version with the key ‘TextBody’.
bool|integer $send_at Unix timestamp of the time at which to send the email (in case of delayed send) or false if no delay is needed (which is the default). Not all providers support this feature.
@return boolean True if successful, false otherwise.

send_html()

This method is deprecated. You should use $this->zajlib->template->email() (see docs) or send() (above) instead.

string $from The email which is displayed as the from field.
string $to The email to which this message should be sent.
string $subject A string with the email’s subject.
string $body The email’s body in HTML.
bool|string $sendcopyto If set, a copy of the email will be sent (bcc) to the specified email address. By default, no copy is sent.
bool|array $additional_headers Any additional email headers you may want to send defined as a key/value pair.
bool|integer $send_at Unix timestamp of the time at which to send the email (in case of delayed send) or false if no delay is needed (which is the default). Not all providers support this feature.
bool|string $text_body If set, text-version will be set to this. If not set, text version will be a strip-tagged version.
@return boolean True if successful, false otherwise.

get_named_email()

Parse an email address in “Mr. Name ” format. Returns an object {‘name’=>’Mr. Name’, ’email’=>’name@example.com’}.

string $email_address_with_name The email address to parse.
@return stdClass Returns an object {'name'=>'Mr. Name', 'email'=>'name@example.com'}. If no name specified, the ‘name’ property will be empty.

valid()

Checks and returns true if the email address is valid. You can specify whether to allow “Name ” formatting.

$will_be_true = $this->zajlib->email->valid('example@outlast.hu');

string $email The email address to test.
boolean $allow_named_format Set to true if you want to allow named format. False by default.
@return boolean Returns true if the email is valid, false otherwise.

Outlast Web & Mobile Development (c) 2023 | Privacy Policy |