EMail
in package
Email Utility.
Table of Contents
Properties
- $defaultConfig : array{wordwrap: bool, mailtype: "text"|"html", charset: string, priority: int, crlf: string, newline: string}
- Email default settings.
Methods
- attach() : string
- Assign file attachments.
- attachmentCid() : string
- Set and return attachment Content-ID. Useful for attached inline pictures.
- bcc() : string
- Set BCC email address.
- from() : string
- Set the sender.
- initialize() : string
- Initialize EMail.
- message() : string
- Set Body.
- messageFromTemplate() : string
- Set the mail body based on Template.
- messageFromXml() : string
- Set the mail body based on XML.
- send() : void
- Send.
- setMailType() : string
- Set mail type.
- subject() : string
- Set Subject.
- to() : string
- Set Destination email address.
- email() : CI_Email
- Get CI_Email instance.
- template() : Template
- Get Template instance.
Properties
$defaultConfig
Email default settings.
private
static array{wordwrap: bool, mailtype: "text"|"html", charset: string, priority: int, crlf: string, newline: string}
$defaultConfig
= [
// 'useragent' => 'CodeIgniter',
// 'protocol' => 'mail',
// 'mailpath' => '/usr/sbin/sendmail',
// 'smtp_host' => null,
// 'smtp_user' => null,
// 'smtp_pass' => null,
// 'smtp_port' => 25,
// 'smtp_timeout' => 5,
// 'smtp_keepalive' => false,
// 'smtp_crypto' => null,
'wordwrap' => false,
// 'wrapchars' => 76,
'mailtype' => 'text',
'charset' => 'utf-8',
// 'validate' => false,
'priority' => 1,
'crlf' => "\r\n",
'newline' => "\r\n",
]
Methods
attach()
Assign file attachments.
public
static attach(string $file[, string $disposition = '' ][, string $newname = null ][, string $mime = '' ]) : string
Parameters
- $file : string
-
File name.
- $disposition : string = ''
-
(optional) "disposition" of the attachment.
- $newname : string = null
-
(optional) Custom file name to use in the e-mail.
- $mime : string = ''
-
(optional) MIME type to use (useful for buffered data).
Return values
string —This class name.
attachmentCid()
Set and return attachment Content-ID. Useful for attached inline pictures.
public
static attachmentCid(string $filename) : string
Parameters
- $filename : string
-
Existing attachment filename.
Return values
string —Attachment Content-ID or FALSE if not found.
bcc()
Set BCC email address.
public
static bcc(string $bcc[, string $limit = '' ]) : string
Parameters
- $bcc : string
-
BCC email address.
- $limit : string = ''
-
(optional) BCC Batch max number size. Default is blank.
Return values
stringfrom()
Set the sender.
public
static from(string $from[, string $fromName = '' ][, string $returnPath = null ]) : string
Parameters
- $from : string
-
Sender's email address.
- $fromName : string = ''
-
(optional) Sender name.
- $returnPath : string = null
-
(optional) Return-Path.
Return values
stringinitialize()
Initialize EMail.
public
static initialize([array<string|int, mixed> $config = array() ]) : string
Parameters
- $config : array<string|int, mixed> = array()
-
EMail settings.
Return values
string —This class name.
message()
Set Body.
public
static message(string $body) : string
Parameters
- $body : string
-
Body.
Return values
string —This class name.
messageFromTemplate()
Set the mail body based on Template.
public
static messageFromTemplate(string $templatePath[, array<string|int, mixed> $params = [] ]) : string
Parameters
- $templatePath : string
-
Path of the Template file. Relative path from
application/views/
. - $params : array<string|int, mixed> = []
-
(optional) Embedded variables for subject and body text.
Return values
string —This class name.
messageFromXml()
Set the mail body based on XML.
public
static messageFromXml(string $xmlPath[, array<string|int, mixed> $params = [] ]) : string
Parameters
- $xmlPath : string
-
Path of the XML file. Relative path from
application/views/
. - $params : array<string|int, mixed> = []
-
(optional) Embedded variables for subject and body text.
Return values
string —This class name.
send()
Send.
public
static send([bool $autoClear = true ]) : void
Parameters
- $autoClear : bool = true
-
(optional) Whether to clear the destination and other transmission information after transmission. Default is true.
setMailType()
Set mail type.
public
static setMailType(["text"|"html" $type = 'text' ]) : string
Parameters
- $type : "text"|"html" = 'text'
-
(optional) Mail type. Default is "text".
Return values
string —This class name.
subject()
Set Subject.
public
static subject(string $subject) : string
Parameters
- $subject : string
-
Subject.
Return values
string —This class name.
to()
Set Destination email address.
public
static to(string $to) : string
Parameters
- $to : string
-
Destination email address.
Return values
string —This class name.
email()
Get CI_Email instance.
private
static email() : CI_Email
Return values
CI_Email —CI_Email instance.
template()
Get Template instance.
private
static template() : Template
Return values
Template —Template instance.