CMS Made Simple API

cms_mailer
in package

A class for sending email.

Prior to CMSMS 2.0 this class was implemented as a core module.

Tags
license

GPL

since
2.0
author

Robert Campbell (calguy1000@cmsmadesimple.org)

Table of Contents

Methods

__construct()  : mixed
Constructor
__get()  : mixed
__isset()  : bool
__set()  : mixed
AddAddress()  : bool
Add a "To" address.
AddAttachment()  : bool
Adds an attachment from a path on the filesystem
AddBCC()  : bool
Add a "BCC" (Blind Carbon Copy) address
AddCC()  : bool
Add a "CC" (Carbon Copy) address
AddCustomHeader()  : mixed
Add a custom header to the output email
AddEmbeddedImage()  : bool
Adds an embedded attachment. This can include images, sounds, and just about any other document. Make sure to set the $type to an image type. For JPEG images use "image/jpeg" and for GIF images use "image/gif".
AddReplyTo()  : bool
Adds a "Reply-to" address.
AddStringAttachment()  : mixed
Adds a string or binary attachment (non-filesystem) to the list.
ClearAddresses()  : mixed
Clears all recipients in the To list
ClearAllRecipients()  : mixed
Clears all recipients in the To,CC, and BCC lists
ClearAttachments()  : mixed
Clears all attachments
ClearBCCs()  : mixed
Clear all recipients on the BCC list
ClearCCs()  : mixed
Clear all recipients on the CC list
ClearCustomHeaders()  : mixed
Clear all custom headers
ClearReplyTos()  : mixed
Clear the Reply-To list
GetAltBody()  : string
Retrieve the alternate body of the email message
GetBody()  : string
Retrieve the body of the email message
GetCharSet()  : string
Return the character set for the email
GetConfirmReadingTo()  : string
Retrieve the reading confirmation email address
GetEncoding()  : string
Get the encoding of the message.
GetErrorInfo()  : string
Return the error information from the last error.
GetFrom()  : string
Get the from address for the email
GetFromName()  : string
Get the real name that the email will be sent from
GetHelo()  : string
Gets the SMTP HELO of the message
GetHostname()  : string
Get the hostname that will be used in the Message-Id and Recieved headers and the default HELO string.
GetMailer()  : string
Retrieve the name of the mailer that will be used to send the message.
GetPriority()  : int
Get the priority of the message
GetSender()  : string
Get the Sender (return-path) of the message.
GetSendmail()  : mixed
Get the path to the sendmail executable
GetSMTPAuth()  : bool
Retrieve the SMTP Auth flag
GetSMTPDebug()  : bool
Get the current value of the SMTP Debug flag
GetSMTPHost()  : string
Get the SMTP host values
GetSMTPKeepAlive()  : bool
Return the value of the SMTP keepalive flag
GetSMTPPassword()  : string
Get the SMTP password
GetSMTPPort()  : int
Get the default SMTP port number
GetSMTPSecure()  : string
Gets the secure SMTP connection mode, or none
GetSMTPTimeout()  : int
Get the SMTP server timeout (in seconds).
GetSMTPUsername()  : string
Get the SMTP username
GetSubject()  : string
Retrieve the subject of the message
GetWordWrap()  : int
Get the number of characters used in word wrapping. 0 indicates that no word wrapping will be performed.
IsError()  : bool
Test if there was an error on the last message send
IsHTML()  : mixed
Set the message type to HTML.
IsMail()  : bool
Test if the mailer is set to 'mail'
IsSendmail()  : bool
Test if the mailer is set to 'sendmail'
IsSMTP()  : bool
Test if the mailer is set to 'SMTP'
reset()  : mixed
Reset the mailer to standard settings We use the set global preferences here
Send()  : bool
Send the current message using all current settings.
SetAltBody()  : mixed
Set the alternate body of the email message
SetBody()  : mixed
Set the body of the email message.
SetCharSet()  : mixed
Set the character set for the message.
SetConfirmReadingTo()  : mixed
Set the email address that confirmations of email reading will be sent to.
SetEncoding()  : mixed
Sets the encoding of the message.
SetFrom()  : mixed
Set the from address for the email
SetFromName()  : mixed
Set the real name that this email will be sent from.
SetHelo()  : mixed
Sets the SMTP HELO of the message (Default is $Hostname)
SetHostname()  : mixed
Set the hostname to use in the Message-Id and Received headers and as the default HELO string. If empty the value will be calculated
SetLanguage()  : mixed
Set the language for all error messages
SetMailer()  : mixed
Set the name of the mailer that will be used to send the message.
SetPriority()  : mixed
Set the priority of the message (1 = High, 3 = Normal, 5 = low)
SetSender()  : mixed
Set the Sender email (return-path) of the message.
SetSendmail()  : mixed
Set the path to the sendmail executable
SetSMTPAuth()  : mixed
Set a flag indicating wether or not SMTP authentication is to be used when sending mails via the SMTP mailer.
SetSMTPDebug()  : mixed
Enable, or disable SMTP debugging
SetSMTPHost()  : mixed
Set the SMTP host(s).
SetSMTPKeepAlive()  : mixed
Prevents the SMTP connection from being closed after sending each message.
SetSMTPPassword()  : mixed
Set the SMTP password
SetSMTPPort()  : mixed
Set the default SMTP port
SetSMTPSecure()  : mixed
Set the secure SMTP connection mode, or none possible values are "", "ssl", or "tls"
SetSMTPTimeout()  : mixed
Set the SMTP server timeout in seconds (for the SMTP mailer) This function may not work with the win32 version.
SetSMTPUsername()  : mixed
Set the SMTP Username.
SetSubject()  : mixed
Set the subject of the message
SetWordWrap()  : mixed
Set word wrapping on the body of the message to the given number of characters
SmtpClose()  : mixed
Close the SMTP connection Only necessary when using the SMTP mailer with keepalive enaboed.

