Class: PHPMailer
Source Location: /core/PHPMailer/class.phpmailer.php
Class PHPMailer
Constant Summary
CRLF |
SMTP RFC standard line ending. |
STOP_CONTINUE |
Error severity: message, likely ok to continue processing. |
STOP_CRITICAL |
Error severity: message, plus full stop, critical error reached. |
STOP_MESSAGE |
Error severity: message only, continue processing. |
Property Summary
mixed |
$AllowEmpty |
Whether to allow sending messages with an empty body. |
mixed |
$AltBody |
The plain-text message body. |
mixed |
$bcc |
The array of 'bcc' addresses. |
mixed |
$Body |
An HTML or plain text message body. |
mixed |
$boundary |
The array of MIME boundary strings. |
mixed |
$cc |
The array of 'cc' addresses. |
mixed |
$CharSet |
The character set of the message. |
mixed |
$ConfirmReadingTo |
The email address that a reading confirmation should be sent to. |
mixed |
$do_verp |
Whether to generate VERP addresses on send. |
mixed |
$ErrorInfo |
Holds the most recent mailer error message. |
mixed |
$exceptions |
Whether to throw exceptions for errors. |
mixed |
$From |
The From email address for the message. |
mixed |
$FromName |
The From name of the message. |
mixed |
$Helo |
The SMTP HELO of the message. |
mixed |
$Hostname |
The hostname to use in Message-Id and Received headers and as default HELO string. |
mixed |
$Ical |
An iCal message part body. |
mixed |
$language |
The array of available languages. |
mixed |
$lastMessageID |
The most recent Message-ID (including angular brackets). |
mixed |
$LE |
The default line ending. |
mixed |
$Mailer |
Which method to use to send mail. |
mixed |
$mailHeader |
Extra headers that createHeader() doesn't fold in. |
mixed |
$MessageDate |
The message Date to be used in the Date header. |
mixed |
$MessageID |
An ID to be used in the Message-Id header. |
mixed |
$MIMEBody |
The complete compiled MIME message body. |
mixed |
$MIMEHeader |
The complete compiled MIME message headers. |
mixed |
$Port |
The default SMTP server port. |
mixed |
$ReplyTo |
The array of reply-to names and addresses. |
mixed |
$Sender |
The Sender email (Return-Path) of the message. |
mixed |
$Sendmail |
The path to the sendmail program. |
mixed |
$SingleTo |
Whether to split multiple to addresses into multiple messages or send them all in one message. |
mixed |
$smtp |
An instance of the SMTP sender class. |
mixed |
$SMTPAuth |
Whether to use SMTP authentication. |
mixed |
$SMTPKeepAlive |
Whether to keep SMTP connection open after each message. |
mixed |
$Subject |
The Subject of the message. |
mixed |
$Timeout |
The SMTP server timeout in seconds. |
mixed |
$to |
The array of 'to' addresses. |
mixed |
$Version |
The PHPMailer Version number. |
mixed |
$WordWrap |
Word-wrap the message body to this number of chars. |
mixed |
$XMailer |
What to use in the X-Mailer header. |
Method Summary
static
string|array
|
mb_pathinfo() |
Multi-byte-safe pathinfo replacement. |
static
string
|
rfcDate() |
Return an RFC 822 formatted date. |
static
boolean
|
validateAddress() |
Check that a string looks like an email address. |
static
string
|
_mime_types() |
Get the MIME type for a file extension. |
boolean |
addAnAddress() |
Add an address to one of the recipient arrays. |
boolean |
addAttachment() |
Add an attachment from a path on the filesystem. |
boolean |
addBCC() |
Add a "BCC" address. |
boolean |
addCC() |
Add a "CC" address. |
string |
addrFormat() |
Format an address for use in a message header. |
string |
attachAll() |
Attach all file, string, and binary attachments to the message. |
string |
base64EncodeWrapMB() |
Encode and wrap long multibyte strings for mail headers without breaking lines within a character. |
void |
clearCCs() |
Clear all CC recipients. |
string |
DKIM_Add() |
Create the DKIM header and body in a new message header. |
string |
DKIM_BodyC() |
Generate a DKIM canonicalization body. |
string |
DKIM_HeaderC() |
Generate a DKIM canonicalization header. |
string |
DKIM_QP() |
Quoted-Printable-encode a DKIM header. |
string |
DKIM_Sign() |
Generate a DKIM signature. |
void |
edebug() |
Output debugging info via user-defined method. |
string |
encodeFile() |
Encode a file attachment in requested format. |
string |
encodeQ() |
Encode a string using Q encoding. |
string |
encodeQP() |
Encode a string in quoted-printable format. |
string |
encodeQPphp() |
Backward compatibility wrapper for an old QP encoding function that was removed. |
string |
endBoundary() |
Return the end of a message boundary. |
string |
fixEOL() |
Ensure consistent line endings in a string. |
string |
getBoundary() |
Return the start of a message boundary. |
array |
getCcAddresses() |
Allows for public read access to 'cc' property. |
string |
getMailMIME() |
Get the message MIME type headers. |
array |
getToAddresses() |
Allows for public read access to 'to' property. |
boolean |
has8bitChars() |
Does a string contain any 8-bit chars (in any charset)? |
boolean |
hasMultiBytes() |
Check if a string contains multi-byte characters. |
string |
html2text() |
Convert an HTML string into plain text. |
boolean |
isError() |
Check if an error occurred. |
void |
isHTML() |
Sets message type to HTML or plain. |
void |
isMail() |
Send messages using PHP's mail() function. |
void |
isQmail() |
Send messages using qmail. |
void |
isSMTP() |
Send messages using SMTP. |
string |
lang() |
Get an error message in the current language. |
boolean |
mailSend() |
Send mail using the PHP mail() function. |
string |
msgHTML() |
Create a message from an HTML string. |
boolean |
postSend() |
Actually send a message. |
boolean |
preSend() |
Prepare a message for sending. |
string |
secureHeader() |
Strip newlines to prevent header injection. |
boolean |
send() |
Create a message and send it. |
boolean |
sendmailSend() |
Send mail using the $Sendmail program. |
boolean |
set() |
Set or reset instance properties. |
void |
setError() |
Add an error message to the error container. |
boolean |
setFrom() |
Set the From and FromName properties. |
boolean |
setLanguage() |
Set the language for error messages. |
void |
sign() |
Set the public and private key files and password for S/MIME signing. |
void |
smtpClose() |
Close the active SMTP session if one exists. |
boolean |
smtpConnect() |
Initiate a connection to an SMTP server. |
string |
textLine() |
Return a formatted mail line. |
integer |
utf8CharBoundary() |
Find the last character boundary prior to $maxLength in a utf-8 quoted (printable) encoded string. |
Properties
Callback Action function name.
The function that handles the result of the send email action. It is called out by send() for each email sent. Value can be any php callable: http://www.php.net/is_callable Parameters: boolean $result result of the send action string $to email address of the recipient string $cc cc email addresses string $bcc bcc email addresses string $subject the subject string $body the email body string $from email address of sender API Tags:
Whether to allow sending messages with an empty body.
API Tags:
An array of all kinds of addresses.
Includes all of $to, $cc, $bcc, $replyto API Tags:
The plain-text message body.
This body can be read by mail clients that do not have HTML email capability such as mutt & Eudora. Clients that can read HTML will view the normal Body. API Tags:
The array of attachments.
API Tags:
SMTP auth type.
Options are LOGIN (default), PLAIN, NTLM, CRAM-MD5 API Tags:
The array of 'bcc' addresses.
API Tags:
An HTML or plain text message body.
If HTML then call isHTML(true). API Tags:
The array of MIME boundary strings.
API Tags:
The array of 'cc' addresses.
API Tags:
The character set of the message.
API Tags:
The email address that a reading confirmation should be sent to.
API Tags:
The MIME Content-type of the message.
API Tags:
The array of custom headers.
API Tags:
How to handle debug output.
Options: * `echo` Output plain-text as-is, appropriate for CLI * `html` Output escaped, line breaks converted to ` `, appropriate for browser output * `error_log` Output to error log as configured in php.ini Alternatively, you can provide a callable expecting two params: a message string and the debug level: $mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
API Tags:
DKIM signing domain name.
API Tags:
Access: | public |
Example: | example not found |
DKIM Identity.
Usually the email address used as the source of the email API Tags:
DKIM passphrase.
Used if your key is encrypted. API Tags:
DKIM private key file path.
API Tags:
Whether to generate VERP addresses on send.
Only applicable when sending via SMTP. API Tags:
Information Tags:
The message encoding.
Options: "8bit", "7bit", "binary", "base64", and "quoted-printable". API Tags:
Holds the most recent mailer error message.
API Tags:
The number of errors encountered.
API Tags:
Whether to throw exceptions for errors.
API Tags:
The From email address for the message.
API Tags:
The From name of the message.
API Tags:
The SMTP HELO of the message.
Default is $Hostname. API Tags:
SMTP hosts.
Either a single hostname or multiple semicolon-delimited hostnames. 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"). You can also specify encryption type, for example: (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465"). Hosts will be tried in order. API Tags:
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'. API Tags:
An iCal message part body.
Only supported in simple alt or alt_inline message types To generate iCal events, use the bundled extras/EasyPeasyICS.php class or iCalcreator API Tags:
Information Tags:
The array of available languages.
API Tags:
The most recent Message-ID (including angular brackets).
API Tags:
The default line ending.
API Tags:
Which method to use to send mail.
Options: "mail", "sendmail", or "smtp". API Tags:
Extra headers that createHeader() doesn't fold in.
API Tags:
The message Date to be used in the Date header.
If empty, the current date will be added. API Tags:
An ID to be used in the Message-Id header.
If empty, a unique id will be generated. API Tags:
The message's MIME type.
API Tags:
The complete compiled MIME message body.
API Tags:
The complete compiled MIME message headers.
API Tags:
Path to PHPMailer plugins.
Useful if the SMTP class is not in the PHP include path. API Tags:
Deprecated: | Should not be needed now there is an autoloader. |
Access: | public |
The default SMTP server port.
API Tags:
Information Tags:
TODO: | Why is this needed when the SMTP class takes care of it? |
Email priority.
Options: 1 = High, 3 = Normal, 5 = low. API Tags:
SMTP realm.
Used for NTLM auth API Tags:
The array of reply-to names and addresses.
API Tags:
The Return-Path of the message.
If empty, it will be set to either From or Sender. API Tags:
Deprecated: | Email senders should never set a return-path header; it's the receiver's job (RFC5321 section 4.4), so this no longer does anything. |
Access: | public |
Information Tags:
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. API Tags:
The path to the sendmail program.
API Tags:
The S/MIME certificate file path.
API Tags:
The S/MIME key file path.
API Tags:
The S/MIME password for the key.
Used only if the key is encrypted. API Tags:
Whether to split multiple to addresses into multiple messages or send them all in one message.
API Tags:
Storage for addresses when SingleTo is enabled.
API Tags:
Information Tags:
TODO: | This should really not be public |
An instance of the SMTP sender class.
API Tags:
Whether to use SMTP authentication.
Uses the Username and Password properties. API Tags:
SMTP class debug output mode.
Debug output level. Options: * `0` No output * `1` Commands * `2` Data and commands * `3` As 2 plus connection status * `4` Low-level data output API Tags:
Whether to keep SMTP connection open after each message.
If this is set to true then to close the connection requires an explicit call to smtpClose(). API Tags:
The secure connection prefix.
Options: "", "ssl" or "tls" API Tags:
The Subject of the message.
API Tags:
The SMTP server timeout in seconds.
API Tags:
The array of 'to' addresses.
API Tags:
Whether mail() uses a fully sendmail-compatible MTA.
One which supports sendmail's "-oi -f" options. API Tags:
The PHPMailer Version number.
API Tags:
Word-wrap the message body to this number of chars.
API Tags:
SMTP workstation.
Used for NTLM auth API Tags:
What to use in the X-Mailer header.
Options: null for default, whitespace for none, or a string to use API Tags:
Methods
static string filenameToType(
string
$filename
)
|
|
Map a file name to a MIME type.
Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
Parameters:
string |
$filename: |
A file name or full path, does not need to exist as a file |
API Tags:
static string|array mb_pathinfo(
string
$path, [integer|string
$options = null]
)
|
|
Multi-byte-safe pathinfo replacement.
Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe. Works similarly to the one in PHP >= 5.2.0
Parameters:
string |
$path: |
A filename or path, does not need to exist as a file |
integer|string |
$options: |
Either a PATHINFO_* constant, or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2 |
API Tags:
Information Tags:
static string normalizeBreaks(
string
$text, [string
$breaktype = "\r\n"]
)
|
|
Normalize line breaks in a string.
Converts UNIX LF, Mac CR and Windows CRLF line breaks into a single line break format. Defaults to CRLF (for message bodies) and preserves consecutive breaks.
Parameters:
string |
$text: |
|
string |
$breaktype: |
What kind of line break to use, defaults to CRLF |
API Tags:
Return an RFC 822 formatted date.
API Tags:
static boolean validateAddress(
string
$address, [string
$patternselect = 'auto']
)
|
|
Check that a string looks like an email address.
Parameters:
string |
$address: |
The email address to check |
string |
$patternselect: |
A selector for the validation pattern to use : * `auto` Pick strictest one automatically; * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14; * `pcre` Use old PCRE implementation; * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; same as pcre8 but does not allow 'dotless' domains; * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements. * `noregex` Don't use a regex: super fast, really dumb. |
API Tags:
static string _mime_types(
[string
$ext = '']
)
|
|
Get the MIME type for a file extension.
Parameters:
string |
$ext: |
File extension |
API Tags:
Return: | MIME type of file. |
Access: | public |
PHPMailer __construct(
[boolean
$exceptions = false]
)
|
|
Constructor.
Parameters:
boolean |
$exceptions: |
Should we throw external exceptions? |
API Tags:
boolean addAddress(
string
$address, [string
$name = '']
)
|
|
Add a "To" address.
Parameters:
string |
$address: |
|
string |
$name: |
|
API Tags:
Return: | true on success, false if address already used |
Access: | public |
boolean addAnAddress(
string
$kind, string
$address, [string
$name = '']
)
|
|
Add an address to one of the recipient arrays.
Addresses that have been added already return false, but do not throw exceptions
Parameters:
string |
$kind: |
One of 'to', 'cc', 'bcc', 'ReplyTo' |
string |
$address: |
The email address to send to |
string |
$name: |
|
API Tags:
Return: | true on success, false if address already used or invalid in some way |
Access: | protected |
Information Tags:
Throws: | phpmailerException |
boolean addAttachment(
string
$path, [string
$name = ''], [string
$encoding = 'base64'], [string
$type = ''], [string
$disposition = 'attachment']
)
|
|
Add an attachment from a path on the filesystem.
Returns false if the file could not be found or read.
Parameters:
string |
$path: |
Path to the attachment. |
string |
$name: |
Overrides the attachment name. |
string |
$encoding: |
File encoding (see $Encoding). |
string |
$type: |
File extension (MIME) type. |
string |
$disposition: |
Disposition to use |
API Tags:
Information Tags:
Throws: | phpmailerException |
boolean addBCC(
string
$address, [string
$name = '']
)
|
|
Add a "BCC" address.
Parameters:
string |
$address: |
|
string |
$name: |
|
API Tags:
Return: | true on success, false if address already used |
Access: | public |
boolean addCC(
string
$address, [string
$name = '']
)
|
|
Add a "CC" address.
Parameters:
string |
$address: |
|
string |
$name: |
|
API Tags:
Return: | true on success, false if address already used |
Access: | public |
void addCustomHeader(
string
$name, [string
$value = null]
)
|
|
Add a custom header.
$name value can be overloaded to contain both header name and value (name:value)
Parameters:
string |
$name: |
Custom header name |
string |
$value: |
Header value |
API Tags:
boolean addEmbeddedImage(
string
$path, string
$cid, [string
$name = ''], [string
$encoding = 'base64'], [string
$type = ''], [string
$disposition = 'inline']
)
|
|
Add an embedded (inline) attachment from a file.
This can include images, sounds, and just about any other document type. These differ from 'regular' attachmants in that they are intended to be displayed inline with the message, not just attached for download. This is used in HTML messages that embed the images the HTML refers to using the $cid value.
Parameters:
string |
$path: |
Path to the attachment. |
string |
$cid: |
Content ID of the attachment; Use this to reference the content when using an embedded image in HTML. |
string |
$name: |
Overrides the attachment name. |
string |
$encoding: |
File encoding (see $Encoding). |
string |
$type: |
File MIME type. |
string |
$disposition: |
Disposition to use |
API Tags:
Return: | True on successfully adding an attachment |
Access: | public |
string addrAppend(
string
$type, array
$addr
)
|
|
Create recipient headers.
Parameters:
string |
$type: |
|
array |
$addr: |
An array of recipient, where each recipient is a 2-element indexed array with element 0 containing an address and element 1 containing a name, like: array(array('joe@example.com', 'Joe User'), array('zoe@example.com', 'Zoe User')) |
API Tags:
boolean addReplyTo(
string
$address, [string
$name = '']
)
|
|
Add a "Reply-to" address.
Parameters:
string |
$address: |
|
string |
$name: |
|
API Tags:
string addrFormat(
array
$addr
)
|
|
Format an address for use in a message header.
Parameters:
array |
$addr: |
A 2-element indexed array, element 0 containing an address, element 1 containing a name like array('joe@example.com', 'Joe User') |
API Tags:
void addStringAttachment(
string
$string, string
$filename, [string
$encoding = 'base64'], [string
$type = ''], [string
$disposition = 'attachment']
)
|
|
Add a string or binary attachment (non-filesystem).
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. |
string |
$filename: |
Name of the attachment. |
string |
$encoding: |
File encoding (see $Encoding). |
string |
$type: |
File extension (MIME) type. |
string |
$disposition: |
Disposition to use |
API Tags:
boolean addStringEmbeddedImage(
string
$string, string
$cid, [string
$name = ''], [string
$encoding = 'base64'], [string
$type = ''], [string
$disposition = 'inline']
)
|
|
Add an embedded stringified attachment.
This can include images, sounds, and just about any other document type. Be sure to set the $type to an image type for images: JPEG images use 'image/jpeg', GIF uses 'image/gif', PNG uses 'image/png'.
Parameters:
string |
$string: |
The attachment binary data. |
string |
$cid: |
Content ID of the attachment; Use this to reference the content when using an embedded image in HTML. |
string |
$name: |
|
string |
$encoding: |
File encoding (see $Encoding). |
string |
$type: |
MIME type. |
string |
$disposition: |
Disposition to use |
API Tags:
Return: | True on successfully adding an attachment |
Access: | public |
boolean alternativeExists(
)
|
|
Check if this message has an alternative body set.
API Tags:
string attachAll(
string
$disposition_type, string
$boundary
)
|
|
Attach all file, string, and binary attachments to the message.
Returns an empty string on failure.
Parameters:
string |
$disposition_type: |
|
string |
$boundary: |
|
API Tags:
boolean attachmentExists(
)
|
|
Check if an attachment (non-inline) is present.
API Tags:
string base64EncodeWrapMB(
string
$str, [string
$linebreak = null]
)
|
|
Encode and wrap long multibyte strings for mail headers without breaking lines within a character.
Adapted from a function by paravoid
Parameters:
string |
$str: |
multi-byte text to wrap encode |
string |
$linebreak: |
string to use as linefeed/end-of-line |
API Tags:
Information Tags:
Clear all To recipients.
API Tags:
void clearAllRecipients(
)
|
|
Clear all recipient types.
API Tags:
Clear all filesystem, string, and binary attachments.
API Tags:
Clear all BCC recipients.
API Tags:
Clear all CC recipients.
API Tags:
void clearCustomHeaders(
)
|
|
Clear all custom headers.
API Tags:
Clear all ReplyTo recipients.
API Tags:
Assemble the message body.
Returns an empty string on failure.
API Tags:
Return: | The assembled message body |
Access: | public |
Information Tags:
Throws: | phpmailerException |
Assemble message headers.
API Tags:
Return: | The assembled headers |
Access: | public |
string DKIM_Add(
string
$headers_line, string
$subject, string
$body
)
|
|
Create the DKIM header and body in a new message header.
Parameters:
string |
$headers_line: |
Header lines |
string |
$subject: |
Subject |
string |
$body: |
Body |
API Tags:
string DKIM_BodyC(
string
$body
)
|
|
Generate a DKIM canonicalization body.
Parameters:
string |
$body: |
Message Body |
API Tags:
string DKIM_HeaderC(
string
$signHeader
)
|
|
Generate a DKIM canonicalization header.
Parameters:
string |
$signHeader: |
Header |
API Tags:
string DKIM_QP(
string
$txt
)
|
|
Quoted-Printable-encode a DKIM header.
Parameters:
API Tags:
string DKIM_Sign(
string
$signHeader
)
|
|
Generate a DKIM signature.
Parameters:
API Tags:
Information Tags:
Throws: | phpmailerException |
void doCallback(
boolean
$isSent, array
$to, array
$cc, array
$bcc, string
$subject, string
$body, string
$from
)
|
|
Perform a callback.
Parameters:
boolean |
$isSent: |
|
array |
$to: |
|
array |
$cc: |
|
array |
$bcc: |
|
string |
$subject: |
|
string |
$body: |
|
string |
$from: |
|
API Tags:
void edebug(
string
$str
)
|
|
Output debugging info via user-defined method.
Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug).
Parameters:
API Tags:
string encodeFile(
string
$path, [string
$encoding = 'base64']
)
|
|
Encode a file attachment in requested format.
Returns an empty string on failure.
Parameters:
string |
$path: |
The full path to the file |
string |
$encoding: |
The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' |
API Tags:
See: | EncodeFile(encodeFile |
Access: | protected |
Information Tags:
Throws: | phpmailerException |
string encodeHeader(
string
$str, [string
$position = 'text']
)
|
|
Encode a header string optimally.
Picks shortest of Q, B, quoted-printable or none.
Parameters:
string |
$str: |
|
string |
$position: |
|
API Tags:
string encodeQ(
string
$str, [string
$position = 'text']
)
|
|
Encode a string using Q encoding.
Parameters:
string |
$str: |
the text to encode |
string |
$position: |
Where the text is going to be used, see the RFC for what that means |
API Tags:
Information Tags:
string encodeQP(
string
$string, [integer
$line_max = 76]
)
|
|
Encode a string in quoted-printable format.
According to RFC2045 section 6.7.
Parameters:
string |
$string: |
The text to encode |
integer |
$line_max: |
Number of chars allowed on a line before wrapping |
API Tags:
Information Tags:
string encodeQPphp(
string
$string, [integer
$line_max = 76], [boolean
$space_conv = false]
)
|
|
Backward compatibility wrapper for an old QP encoding function that was removed.
Parameters:
string |
$string: |
|
integer |
$line_max: |
|
boolean |
$space_conv: |
|
API Tags:
string encodeString(
string
$str, [string
$encoding = 'base64']
)
|
|
Encode a string in requested format.
Returns an empty string on failure.
Parameters:
string |
$str: |
The text to encode |
string |
$encoding: |
The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' |
API Tags:
string endBoundary(
string
$boundary
)
|
|
Return the end of a message boundary.
Parameters:
API Tags:
string fixEOL(
string
$str
)
|
|
Ensure consistent line endings in a string.
Changes every end of line from CRLF, CR or LF to $this->LE.
Parameters:
string |
$str: |
String to fixEOL |
API Tags:
array getAllRecipientAddresses(
)
|
|
Allows for public read access to 'all_recipients' property.
API Tags:
Return the array of attachments.
API Tags:
Allows for public read access to 'bcc' property.
API Tags:
string getBoundary(
string
$boundary, string
$charSet, string
$contentType, string
$encoding
)
|
|
Return the start of a message boundary.
Parameters:
string |
$boundary: |
|
string |
$charSet: |
|
string |
$contentType: |
|
string |
$encoding: |
|
API Tags:
Allows for public read access to 'cc' property.
API Tags:
string getLastMessageID(
)
|
|
Return the Message-ID header of the last email.
Technically this is the value from the last time the headers were created, but it's also the message ID of the last sent message except in pathological cases.
API Tags:
Get the message MIME type headers.
API Tags:
array getReplyToAddresses(
)
|
|
Allows for public read access to 'ReplyTo' property.
API Tags:
string getSentMIMEMessage(
)
|
|
Returns the whole MIME message.
Includes complete headers and body. Only valid post preSend().
API Tags:
Get an instance to use for SMTP operations.
Override this function to load your own SMTP implementation
API Tags:
Allows for public read access to 'to' property.
API Tags:
Get the array of strings for the current language.
API Tags:
boolean has8bitChars(
string
$text
)
|
|
Does a string contain any 8-bit chars (in any charset)?
Parameters:
API Tags:
boolean hasMultiBytes(
string
$str
)
|
|
Check if a string contains multi-byte characters.
Parameters:
string |
$str: |
multi-byte text to wrap encode |
API Tags:
string headerLine(
string
$name, string
$value
)
|
|
Format a header line.
Parameters:
string |
$name: |
|
string |
$value: |
|
API Tags:
string html2text(
string
$html, [boolean
$advanced = false]
)
|
|
Convert an HTML string into plain text.
Parameters:
string |
$html: |
The HTML text to convert |
boolean |
$advanced: |
Should this use the more complex html2text converter or just a simple one? |
API Tags:
boolean inlineImageExists(
)
|
|
Check if an inline attachment is present.
API Tags:
Check if an error occurred.
API Tags:
Return: | True if an error did occur. |
Access: | public |
void isHTML(
[boolean
$isHtml = true]
)
|
|
Sets message type to HTML or plain.
Parameters:
boolean |
$isHtml: |
True for HTML mode. |
API Tags:
Send messages using PHP's mail() function.
API Tags:
Send messages using qmail.
API Tags:
Send messages using $Sendmail.
API Tags:
Send messages using SMTP.
API Tags:
string lang(
string
$key
)
|
|
Get an error message in the current language.
Parameters:
API Tags:
boolean mailSend(
string
$header, string
$body
)
|
|
Send mail using the PHP mail() function.
Parameters:
string |
$header: |
The message headers |
string |
$body: |
The message body |
API Tags:
Information Tags:
string msgHTML(
string
$message, [string
$basedir = ''], [boolean
$advanced = false]
)
|
|
Create a message from an HTML string.
Automatically makes modifications for inline images and backgrounds and creates a plain-text version by converting the HTML. Overwrites any existing values in $this->Body and $this->AltBody
Parameters:
string |
$message: |
HTML message string |
string |
$basedir: |
baseline directory for path |
boolean |
$advanced: |
Whether to use the advanced HTML to text converter |
API Tags:
Actually send a message.
Send the email via the selected mechanism
API Tags:
Information Tags:
Throws: | phpmailerException |
Prepare a message for sending.
API Tags:
Information Tags:
Throws: | phpmailerException |
string secureHeader(
string
$str
)
|
|
Strip newlines to prevent header injection.
Parameters:
API Tags:
Create a message and send it.
Uses the sending method specified by $Mailer.
API Tags:
Return: | false on error - See the ErrorInfo property for details of the error. |
Access: | public |
Information Tags:
Throws: | phpmailerException |
boolean sendmailSend(
string
$header, string
$body
)
|
|
Send mail using the $Sendmail program.
Parameters:
string |
$header: |
The message headers |
string |
$body: |
The message body |
API Tags:
Information Tags:
Throws: | phpmailerException |
Get the server hostname.
Returns 'localhost.localdomain' if unknown.
API Tags:
boolean set(
string
$name, [mixed
$value = '']
)
|
|
Set or reset instance properties.
Usage Example: $page->set('X-Priority', '3');
Parameters:
string |
$name: |
|
mixed |
$value: |
NOTE: will not work with arrays, there are no arrays to set/reset |
API Tags:
Information Tags:
TODO: | Should this not be using __set() magic function? |
Throws: | phpmailerException |
void setError(
string
$msg
)
|
|
Add an error message to the error container.
Parameters:
API Tags:
boolean setFrom(
string
$address, [string
$name = ''], [boolean
$auto = true]
)
|
|
Set the From and FromName properties.
Parameters:
string |
$address: |
|
string |
$name: |
|
boolean |
$auto: |
Whether to also set the Sender address, defaults to true |
API Tags:
Information Tags:
Throws: | phpmailerException |
boolean setLanguage(
[string
$langcode = 'en'], [string
$lang_path = '']
)
|
|
Set the language for error messages.
Returns false if it cannot load the language file. The default language is English.
Parameters:
string |
$langcode: |
ISO 639-1 2-character language code (e.g. French is "fr") |
string |
$lang_path: |
Path to the language file directory, with trailing separator (slash) |
API Tags:
Set the message type.
PHPMailer only supports some preset message types, not arbitrary MIME structures.
API Tags:
Set the body wrapping.
API Tags:
void sign(
string
$cert_filename, string
$key_filename, string
$key_pass
)
|
|
Set the public and private key files and password for S/MIME signing.
Parameters:
string |
$cert_filename: |
|
string |
$key_filename: |
|
string |
$key_pass: |
Password for private key |
API Tags:
Close the active SMTP session if one exists.
API Tags:
boolean smtpConnect(
[array
$options = array()]
)
|
|
Initiate a connection to an SMTP server.
Returns false if the operation failed.
Parameters:
array |
$options: |
An array of options compatible with stream_context_create() |
API Tags:
Access: | public |
Uses: | SMTP |
Information Tags:
Throws: | phpmailerException |
boolean smtpSend(
string
$header, string
$body
)
|
|
Send mail via SMTP.
Returns false if there is a bad MAIL FROM, RCPT, or DATA input. Uses the PHPMailerSMTP class by default.
Parameters:
string |
$header: |
The message headers |
string |
$body: |
The message body |
API Tags:
See: | PHPMailer::getSMTPInstance() to use a different class. |
Access: | protected |
Uses: | SMTP |
Information Tags:
Throws: | phpmailerException |
string textLine(
string
$value
)
|
|
Return a formatted mail line.
Parameters:
API Tags:
integer utf8CharBoundary(
string
$encodedText, integer
$maxLength
)
|
|
Find the last character boundary prior to $maxLength in a utf-8 quoted (printable) encoded string.
Original written by Colin Brown.
Parameters:
string |
$encodedText: |
utf-8 QP text |
integer |
$maxLength: |
find last character boundary prior to this length |
API Tags:
string wrapText(
string
$message, integer
$length, [boolean
$qp_mode = false]
)
|
|
Word-wrap message.
For use with mailers that do not automatically perform wrapping and for quoted-printable encoded messages. Original written by philippe.
Parameters:
string |
$message: |
The message to wrap |
integer |
$length: |
The line length to wrap to |
boolean |
$qp_mode: |
Whether to run in Quoted-Printable mode |
API Tags:
Constants
SMTP RFC standard line ending.
Error severity: message, likely ok to continue processing.
Error severity: message, plus full stop, critical error reached.
Error severity: message only, continue processing.
|
|