PHP Класс SlightPHP\PHPMailer

Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$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 If HTML then run IsHTML(true).
$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 Hosts will be tried in order.
$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'.
$Mailer string Method to send mail: ("mail", "sendmail", or "smtp").
$MessageID string If empty, a unique id will be generated.
$Password string Sets SMTP password.
$PluginDir string Path to PHPMailer plugins. This is now only useful if the SMTP class is in a different directory than the PHP include path.
$Port integer Sets the default SMTP server port.
$Priority integer Email priority (1 = High, 3 = Normal, 5 = low).
$SMTPAuth boolean Sets SMTP authentication. Utilizes the Username and Password variables.
$SMTPDebug boolean Sets SMTP class debugging on or off.
$SMTPKeepAlive 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().
$SMTPSecure string Options are "", "ssl" or "tls"
$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 boolean 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 integer Sets the SMTP server timeout in seconds. This function will not work with the win32 version.
$Username string Sets SMTP username.
$Version string Holds PHPMailer version.
$WordWrap integer Sets word wrapping on the body of the message to a given number of characters.

Открытые методы

Метод Описание
AddAddress ( string $address, string $name = '' ) : void Adds a "To" address.
AddAttachment ( string $path, string $name = '', string $encoding = 'base64', string $type = 'application/octet-stream' ) : boolean Adds an attachment from a path on the filesystem.
AddBCC ( string $address, string $name = '' ) : void Adds a "Bcc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
AddCC ( string $address, string $name = '' ) : void Adds a "Cc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
AddCustomHeader ( $custom_header ) : void Adds a custom header.
AddEmbeddedImage ( string $path, string $cid, string $name = '', string $encoding = 'base64', string $type = 'application/octet-stream' ) : boolean 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 ( string $address, string $name = '' ) : void Adds a "Reply-to" address.
AddStringAttachment ( string $string, string $filename, string $encoding = 'base64', string $type = 'application/octet-stream' ) : void Adds a string or binary attachment (non-filesystem) to the list.
AddrAppend ( $type, $addr ) : string Creates recipient headers.
AddrFormat ( $addr ) : string Formats an address correctly.
AttachAll ( ) : string Attaches all fs, string, and binary attachments to the message.
Base64EncodeWrapMB ( string $str ) : string Correctly encodes and wraps long multibyte strings for mail headers without breaking lines within a character.
ClearAddresses ( ) : void Clears all recipients assigned in the TO array. Returns void.
ClearAllRecipients ( ) : void Clears all recipients assigned in the TO, CC and BCC array. Returns void.
ClearAttachments ( ) : void Clears all previously set filesystem, string, and binary attachments. Returns void.
ClearBCCs ( ) : void Clears all recipients assigned in the BCC array. Returns void.
ClearCCs ( ) : void Clears all recipients assigned in the CC array. Returns void.
ClearCustomHeaders ( ) : void Clears all custom headers. Returns void.
ClearReplyTos ( ) : void Clears all recipients assigned in the ReplyTo array. Returns void.
CreateBody ( ) : string Assembles the message body. Returns an empty string on failure.
CreateHeader ( ) : string Assembles message header.
EncodeFile ( $path, $encoding = 'base64' ) : string Encodes attachment in requested format. Returns an empty string on failure.
EncodeHeader ( $str, $position = 'text' ) : string Encode a header string to best of Q, B, quoted or none.
EncodeQ ( $str, $position = 'text' ) : string Encode string to q encoding.
EncodeQP ( $input = '', integer $line_max = 76, $space_conv = false ) : string Encode string to quoted-printable.
EncodeString ( $str, $encoding = 'base64' ) : string Encodes string to requested format. Returns an empty string on failure.
EndBoundary ( $boundary ) Returns the end of a message boundary.
GetBoundary ( $boundary, $charSet, $contentType, $encoding ) Returns the start of a message boundary.
GetMailMIME ( ) : string Returns the message MIME.
HasMultiBytes ( string $str ) : boolean Checks if a string contains multibyte characters.
HeaderLine ( $name, $value ) * Returns a formatted header line.
InlineImageExists ( ) : boolean Returns true if an inline attachment is present.
IsError ( ) : boolean Returns true if an error occurred.
IsHTML ( boolean $bool ) : void Sets message type to HTML.
IsMail ( ) : void Sets Mailer to send message using PHP mail() function.
IsQmail ( ) : void Sets Mailer to send message using the qmail MTA.
IsSMTP ( ) : void Sets Mailer to send message using SMTP.
IsSendmail ( ) : void Sets Mailer to send message using the $Sendmail program.
MailSend ( $header, $body ) : boolean Sends mail using the PHP mail() function.
MsgHTML ( $message, $basedir = '' ) Evaluates the message and returns modifications for inline images and backgrounds
SecureHeader ( string $str ) : string Strips newlines to prevent header injection.
Send ( ) : boolean 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.
SendmailSend ( $header, $body ) : boolean Sends mail using the $Sendmail program.
SetLanguage ( string $lang_type = 'en', string $lang_path = 'language/' ) : boolean Sets the language for all class error messages. Returns false if it cannot load the language file. The default language type is English.
SetMessageType ( ) : void Sets the message type.
SetWordWrap ( ) : void Set the body wrapping.
Sign ( $cert_filename, string $key_filename, string $key_pass ) Set the private key file and password to sign the message.
SmtpClose ( ) : void Closes the active SMTP session if one exists.
SmtpConnect ( ) : boolean Initiates a connection to an SMTP server. Returns false if the operation failed.
SmtpSend ( $header, $body ) : 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.
TextLine ( $value ) : string Returns a formatted mail line.
UTF8CharBoundary ( string $encodedText, integer $maxLength ) : integer Finds last character boundary prior to maxLength in a utf-8 quoted (printable) encoded string.
WrapText ( $message, $length, $qp_mode = false ) : string Wraps message for use with mailers that do not automatically perform wrapping and for quoted-printable.
_mime_types ( $ext = '' ) : mime Gets the mime type of the embedded or inline image
getFile ( string $filename ) Read a file from a supplied filename and return it.
get_magic_quotes ( )
set ( string $name, mixed $value = '' ) Set (or reset) Class Objects (variables)