Methods

__construct()

Constructor

public __construct([bool $exceptions = true ]) : mixed
Parameters
$exceptions : bool = true

Optionally disable exceptions, and rely on error strings.

__isset()

public __isset(mixed $name) : bool
Parameters
$name : mixed
Return values
bool

__set()

public __set(mixed $name, mixed $value) : mixed
Parameters
$name : mixed
$value : mixed

AddAddress()

Add a "To" address.

public AddAddress(string $address[, string $name = '' ]) : bool
Parameters
$address : string

The email address

$name : string = ''

The real name

Return values
bool

true on success, false if address already used

AddAttachment()

Adds an attachment from a path on the filesystem

public AddAttachment(string $path[, string $name = '' ][, string $encoding = 'base64' ][, string $type = 'application/octet-stream' ]) : bool
Parameters
$path : string

Complete file specification to the attachment

$name : string = ''

Set the attachment name

$encoding : string = 'base64'

File encoding (see $encoding)

$type : string = 'application/octet-stream'

(mime type for the attachment)

Return values
bool

true on success, false on failure.

AddBCC()

Add a "BCC" (Blind Carbon Copy) address

public AddBCC(string $addr[, string $name = '' ]) : bool
Parameters
$addr : string

The email address

$name : string = ''

The real name.

Return values
bool

true on success, false on failure.

AddCC()

Add a "CC" (Carbon Copy) address

public AddCC(string $addr[, string $name = '' ]) : bool
Parameters
$addr : string

The email address

$name : string = ''

The real name.

Return values
bool

true on success, false on failure.

AddCustomHeader()

Add a custom header to the output email

public AddCustomHeader(string $header) : mixed

i.e: $obj->AddCustomHeader('X-MYHEADER: some-value');

Parameters
$header : string

AddEmbeddedImage()

Adds an embedded attachment. This can include images, sounds, and just about any other document. Make sure to set the $type to an image type. For JPEG images use "image/jpeg" and for GIF images use "image/gif".

public AddEmbeddedImage(string $path, string $cid[, string $name = '' ][, string $encoding = 'base64' ][, string $type = 'application/octet-stream' ]) : bool
Parameters
$path : string

Path to the attachment.

$cid : string

Content ID of the attachment. Use this to identify the Id for accessing the image in an HTML form.

$name : string = ''

Overrides the attachment name.

$encoding : string = 'base64'

File encoding (see $Encoding).

$type : string = 'application/octet-stream'

File extension (MIME) type.

Return values
bool

AddReplyTo()

Adds a "Reply-to" address.

public AddReplyTo(string $addr[, string $name = '' ]) : bool
Parameters
$addr : string
$name : string = ''
Return values
bool

AddStringAttachment()

Adds a string or binary attachment (non-filesystem) to the list.

public AddStringAttachment(string $string, string $filename[, string $encoding = 'base64' ][, string $type = 'application/octet-stream' ]) : mixed

This method can be used to attach ascii or binary data, such as a BLOB record from a database.

Parameters
$string : string

String attachment data.

$filename : string

Name of the attachment.

$encoding : string = 'base64'

File encoding (see $Encoding).

$type : string = 'application/octet-stream'

File extension (MIME) type.

ClearAddresses()

Clears all recipients in the To list

public ClearAddresses() : mixed
Tags
see
cms_mailer::AddAddress

ClearAllRecipients()

Clears all recipients in the To,CC, and BCC lists

public ClearAllRecipients() : mixed
Tags
see
cms_mailer::AddAddress
see
cms_mailer::AddCC
see
cms_mailer::AddBCC

