\PHPMailer
Synopsis
class PHPMailer
{
- // constants
- const VERSION = '5.0.0';
- const STOP_MESSAGE = 0;
- const STOP_CONTINUE = 1;
- const STOP_CRITICAL = 2;
- // members
- public integer $Priority = 3;
- public string $CharSet = 'iso-8859-1';
- public string $ContentType = 'text/plain';
- public string $Encoding = '8bit';
- public string $ErrorInfo = '';
- public $From = NULL;
- public $FromName = NULL;
- public string $Sender = '';
- public string $Subject = '';
- public string $Body = '';
- public string $AltBody = '';
- public integer $WordWrap = 0;
- public string $Mailer = 'mail';
- public string $Sendmail = '/usr/sbin/sendmail';
- public string $PluginDir = '';
- public string $ConfirmReadingTo = '';
- public string $Hostname = '';
- public string $MessageID = '';
- public string $Host = 'localhost';
- public integer $Port = 25;
- public string $Helo = '';
- public string $SMTPSecure = '';
- public bool $SMTPAuth = false;
- public string $Username = '';
- public string $Password = '';
- public integer $Timeout = 10;
- public bool $SMTPDebug = false;
- public bool $SMTPDebugStop = true;
- public bool $SMTPKeepAlive = false;
- public bool $SingleTo = false;
- public string $LE = "\n";
- private $smtp = NULL;
- private array $to = ;
- private array $cc = ;
- private array $bcc = ;
- private array $ReplyTo = ;
- private array $all_recipients = ;
- private array $attachment = ;
- private array $CustomHeader = ;
- private string $message_type = '';
- private array $boundary = ;
- private integer $error_count = 0;
- private string $sign_cert_file = "";
- private string $sign_key_file = "";
- private string $sign_key_pass = "";
- private boolean $exceptions = false;
- protected static array $status_messages = ;
- protected static array $mimes = ;
- // methods
- public void __construct()
- public void IsHTML()
- public void IsSMTP()
- public void IsMail()
- public void IsSendmail()
- public void IsQmail()
- public boolean AddAddress()
- public boolean AddCC()
- public boolean AddBCC()
- public boolean AddReplyTo()
- private boolean AddAnAddress()
- public boolean SetFrom()
- public static boolean ValidateAddress()
- public bool Send()
- protected bool SendmailSend()
- protected bool MailSend()
- protected bool SmtpSend()
- public bool SmtpConnect()
- public void SmtpClose()
- public string AddrAppend()
- public string AddrFormat()
- public string WrapText()
- public int UTF8CharBoundary()
- public void SetWordWrap()
- public string CreateHeader()
- public string GetMailMIME()
- public string CreateBody()
- private void GetBoundary()
- private void EndBoundary()
- private void SetMessageType()
- public string HeaderLine()
- public string TextLine()
- public bool AddAttachment()
- public array GetAttachments()
- private string AttachAll()
- private string EncodeFile()
- public string EncodeString()
- public string EncodeHeader()
- public bool HasMultiBytes()
- public string Base64EncodeWrapMB()
- public string EncodeQPphp()
- public string EncodeQP()
- public string EncodeQ()
- public void AddStringAttachment()
- public bool AddEmbeddedImage()
- public bool InlineImageExists()
- public void ClearAddresses()
- public void ClearCCs()
- public void ClearBCCs()
- public void ClearReplyTos()
- public void ClearAllRecipients()
- public void ClearAttachments()
- public void ClearCustomHeaders()
- protected void SetError()
- public static string RFCDate()
- private string ServerHostname()
- private string Stat()
- public bool IsError()
- private string FixEOL()
- public void AddCustomHeader()
- public $message MsgHTML()
- public static string _mime_types()
- public void set()
- public string SecureHeader()
- public void Sign()
Tasks
Line | Task |
---|---|
1997+ | Should this not be using __set() magic function? |
Constants
Name | Value |
---|---|
VERSION | '5.0.0' |
STOP_MESSAGE | 0 |
STOP_CONTINUE | 1 |
STOP_CRITICAL | 2 |
Members
private
- $CustomHeader
- $ReplyTo
- $all_recipients
- $attachment
- $bcc
- $boundary
- $cc
- $error_count
- $exceptions
- $message_type
- $sign_cert_file
- $sign_key_file
- $sign_key_pass
- $smtp
- $to
protected
- $mimes
- $status_messages
public
- $AltBody
—
string
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. - $Body
—
string
Sets the Body of the message. This can be either an HTML or text body. - $CharSet
—
string
Sets the CharSet of the message. - $ConfirmReadingTo
—
string
Sets the email address that a reading confirmation will be sent. - $ContentType
—
string
Sets the Content-type of the message. - $Encoding
—
string
Sets the Encoding of the message. Options for this are "8bit", "7bit", "binary", "base64", and "quoted-printable". - $ErrorInfo
—
string
Holds the most recent mailer error message. - $From
—
string
Sets the From email address for the message. - $FromName
—
string
Sets the From name of the message. - $Helo
—
string
Sets the SMTP HELO of the message (Default is $Hostname). - $Host
—
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"). - $Hostname
—
string
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'. - $LE
—
string
Provides the ability to change the line ending - $Mailer
—
string
Method to send mail: ("mail", "sendmail", or "smtp"). - $MessageID
—
string
Sets the message ID to be used in the Message-Id header. - $Password
—
string
Sets SMTP password. - $PluginDir
—
string
Path to PHPMailer plugins. Useful if the SMTP class is in a different directory than the PHP include path. - $Port
—
int
Sets the default SMTP server port. - $Priority
—
int
Email priority (1 = High, 3 = Normal, 5 = low). - $SMTPAuth
—
bool
Sets SMTP authentication. Utilizes the Username and Password variables. - $SMTPDebug
—
bool
Sets SMTP class debugging on or off. - $SMTPDebugStop
—
bool
Sets SMTP debugging to result in a script stop or go on. - $SMTPKeepAlive
—
bool
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(). - $SMTPSecure
—
string
Sets connection prefix. - $Sender
—
string
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. - $Sendmail
—
string
Sets the path of the sendmail program. - $SingleTo
—
bool
Provides the ability to have the TO field process individual emails, instead of sending to entire TO addresses - $Subject
—
string
Sets the Subject of the message. - $Timeout
—
int
Sets the SMTP server timeout in seconds. - $Username
—
string
Sets SMTP username. - $WordWrap
—
int
Sets word wrapping on the body of the message to a given number of characters.
Methods
private
- AddAnAddress() — Adds an address to one of the recipient arrays Addresses that have been added already return false, but do not throw exceptions
- AttachAll() — Attaches all fs, string, and binary attachments to the message.
- EncodeFile() — Encodes attachment in requested format.
- EndBoundary() — Returns the end of a message boundary.
- FixEOL() — Changes every end of line from CR or LF to CRLF.
- GetBoundary() — Returns the start of a message boundary.
- ServerHostname() — Returns the server hostname or 'localhost.localdomain' if unknown.
- SetMessageType() — Sets the message type.
- Stat() — Returns the status message.
protected
- MailSend() — Sends mail using the PHP mail() function.
- SendmailSend() — Sends mail using the $Sendmail program.
- SetError() — Adds the error message to the error container.
- SmtpSend() — Sends mail via SMTP using PhpSMTP Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
public
- __construct() — Constructor
- AddAddress() — Adds a "To" address.
- AddAttachment() — Adds an attachment from a path on the filesystem.
- AddBCC() — Adds a "Bcc" address.
- AddCC() — Adds a "Cc" address.
- AddCustomHeader() — Adds a custom header.
- 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".
- AddReplyTo() — Adds a "Reply-to" address.
- AddStringAttachment() — Adds a string or binary attachment (non-filesystem) to the list.
- AddrAppend() — Creates recipient headers.
- AddrFormat() — Formats an address correctly.
- Base64EncodeWrapMB() — Correctly encodes and wraps long multibyte strings for mail headers without breaking lines within a character.
- ClearAddresses() — Clears all recipients assigned in the TO array. Returns void.
- ClearAllRecipients() — Clears all recipients assigned in the TO, CC and BCC array. Returns void.
- ClearAttachments() — Clears all previously set filesystem, string, and binary attachments. Returns void.
- ClearBCCs() — Clears all recipients assigned in the BCC array. Returns void.
- ClearCCs() — Clears all recipients assigned in the CC array. Returns void.
- ClearCustomHeaders() — Clears all custom headers. Returns void.
- ClearReplyTos() — Clears all recipients assigned in the ReplyTo array. Returns void.
- CreateBody() — Assembles the message body. Returns an empty string on failure.
- CreateHeader() — Assembles message header.
- EncodeHeader() — Encode a header string to best (shortest) of Q, B, quoted or none.
- EncodeQ() — Encode string to q encoding.
- EncodeQP() — Encode string to RFC2045 (6.7) quoted-printable format Uses a PHP5 stream filter to do the encoding about 64x faster than the old version Also results in same content as you started with after decoding
- EncodeQPphp() — Encode string to quoted-printable.
- EncodeString() — Encodes string to requested format.
- GetAttachments() — Return the current array of attachments
- GetMailMIME() — Returns the message MIME.
- HasMultiBytes() — Checks if a string contains multibyte characters.
- HeaderLine() — Returns a formatted header line.
- InlineImageExists() — Returns true if an inline attachment is present.
- IsError() — Returns true if an error occurred.
- IsHTML() — Sets message type to HTML.
- IsMail() — Sets Mailer to send message using PHP mail() function.
- IsQmail() — Sets Mailer to send message using the qmail MTA.
- IsSMTP() — Sets Mailer to send message using SMTP.
- IsSendmail() — Sets Mailer to send message using the $Sendmail program.
- MsgHTML() — Evaluates the message and returns modifications for inline images and backgrounds
- RFCDate() — Returns the proper RFC 822 formatted date.
- SecureHeader() — Strips newlines to prevent header injection.
- Send() — 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.
- SetFrom() — Set the From and FromName properties
- SetWordWrap() — Set the body wrapping.
- Sign() — Set the private key file and password to sign the message.
- SmtpClose() — Closes the active SMTP session if one exists.
- SmtpConnect() — Initiates a connection to an SMTP server.
- TextLine() — Returns a formatted mail line.
- UTF8CharBoundary() — Finds last character boundary prior to maxLength in a utf-8 quoted (printable) encoded string.
- ValidateAddress() — Check that a string looks roughly like an email address should Static so it can be used without instantiation Tries to use PHP built-in validator in the filter extension (from PHP 5.2), falls back to a reasonably competent regex validator Conforms approximately to RFC2822
- WrapText() — Wraps message for use with mailers that do not automatically perform wrapping and for quoted-printable.
- _mime_types() — Gets the MIME type of the embedded or inline image
- set() — Set (or reset) Class Objects (variables)