Приватные методы

Метод Описание
FixEOL ( $str ) : string Changes every end of line from CR or LF to CRLF.
Lang ( $key ) : string Returns a message in the appropriate language.
RFCDate ( ) : string Returns the proper RFC 822 formatted date.
ServerHostname ( ) : string Returns the server hostname or 'localhost.localdomain' if unknown.
SetError ( $msg ) : void Adds the error message to the error container.

Описание методов

AddAddress() публичный Метод

Adds a "To" address.
public AddAddress ( string $address, string $name = '' ) : void
$address string
$name string
Результат void

AddAttachment() публичный Метод

Returns false if the file could not be found or accessed.
public AddAttachment ( string $path, string $name = '', string $encoding = 'base64', string $type = 'application/octet-stream' ) : boolean
$path string Path to the attachment.
$name string Overrides the attachment name.
$encoding string File encoding (see $Encoding).
$type string File extension (MIME) type.
Результат boolean

AddBCC() публичный Метод

Adds a "Bcc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
public AddBCC ( string $address, string $name = '' ) : void
$address string
$name string
Результат void

AddCC() публичный Метод

Adds a "Cc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
public AddCC ( string $address, string $name = '' ) : void
$address string
$name string
Результат void

AddCustomHeader() публичный Метод

Adds a custom header.
public AddCustomHeader ( $custom_header ) : void
Результат void

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' ) : boolean
$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.
Результат boolean

AddReplyTo() публичный Метод

Adds a "Reply-to" address.
public AddReplyTo ( string $address, string $name = '' ) : void
$address string
$name string
Результат void

AddStringAttachment() публичный Метод

This method can be used to attach ascii or binary data, such as a BLOB record from a database.
public AddStringAttachment ( string $string, string $filename, string $encoding = 'base64', string $type = 'application/octet-stream' ) : void
$string string String attachment data.
$filename string Name of the attachment.
$encoding string File encoding (see $Encoding).
$type string File extension (MIME) type.
Результат void

AddrAppend() публичный Метод

Creates recipient headers.
public AddrAppend ( $type, $addr ) : string
Результат string

AddrFormat() публичный Метод

Formats an address correctly.
public AddrFormat ( $addr ) : string
Результат string

AttachAll() публичный Метод

Returns an empty string on failure.
public AttachAll ( ) : string
Результат string

Base64EncodeWrapMB() публичный Метод

Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php
public Base64EncodeWrapMB ( string $str ) : string
$str string multi-byte text to wrap encode
Результат string

ClearAddresses() публичный Метод

Clears all recipients assigned in the TO array. Returns void.
public ClearAddresses ( ) : void
Результат void

ClearAllRecipients() публичный Метод

Clears all recipients assigned in the TO, CC and BCC array. Returns void.
public ClearAllRecipients ( ) : void
Результат void

ClearAttachments() публичный Метод

Clears all previously set filesystem, string, and binary attachments. Returns void.
public ClearAttachments ( ) : void
Результат void

ClearBCCs() публичный Метод

Clears all recipients assigned in the BCC array. Returns void.
public ClearBCCs ( ) : void
Результат void

