cms_mailer
in package
A class for sending email.
Prior to CMSMS 2.0 this class was implemented as a core module.
Tags
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.
__get()
public
__get(mixed $name) : mixed
Parameters
- $name : mixed
__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
boolAddReplyTo()
Adds a "Reply-to" address.
public
AddReplyTo(string $addr[, string $name = '' ]) : bool
Parameters
- $addr : string
- $name : string = ''
Return values
boolAddStringAttachment()
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
ClearAllRecipients()
Clears all recipients in the To,CC, and BCC lists
public
ClearAllRecipients() : mixed
Tags
ClearAttachments()
Clears all attachments
public
ClearAttachments() : mixed
Tags
ClearBCCs()
Clear all recipients on the BCC list
public
ClearBCCs() : mixed
Tags
ClearCCs()
Clear all recipients on the CC list
public
ClearCCs() : mixed
Tags
ClearCustomHeaders()
Clear all custom headers
public
ClearCustomHeaders() : mixed
Tags
ClearReplyTos()
Clear the Reply-To list
public
ClearReplyTos() : mixed
Tags
GetAltBody()
Retrieve the alternate body of the email message
public
GetAltBody() : string
Return values
stringGetBody()
Retrieve the body of the email message
public
GetBody() : string
Return values
stringGetCharSet()
Return the character set for the email
public
GetCharSet() : string
Return values
stringGetConfirmReadingTo()
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
stringGetErrorInfo()
Return the error information from the last error.
public
GetErrorInfo() : string
Return values
stringGetFrom()
Get the from address for the email
public
GetFrom() : string
Return values
stringGetFromName()
Get the real name that the email will be sent from
public
GetFromName() : string
Return values
stringGetHelo()
Gets the SMTP HELO of the message
public
GetHelo() : string
Return values
stringGetHostname()
Get the hostname that will be used in the Message-Id and Recieved headers and the default HELO string.
public
GetHostname() : string
Return values
stringGetMailer()
Retrieve the name of the mailer that will be used to send the message.
public
GetMailer() : string
Return values
stringGetPriority()
Get the priority of the message
public
GetPriority() : int
Return values
intGetSender()
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
boolGetSMTPDebug()
Get the current value of the SMTP Debug flag
public
GetSMTPDebug() : bool
Return values
boolGetSMTPHost()
Get the SMTP host values
public
GetSMTPHost() : string
Return values
stringGetSMTPKeepAlive()
Return the value of the SMTP keepalive flag
public
GetSMTPKeepAlive() : bool
Return values
boolGetSMTPPassword()
Get the SMTP password
public
GetSMTPPassword() : string
Return values
stringGetSMTPPort()
Get the default SMTP port number
public
GetSMTPPort() : int
Return values
intGetSMTPSecure()
Gets the secure SMTP connection mode, or none
public
GetSMTPSecure() : string
Return values
stringGetSMTPTimeout()
Get the SMTP server timeout (in seconds).
public
GetSMTPTimeout() : int
Return values
intGetSMTPUsername()
Get the SMTP username
public
GetSMTPUsername() : string
Return values
stringGetSubject()
Retrieve the subject of the message
public
GetSubject() : string
Return values
stringGetWordWrap()
Get the number of characters used in word wrapping. 0 indicates that no word wrapping will be performed.
public
GetWordWrap() : int
Return values
intIsError()
Test if there was an error on the last message send
public
IsError() : bool
Return values
boolIsHTML()
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
boolIsSendmail()
Test if the mailer is set to 'sendmail'
public
IsSendmail() : bool
Return values
boolIsSMTP()
Test if the mailer is set to 'SMTP'
public
IsSMTP() : bool
Return values
boolreset()
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
Return values
boolSetAltBody()
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
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
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
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
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
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
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