\PHPMailer
Synopsis
class PHPMailer
{
- // constants
- 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 string $From = 'root@localhost';
- public string $FromName = 'Root User';
- public string $Sender = '';
- public string $Subject = '';
- public string $Body = '';
- public string $AltBody = '';
- protected string $MIMEBody = '';
- protected string $MIMEHeader = '';
- protected string $SentMIMEMessage = '';
- 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 $SMTPKeepAlive = false;
- public bool $SingleTo = false;
- public bool $SingleToArray = ;
- public string $LE = "\n";
- public string $DKIM_selector = 'phpmailer';
- public string $DKIM_identity = '';
- public string $DKIM_passphrase = '';
- public string $DKIM_domain = '';
- public string $DKIM_private = '';
- public string $action_function = '';
- public string $Version = '5.2.1';
- public string $XMailer = '';
- protected $smtp = NULL;
- protected array $to = ;
- protected array $cc = ;
- protected array $bcc = ;
- protected array $ReplyTo = ;
- protected array $all_recipients = ;
- protected array $attachment = ;
- protected array $CustomHeader = ;
- protected string $message_type = '';
- protected array $boundary = ;
- protected array $language = ;
- protected integer $error_count = 0;
- protected string $sign_cert_file = '';
- protected string $sign_key_file = '';
- protected string $sign_key_pass = '';
- protected boolean $exceptions = false;
- // 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()
- protected boolean AddAnAddress()
- public boolean SetFrom()
- public static boolean ValidateAddress()
- public bool Send()
- protected void PreSend()
- protected void PostSend()
- protected bool SendmailSend()
- protected bool MailSend()
- protected bool SmtpSend()
- public bool SmtpConnect()
- public void SmtpClose()
- public void SetLanguage()
- public array GetTranslations()
- public string AddrAppend()
- public string AddrFormat()
- public string WrapText()
- public int UTF8CharBoundary()
- public void SetWordWrap()
- public string CreateHeader()
- public string GetMailMIME()
- public string GetSentMIMEMessage()
- public string CreateBody()
- protected string GetBoundary()
- protected string EndBoundary()
- protected void SetMessageType()
- public string HeaderLine()
- public string TextLine()
- public bool AddAttachment()
- public array GetAttachments()
- protected string AttachAll()
- protected 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 void AddStringEmbeddedImage()
- public bool InlineImageExists()
- public void AttachmentExists()
- public void AlternativeExists()
- 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()
- protected string ServerHostname()
- protected string Lang()
- public bool IsError()
- public string FixEOL()
- public void AddCustomHeader()
- public $message MsgHTML()
- public static string _mime_types()
- public void set()
- public string SecureHeader()
- public void Sign()
- public void DKIM_QP()
- public void DKIM_Sign()
- public void DKIM_HeaderC()
- public void DKIM_BodyC()
- public void DKIM_Add()
- protected void doCallback()
Tasks
Line | Task |
---|---|
2358+ | Should this not be using __set() magic function? |
Constants
Name | Value |
---|---|
STOP_MESSAGE | 0 |
STOP_CONTINUE | 1 |
STOP_CRITICAL | 2 |
Members
protected
- $CustomHeader
- $MIMEBody
—
string
Stores the complete compiled MIME message body. - $MIMEHeader
—
string
Stores the complete compiled MIME message headers. - $ReplyTo
- $SentMIMEMessage
—
string
Stores the complete sent MIME message (Body and Headers) - $all_recipients
- $attachment
- $bcc
- $boundary
- $cc
- $error_count
- $exceptions
- $language
- $message_type
- $sign_cert_file
- $sign_key_file
- $sign_key_pass
- $smtp
- $to
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. - $DKIM_domain
—
string
Used with DKIM DNS Resource Record optional, in format of email address 'you@yourdomain.com' - $DKIM_identity
—
string
Used with DKIM DNS Resource Record optional, in format of email address 'you@yourdomain.com' - $DKIM_passphrase
—
string
Used with DKIM DNS Resource Record - $DKIM_private
—
string
Used with DKIM DNS Resource Record optional, in format of email address 'you@yourdomain.com' - $DKIM_selector
—
string
Used with DKIM DNS Resource Record - $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. - $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 - $SingleToArray
—
bool
If SingleTo is true, this provides the array to hold the email addresses - $Subject
—
string
Sets the Subject of the message. - $Timeout
—
int
Sets the SMTP server timeout in seconds. - $Username
—
string
Sets SMTP username. - $Version
—
string
Sets the PHPMailer Version number - $WordWrap
—
int
Sets word wrapping on the body of the message to a given number of characters. - $XMailer
—
string
What to use in the X-Mailer header - $action_function
—
string
Callback Action function name the function that handles the result of the send email action. Parameters: bool $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
Methods
protected
- 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.
- GetBoundary() — Returns the start of a message boundary.
- Lang() — Returns a message in the appropriate language.
- MailSend() — Sends mail using the PHP mail() function.
- PostSend()
- PreSend()
- SendmailSend() — Sends mail using the $Sendmail program.
- ServerHostname() — Returns the server hostname or 'localhost.localdomain' if unknown.
- SetError() — Adds the error message to the error container.
- SetMessageType() — Sets the message type.
- SmtpSend() — Sends mail via SMTP using PhpSMTP Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
- doCallback()
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.
- AddStringEmbeddedImage()
- AddrAppend() — Creates recipient headers.
- AddrFormat() — Formats an address correctly.
- AlternativeExists()
- AttachmentExists()
- 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.
- DKIM_Add() — Create the DKIM header, body, as new header
- DKIM_BodyC() — Generate DKIM Canonicalization Body
- DKIM_HeaderC() — Generate DKIM Canonicalization Header
- DKIM_QP() — Set the private key file and password to sign the message.
- DKIM_Sign() — Generate DKIM signature
- 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.
- FixEOL() — Changes every end of line from CR or LF to CRLF.
- GetAttachments() — Return the current array of attachments
- GetMailMIME() — Returns the message MIME.
- GetSentMIMEMessage() — Returns the MIME message (headers and body). Only really valid post PreSend().
- GetTranslations() — Return the current array of language strings
- 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
- SetLanguage() — Sets the language for all class error messages.
- 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)