ClearAttachments()

Clears all attachments

public ClearAttachments() : mixed
Tags
see
cms_mailer::AddAttachment
see
cms_mailer::AddStringAttachment
see
cms_mailer::AddEmbeddedImage

ClearBCCs()

Clear all recipients on the BCC list

public ClearBCCs() : mixed
Tags
see
cms_mailer::AddCC

ClearCCs()

Clear all recipients on the CC list

public ClearCCs() : mixed
Tags
see
cms_mailer::AddCC

ClearCustomHeaders()

Clear all custom headers

public ClearCustomHeaders() : mixed
Tags
see
cms_mailer::AddCustomHeader

ClearReplyTos()

Clear the Reply-To list

public ClearReplyTos() : mixed
Tags
see
cms_mailer::AddReplyTo

GetAltBody()

Retrieve the alternate body of the email message

public GetAltBody() : string
Return values
string

GetBody()

Retrieve the body of the email message

public GetBody() : string
Return values
string

GetCharSet()

Return the character set for the email

public GetCharSet() : string
Return values
string

GetConfirmReadingTo()

Retrieve the reading confirmation email address

public GetConfirmReadingTo() : string
Return values
string

The email address (if any) that will recieve the reading confirmation.

GetEncoding()

Get the encoding of the message.

public GetEncoding() : string
Return values
string

GetErrorInfo()

Return the error information from the last error.

public GetErrorInfo() : string
Return values
string

GetFrom()

Get the from address for the email

public GetFrom() : string
Return values
string

GetFromName()

Get the real name that the email will be sent from

public GetFromName() : string
Return values
string

GetHelo()

Gets the SMTP HELO of the message

public GetHelo() : string
Return values
string

GetHostname()

Get the hostname that will be used in the Message-Id and Recieved headers and the default HELO string.

public GetHostname() : string
Return values
string

GetMailer()

Retrieve the name of the mailer that will be used to send the message.

public GetMailer() : string
Return values
string

GetPriority()

Get the priority of the message

public GetPriority() : int
Return values
int

GetSender()

Get the Sender (return-path) of the message.

public GetSender() : string
Return values
string

The email address for the Sender field

GetSendmail()

Get the path to the sendmail executable

public GetSendmail() : mixed

GetSMTPAuth()

Retrieve the SMTP Auth flag

public GetSMTPAuth() : bool
Return values
bool

GetSMTPDebug()

Get the current value of the SMTP Debug flag

public GetSMTPDebug() : bool
Return values
bool

GetSMTPHost()

Get the SMTP host values

public GetSMTPHost() : string
Return values
string

GetSMTPKeepAlive()

Return the value of the SMTP keepalive flag

public GetSMTPKeepAlive() : bool
Return values
bool

GetSMTPPassword()

Get the SMTP password

public GetSMTPPassword() : string
Return values
string

GetSMTPPort()

Get the default SMTP port number

public GetSMTPPort() : int
Return values
int

GetSMTPSecure()

Gets the secure SMTP connection mode, or none

public GetSMTPSecure() : string
Return values
string

GetSMTPTimeout()

Get the SMTP server timeout (in seconds).

public GetSMTPTimeout() : int
Return values
int

GetSMTPUsername()

Get the SMTP username

public GetSMTPUsername() : string
Return values
string

GetSubject()

Retrieve the subject of the message

public GetSubject() : string
Return values
string

GetWordWrap()

Get the number of characters used in word wrapping. 0 indicates that no word wrapping will be performed.

public GetWordWrap() : int
Return values
int

IsError()

Test if there was an error on the last message send

public IsError() : bool
Return values
bool

IsHTML()

Set the message type to HTML.

public IsHTML([bool $html = true ]) : mixed
Parameters
$html : bool = true

IsMail()

Test if the mailer is set to 'mail'

public IsMail() : bool
Return values
bool

IsSendmail()

Test if the mailer is set to 'sendmail'

public IsSendmail() : bool
Return values
bool

IsSMTP()

Test if the mailer is set to 'SMTP'

public IsSMTP() : bool
Return values
bool

reset()

Reset the mailer to standard settings We use the set global preferences here

public reset() : mixed

Send()

Send the current message using all current settings.

public Send() : bool

This method may throw exceptions if $exceptions were enabled in the constructor

Tags
see
cms_mailer::__construct
Return values
bool

SetAltBody()

Set the alternate body of the email message

public SetAltBody(string $txt) : mixed

For HTML messages the alternate body contains a text only string for email clients without HTML support.

Parameters
$txt : string

SetBody()

Set the body of the email message.

public SetBody(string $txt) : mixed

If the email message is in HTML format this can contain HTML code. Otherwise it should contain only text.

Parameters
$txt : string

SetCharSet()