ClearCCs() публичный Метод

Clears all recipients assigned in the CC array. Returns void.
public ClearCCs ( ) : void
Результат void

ClearCustomHeaders() публичный Метод

Clears all custom headers. Returns void.
public ClearCustomHeaders ( ) : void
Результат void

ClearReplyTos() публичный Метод

Clears all recipients assigned in the ReplyTo array. Returns void.
public ClearReplyTos ( ) : void
Результат void

CreateBody() публичный Метод

Assembles the message body. Returns an empty string on failure.
public CreateBody ( ) : string
Результат string

CreateHeader() публичный Метод

Assembles message header.
public CreateHeader ( ) : string
Результат string

EncodeFile() публичный Метод

Encodes attachment in requested format. Returns an empty string on failure.
public EncodeFile ( $path, $encoding = 'base64' ) : string
Результат string

EncodeHeader() публичный Метод

Encode a header string to best of Q, B, quoted or none.
public EncodeHeader ( $str, $position = 'text' ) : string
Результат string

EncodeQ() публичный Метод

Encode string to q encoding.
public EncodeQ ( $str, $position = 'text' ) : string
Результат string

EncodeQP() публичный Метод

Encode string to quoted-printable.
public EncodeQP ( $input = '', integer $line_max = 76, $space_conv = false ) : string
$line_max integer Number of chars allowed on a line before wrapping
Результат string

EncodeString() публичный Метод

Encodes string to requested format. Returns an empty string on failure.
public EncodeString ( $str, $encoding = 'base64' ) : string
Результат string

EndBoundary() публичный Метод

Returns the end of a message boundary.
public EndBoundary ( $boundary )

GetBoundary() публичный Метод

Returns the start of a message boundary.
public GetBoundary ( $boundary, $charSet, $contentType, $encoding )

GetMailMIME() публичный Метод

Returns the message MIME.
public GetMailMIME ( ) : string
Результат string

HasMultiBytes() публичный Метод

Checks if a string contains multibyte characters.
public HasMultiBytes ( string $str ) : boolean
$str string multi-byte text to wrap encode
Результат boolean

HeaderLine() публичный Метод

* Returns a formatted header line.
public HeaderLine ( $name, $value )

InlineImageExists() публичный Метод

Returns true if an inline attachment is present.
public InlineImageExists ( ) : boolean
Результат boolean

IsError() публичный Метод

Returns true if an error occurred.
public IsError ( ) : boolean
Результат boolean

IsHTML() публичный Метод

Sets message type to HTML.
public IsHTML ( boolean $bool ) : void
$bool boolean
Результат void

IsMail() публичный Метод

Sets Mailer to send message using PHP mail() function.
public IsMail ( ) : void
Результат void

IsQmail() публичный Метод

Sets Mailer to send message using the qmail MTA.
public IsQmail ( ) : void
Результат void

IsSMTP() публичный Метод

Sets Mailer to send message using SMTP.
public IsSMTP ( ) : void
Результат void

IsSendmail() публичный Метод

Sets Mailer to send message using the $Sendmail program.
public IsSendmail ( ) : void
Результат void

MailSend() публичный Метод

Sends mail using the PHP mail() function.
public MailSend ( $header, $body ) : boolean
Результат boolean

MsgHTML() публичный Метод

Evaluates the message and returns modifications for inline images and backgrounds
public MsgHTML ( $message, $basedir = '' )

SecureHeader() публичный Метод

Strips newlines to prevent header injection.
public SecureHeader ( string $str ) : string
$str string String
Результат string

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.
public Send ( ) : boolean
Результат boolean

SendmailSend() публичный Метод

Sends mail using the $Sendmail program.
public SendmailSend ( $header, $body ) : boolean
Результат boolean

SetLanguage() публичный Метод

Sets the language for all class error messages. Returns false if it cannot load the language file. The default language type is English.
public SetLanguage ( string $lang_type = 'en', string $lang_path = 'language/' ) : boolean
$lang_type string Type of language (e.g. Portuguese: "br")
$lang_path string Path to the language file directory
Результат boolean

SetMessageType() публичный Метод

Sets the message type.
public SetMessageType ( ) : void
Результат void

SetWordWrap() публичный Метод

Set the body wrapping.
public SetWordWrap ( ) : void
Результат void

Sign() публичный Метод

Set the private key file and password to sign the message.
public Sign ( $cert_filename, string $key_filename, string $key_pass )
$key_filename string Parameter File Name
$key_pass string Password for private key

SmtpClose() публичный Метод

Closes the active SMTP session if one exists.
public SmtpClose ( ) : void
Результат void

SmtpConnect() публичный Метод

