Methods
Adds a "To" address.
AddAddress(string $address, string $name = ''
) : void
Parameters
$address
string
$name
string
Adds an attachment from a path on the filesystem.
AddAttachment(string $path, string $name = ''
, string $encoding = 'base64'
, string $type = 'application/octet-stream'
) : boolean
Returns false if the file could not be found
or accessed.
Parameters
$path
string
Path to the attachment.
$name
string
Overrides the attachment name.
$encoding
string
File encoding (see $Encoding).
$type
string
File extension (MIME) type.
Returns
boolean
Adds a "Bcc" address. Note: this function works
with the SMTP mailer on win32, not with the "mail"
mailer.
AddBCC(string $address, string $name = ''
) : void
Parameters
$address
string
$name
string
Adds a "Cc" address. Note: this function works
with the SMTP mailer on win32, not with the "mail"
mailer.
AddCC(string $address, string $name = ''
) : void
Parameters
$address
string
$name
string
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".
AddEmbeddedImage(string $path, string $cid, string $name = ''
, string $encoding = 'base64'
, string $type = 'application/octet-stream'
) : boolean
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
File encoding (see $Encoding).
$type
string
File extension (MIME) type.
Returns
boolean
Adds a "Reply-To" address.
AddReplyTo(string $address, string $name = ''
) : void
Parameters
$address
string
$name
string
Adds a string or binary attachment (non-filesystem) to the list.
AddStringAttachment(string $string, string $filename, string $encoding = 'base64'
, string $type = 'application/octet-stream'
) : void
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
File encoding (see $Encoding).
$type
string
File extension (MIME) type.
Creates recipient headers.
AddrAppend($type, $addr) : string
Parameters
$type
$addr
Returns
string
Attaches all fs, string, and binary attachments to the message.
AttachAll() : string
Returns an empty string on failure.
Returns
string
Correctly encodes and wraps long multibyte strings for mail headers
without breaking lines within a character.
Base64EncodeWrapMB(string $str) : string
Parameters
$str
string
multi-byte text to wrap encode
Returns
string
Clears all recipients assigned in the TO array. Returns void.
ClearAddresses() : void
Clears all recipients assigned in the TO, CC and BCC
array. Returns void.
ClearAllRecipients() : void
Clears all previously set filesystem, string, and binary
attachments. Returns void.
ClearAttachments() : void
Clears all recipients assigned in the BCC array. Returns void.
ClearBCCs() : void
Clears all recipients assigned in the CC array. Returns void.
ClearCCs() : void
Clears all recipients assigned in the ReplyTo array. Returns void.
ClearReplyTos() : void
Assembles the message body. Returns an empty string on failure.
CreateBody() : string
Encodes attachment in requested format. Returns an
empty string on failure.
EncodeFile($path, $encoding = 'base64'
) : string
Parameters
$path
$encoding
Returns
string
Encode string to q encoding.
EncodeQ($str, $position = 'text'
) : string
Parameters
$str
$position
Returns
string
Encode string to quoted-printable.
EncodeQP($input = ''
, $line_max = 76
, $space_conv = false
) : string
Parameters
$input
$line_max
$space_conv
Returns
string
Callback for converting to "=XX".
EncodeQ_callback($matches) : string
Parameters
$matches
Returns
string
Encodes string to requested format. Returns an
empty string on failure.
EncodeString($str, $encoding = 'base64'
) : string
Parameters
$str
$encoding
Returns
string
Returns the end of a message boundary.
EndBoundary($boundary)
Changes every end of line from CR or LF to CRLF.
FixEOL($str) : string
Parameters
$str
Returns
string
Returns the start of a message boundary.
GetBoundary($boundary, $charSet, $contentType, $encoding)
Parameters
$boundary
$charSet
$contentType
$encoding
Returns the message MIME.
GetMailMIME() : string
Checks if a string contains multibyte characters.
HasMultiBytes(string $str) : boolean
Parameters
$str
string
multi-byte text to wrap encode
Returns
boolean
Returns true if an inline attachment is present.
InlineImageExists() : boolean
Returns true if an error occurred.
IsError() : boolean
Sets message type to HTML.
IsHTML(boolean $bool) : void
Sets Mailer to send message using PHP mail() function.
IsMail() : void
Sets Mailer to send message using the qmail MTA.
IsQmail() : void
Sets Mailer to send message using SMTP.
IsSMTP() : void
Sets Mailer to send message using the $Sendmail program.
IsSendmail() : void
Returns a message in the appropriate language.
Lang($key) : string
Parameters
$key
Returns
string
Sends mail using the PHP mail() function.
MailSend($header, $body) : boolean
Parameters
$header
$body
Returns
boolean
Evaluates the message and returns modifications for inline images and backgrounds
MsgHTML($message, $basedir = ''
) : \$message
Parameters
$message
$basedir
Returns
\$message
Returns the proper RFC 822 formatted date.
RFCDate() : string
Creates message and assigns Mailer. If the message is
not sent successfully then it returns false. Use the ErrorInfo
variable to view description of the error.
Send() : boolean
Sends mail using the $Sendmail program.
SendmailSend($header, $body) : boolean
Parameters
$header
$body
Returns
boolean
Returns the server hostname or 'localhost.localdomain' if unknown.
ServerHostname() : string
Returns the appropriate server variable. Should work with both
PHP 4.1.0+ as well as older versions. Returns an empty string
if nothing is found.
ServerVar($varName) : mixed
Parameters
$varName
Returns
mixed
Adds the error message to the error container.
SetError($msg) : void
Sets the language for all class error messages. Returns false
if it cannot load the language file. The default language type
is English.
SetLanguage(string $lang_type, string $lang_path = 'language/'
) : boolean
Parameters
$lang_type
string
Type of language (e.g. Portuguese: "br")
$lang_path
string
Path to the language file directory
Returns
boolean
Sets the message type.
SetMessageType() : void
Set the body wrapping.
SetWordWrap() : void
Set the private key file and password to sign the message.
Sign($cert_filename, string $key_filename, string $key_pass)
Parameters
$cert_filename
$key_filename
string
Parameter File Name
$key_pass
string
Password for private key
Closes the active SMTP session if one exists.
SmtpClose() : void
Initiates a connection to an SMTP server. Returns false if the
operation failed.
SmtpConnect() : boolean
Sends mail via SMTP using PhpSMTP (Author:
Chris Ryan). Returns bool. Returns false if there is a
bad MAIL FROM, RCPT, or DATA input.
SmtpSend($header, $body) : boolean
Parameters
$header
$body
Returns
boolean
Returns a formatted mail line.
TextLine($value) : string
Parameters
$value
Returns
string
Finds last character boundary prior to maxLength in a utf-8
quoted (printable) encoded string.
UTF8CharBoundary(string $encodedText, integer $maxLength) : integer
Original written by Colin Brown.
Parameters
$encodedText
string
utf-8 QP text
$maxLength
integer
find last character boundary prior to this length
Returns
integer
Wraps message for use with mailers that do not
automatically perform wrapping and for quoted-printable.
WrapText($message, $length, $qp_mode = false
) : string
Original written by philippe.
Parameters
$message
$length
$qp_mode
Returns
string
Gets the mime type of the embedded or inline image
_mime_types($ext = ''
) : \mime
Parameters
$ext
Returns
\mime
type of ext
Read a file from a supplied filename and return it.
getFile(string $filename)
Parameters
$filename
string
Parameter File Name
Set (or reset) Class Objects (variables)
set(string $name, mixed $value = ''
)
Usage Example:
$page->set('X-Priority', '3');
Parameters
$name
string
Parameter Name
$value
mixed
Parameter Value
NOTE: will not work with arrays, there are no arrays to set/reset
Properties
Sets the text-only body of the message. This automatically sets the
email to multipart/alternative. This body can be read by mail
clients that do not have HTML email capability such as mutt. Clients
that can read HTML will view the normal Body.
$AltBody : string
Sets the Body of the message. This can be either an HTML or text body.
$Body : string
If HTML then run IsHTML(true).
Sets the CharSet of the message.
$CharSet : string
Sets the email address that a reading confirmation will be sent.
$ConfirmReadingTo : string
Sets the Content-type of the message.
$ContentType : string
Sets the Encoding of the message. Options for this are "8bit",
"7bit", "binary", "base64", and "quoted-printable".
$Encoding : string
Holds the most recent mailer error message.
$ErrorInfo : string
Sets the From email address for the message.
$From : string
Sets the From name of the message.
$FromName : string
Sets the SMTP HELO of the message (Default is $Hostname).
$Helo : string
Sets the SMTP hosts. All hosts must be separated by a
semicolon. You can also specify a different port
for each host by using this format: [hostname:port]
(e.g. "smtp1.example.com:25;smtp2.example.com").
$Host : string
Hosts will be tried in order.
Sets the hostname to use in Message-Id and Received headers
and as default HELO string. If empty, the value returned
by SERVER_NAME is used or 'localhost.localdomain'.
$Hostname : string
Method to send mail: ("mail", "sendmail", or "smtp").
$Mailer : string
Sets the message ID to be used in the Message-Id header.
$MessageID : string
If empty, a unique id will be generated.
Sets SMTP password.
$Password : string
Path to PHPMailer plugins. This is now only useful if the SMTP class
is in a different directory than the PHP include path.
$PluginDir : string
Sets the default SMTP server port.
$Port : integer
Email priority (1 = High, 3 = Normal, 5 = low).
$Priority : integer
Sets SMTP authentication. Utilizes the Username and Password variables.
$SMTPAuth : boolean
Sets SMTP class debugging on or off.
$SMTPDebug : boolean
Prevents the SMTP connection from being closed after each mail
sending. If this is set to true then to close the connection
requires an explicit call to SmtpClose().
$SMTPKeepAlive : boolean
Sets connection prefix.
$SMTPSecure : string
Options are "", "ssl" or "tls"
Sets the Sender email (Return-Path) of the message. If not empty,
will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
$Sender : string
Sets the path of the sendmail program.
$Sendmail : string
Default
'/usr/sbin/sendmail'
Provides the ability to have the TO field process individual
emails, instead of sending to entire TO addresses
$SingleTo : boolean
Sets the Subject of the message.
$Subject : string
Sets the SMTP server timeout in seconds. This function will not
work with the win32 version.
$Timeout : integer
Sets SMTP username.
$Username : string
Holds PHPMailer version.
$Version : string
Sets word wrapping on the body of the message to a given number of
characters.
$WordWrap : integer
$error_count
$error_count
$message_type
$message_type
$sign_cert_file
$sign_cert_file
$sign_key_file
$sign_key_file
$sign_key_pass
$sign_key_pass