Set the character set for the message.

public SetCharSet(string $charset) : mixed

Normally, the reset routine sets this to a system wide default value.

Parameters
$charset : string

SetConfirmReadingTo()

Set the email address that confirmations of email reading will be sent to.

public SetConfirmReadingTo(string $email) : mixed
Parameters
$email : string

SetEncoding()

Sets the encoding of the message.

public SetEncoding(string $encoding) : mixed

Possible values are: 8bit, 7bit, binary, base64, and quoted-printable

Parameters
$encoding : string

SetFrom()

Set the from address for the email

public SetFrom(string $email) : mixed
Parameters
$email : string

Th email address that the email will be from.

SetFromName()

Set the real name that this email will be sent from.

public SetFromName(string $name) : mixed
Parameters
$name : string

SetHelo()

Sets the SMTP HELO of the message (Default is $Hostname)

public SetHelo(string $helo) : mixed
Parameters
$helo : string

SetHostname()

Set the hostname to use in the Message-Id and Received headers and as the default HELO string. If empty the value will be calculated

public SetHostname(string $hostname) : mixed
Parameters
$hostname : string

SetLanguage()

Set the language for all error messages

public SetLanguage(string $lang_type) : mixed
Parameters
$lang_type : string

SetMailer()

Set the name of the mailer that will be used to send the message.

public SetMailer(string $mailer) : mixed

possible values for this field are 'mail','smtp', and 'sendmail'

Parameters
$mailer : string

SetPriority()

Set the priority of the message (1 = High, 3 = Normal, 5 = low)

public SetPriority(int $priority) : mixed
Parameters
$priority : int

SetSender()

Set the Sender email (return-path) of the message.

public SetSender(string $sender) : mixed
Parameters
$sender : string

SetSendmail()

Set the path to the sendmail executable

public SetSendmail(string $path) : mixed

This path is only useful when using the sendmail mailer.

Parameters
$path : string
Tags
see
cms_mailer::SetMailer

SetSMTPAuth()

Set a flag indicating wether or not SMTP authentication is to be used when sending mails via the SMTP mailer.

public SetSMTPAuth([bool $flag = true ]) : mixed
Parameters
$flag : bool = true
Tags
see
cms_mailer::SetMailer

SetSMTPDebug()

Enable, or disable SMTP debugging

public SetSMTPDebug([bool $flag = TRUE ]) : mixed

This is only useful when using the SMTP mailer.

Parameters
$flag : bool = TRUE
Tags
see
cms_mailer::SetMailer

SetSMTPHost()

Set the SMTP host(s).

public SetSMTPHost(string $host) : mixed

Only applicable when using SMTP mailer. All hosts must be separated with a semicolon. you can also specify a different port for each host by using the format hostname:port (e.g. "smtp1.example.com:25;smtp2.example.com"). Hosts will be tried in order

Parameters
$host : string

SetSMTPKeepAlive()

Prevents the SMTP connection from being closed after sending each message.

public SetSMTPKeepAlive([bool $flag = true ]) : mixed

If this is set to true then SmtpClose must be used to close the connection

This method is only useful when using the SMTP mailer.

Parameters
$flag : bool = true
Tags
see
cms_mailer::SetMailer
see
cms_mailer::SmtpClose

SetSMTPPassword()

Set the SMTP password

public SetSMTPPassword(string $password) : mixed

Only useful when using the SMTP mailer.

Parameters
$password : string

SetSMTPPort()

Set the default SMTP port

public SetSMTPPort(int $port) : mixed

This method is only useful when using the SMTP mailer.

Parameters
$port : int

SetSMTPSecure()

Set the secure SMTP connection mode, or none possible values are "", "ssl", or "tls"

public SetSMTPSecure(string $value) : mixed
Parameters
$value : string

SetSMTPTimeout()

Set the SMTP server timeout in seconds (for the SMTP mailer) This function may not work with the win32 version.

public SetSMTPTimeout(int $timeout) : mixed
Parameters
$timeout : int
Tags
see
cms_mailer::SetMailer

SetSMTPUsername()

Set the SMTP Username.

public SetSMTPUsername(string $username) : mixed

This is only used when using the SMTP mailer with SMTP authentication.

Parameters
$username : string
Tags
see
cms_mailer::SetMailer

SetSubject()

Set the subject of the message

public SetSubject(string $subject) : mixed
Parameters
$subject : string

SetWordWrap()

Set word wrapping on the body of the message to the given number of characters

public SetWordWrap(int $chars) : mixed
Parameters
$chars : int

SmtpClose()

Close the SMTP connection Only necessary when using the SMTP mailer with keepalive enaboed.

public SmtpClose() : mixed
Tags
see
cms_mailer::SetSMTPKeepAlive

        
On this page

Search results