Initiates a connection to an SMTP server. Returns false if the operation failed.
public SmtpConnect ( ) : boolean
Результат boolean

SmtpSend() публичный Метод

Sends mail via SMTP using PhpSMTP (Author: Chris Ryan). Returns bool. Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
public SmtpSend ( $header, $body ) : boolean
Результат boolean

TextLine() публичный Метод

Returns a formatted mail line.
public TextLine ( $value ) : string
Результат string

UTF8CharBoundary() публичный Метод

Original written by Colin Brown.
public UTF8CharBoundary ( string $encodedText, integer $maxLength ) : integer
$encodedText string utf-8 QP text
$maxLength integer find last character boundary prior to this length
Результат integer

WrapText() публичный Метод

Original written by philippe.
public WrapText ( $message, $length, $qp_mode = false ) : string
Результат string

_mime_types() публичный Метод

Gets the mime type of the embedded or inline image
public _mime_types ( $ext = '' ) : mime
Результат mime type of ext

getFile() публичный Метод

Read a file from a supplied filename and return it.
public getFile ( string $filename )
$filename string Parameter File Name

get_magic_quotes() публичный Метод

public get_magic_quotes ( )

set() публичный Метод

Usage Example: $page->set('X-Priority', '3');
public set ( string $name, mixed $value = '' )
$name string Parameter Name
$value mixed Parameter Value NOTE: will not work with arrays, there are no arrays to set/reset

Описание свойств

$AltBody публичное свойство

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.
public string $AltBody
Результат string

$Body публичное свойство

If HTML then run IsHTML(true).
public string $Body
Результат string

$CharSet публичное свойство

Sets the CharSet of the message.
public string $CharSet
Результат string

$ConfirmReadingTo публичное свойство

Sets the email address that a reading confirmation will be sent.
public string $ConfirmReadingTo
Результат string

$ContentType публичное свойство

Sets the Content-type of the message.
public string $ContentType
Результат string

$Encoding публичное свойство

Sets the Encoding of the message. Options for this are "8bit", "7bit", "binary", "base64", and "quoted-printable".
public string $Encoding
Результат string

$ErrorInfo публичное свойство

Holds the most recent mailer error message.
public string $ErrorInfo
Результат string

$From публичное свойство

Sets the From email address for the message.
public string $From
Результат string

$FromName публичное свойство

Sets the From name of the message.
public string $FromName
Результат string

$Helo публичное свойство

Sets the SMTP HELO of the message (Default is $Hostname).
public string $Helo
Результат string

$Host публичное свойство

Hosts will be tried in order.
public string $Host
Результат string

$Hostname публичное свойство

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'.
public string $Hostname
Результат string

$Mailer публичное свойство

Method to send mail: ("mail", "sendmail", or "smtp").
public string $Mailer
Результат string

$MessageID публичное свойство

If empty, a unique id will be generated.
public string $MessageID
Результат string

$Password публичное свойство

Sets SMTP password.
public string $Password
Результат string

$PluginDir публичное свойство

Path to PHPMailer plugins. This is now only useful if the SMTP class is in a different directory than the PHP include path.
public string $PluginDir
Результат string

$Port публичное свойство

Sets the default SMTP server port.
public int $Port
Результат integer

$Priority публичное свойство

Email priority (1 = High, 3 = Normal, 5 = low).
public int $Priority
Результат integer

$SMTPAuth публичное свойство

Sets SMTP authentication. Utilizes the Username and Password variables.
public bool $SMTPAuth
Результат boolean

$SMTPDebug публичное свойство

Sets SMTP class debugging on or off.
public bool $SMTPDebug
Результат boolean

$SMTPKeepAlive публичное свойство

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().
public bool $SMTPKeepAlive
Результат boolean

$SMTPSecure публичное свойство

Options are "", "ssl" or "tls"
public string $SMTPSecure
Результат string

$Sender публичное свойство

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.
public string $Sender
Результат string

$Sendmail публичное свойство

Sets the path of the sendmail program.
public string $Sendmail
Результат string

$SingleTo публичное свойство

Provides the ability to have the TO field process individual emails, instead of sending to entire TO addresses
public bool $SingleTo
Результат boolean

$Subject публичное свойство

Sets the Subject of the message.
public string $Subject
Результат string

$Timeout публичное свойство

Sets the SMTP server timeout in seconds. This function will not work with the win32 version.
public int $Timeout
Результат integer

$Username публичное свойство

Sets SMTP username.
public string $Username
Результат string

$Version публичное свойство

Holds PHPMailer version.
public string $Version
Результат string

$WordWrap публичное свойство

Sets word wrapping on the body of the message to a given number of characters.
public int $WordWrap
Результат integer