PHP Class SlightPHP\PHPMailer

Afficher le fichier Open project: hetao29/slightphp

Méthodes publiques

Свойство Type Description
$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.

Méthodes publiques

Méthode Description
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)

Private Methods

Méthode Description
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.

Method Details

AddAddress() public méthode

Adds a "To" address.
public AddAddress ( string $address, string $name = '' ) : void
$address string
$name string
Résultat void

AddAttachment() public méthode

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.
Résultat boolean

AddBCC() public méthode

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
Résultat void

AddCC() public méthode

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
Résultat void

AddCustomHeader() public méthode

Adds a custom header.
public AddCustomHeader ( $custom_header ) : void
Résultat void

AddEmbeddedImage() public méthode

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.
Résultat boolean

AddReplyTo() public méthode

Adds a "Reply-to" address.
public AddReplyTo ( string $address, string $name = '' ) : void
$address string
$name string
Résultat void

AddStringAttachment() public méthode

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.
Résultat void

AddrAppend() public méthode

Creates recipient headers.
public AddrAppend ( $type, $addr ) : string
Résultat string

AddrFormat() public méthode

Formats an address correctly.
public AddrFormat ( $addr ) : string
Résultat string

AttachAll() public méthode

Returns an empty string on failure.
public AttachAll ( ) : string
Résultat string

Base64EncodeWrapMB() public méthode

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
Résultat string

ClearAddresses() public méthode

Clears all recipients assigned in the TO array. Returns void.
public ClearAddresses ( ) : void
Résultat void

ClearAllRecipients() public méthode

Clears all recipients assigned in the TO, CC and BCC array. Returns void.
public ClearAllRecipients ( ) : void
Résultat void

ClearAttachments() public méthode

Clears all previously set filesystem, string, and binary attachments. Returns void.
public ClearAttachments ( ) : void
Résultat void

ClearBCCs() public méthode

Clears all recipients assigned in the BCC array. Returns void.
public ClearBCCs ( ) : void
Résultat void

ClearCCs() public méthode

Clears all recipients assigned in the CC array. Returns void.
public ClearCCs ( ) : void
Résultat void

ClearCustomHeaders() public méthode

Clears all custom headers. Returns void.
public ClearCustomHeaders ( ) : void
Résultat void

ClearReplyTos() public méthode

Clears all recipients assigned in the ReplyTo array. Returns void.
public ClearReplyTos ( ) : void
Résultat void

CreateBody() public méthode

Assembles the message body. Returns an empty string on failure.
public CreateBody ( ) : string
Résultat string

CreateHeader() public méthode

Assembles message header.
public CreateHeader ( ) : string
Résultat string

EncodeFile() public méthode

Encodes attachment in requested format. Returns an empty string on failure.
public EncodeFile ( $path, $encoding = 'base64' ) : string
Résultat string

EncodeHeader() public méthode

Encode a header string to best of Q, B, quoted or none.
public EncodeHeader ( $str, $position = 'text' ) : string
Résultat string

EncodeQ() public méthode

Encode string to q encoding.
public EncodeQ ( $str, $position = 'text' ) : string
Résultat string

EncodeQP() public méthode

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
Résultat string

EncodeString() public méthode

Encodes string to requested format. Returns an empty string on failure.
public EncodeString ( $str, $encoding = 'base64' ) : string
Résultat string

EndBoundary() public méthode

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

GetBoundary() public méthode

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

GetMailMIME() public méthode

Returns the message MIME.
public GetMailMIME ( ) : string
Résultat string

HasMultiBytes() public méthode

Checks if a string contains multibyte characters.
public HasMultiBytes ( string $str ) : boolean
$str string multi-byte text to wrap encode
Résultat boolean

HeaderLine() public méthode

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

InlineImageExists() public méthode

Returns true if an inline attachment is present.
public InlineImageExists ( ) : boolean
Résultat boolean

IsError() public méthode

Returns true if an error occurred.
public IsError ( ) : boolean
Résultat boolean

IsHTML() public méthode

Sets message type to HTML.
public IsHTML ( boolean $bool ) : void
$bool boolean
Résultat void

IsMail() public méthode

Sets Mailer to send message using PHP mail() function.
public IsMail ( ) : void
Résultat void

IsQmail() public méthode

Sets Mailer to send message using the qmail MTA.
public IsQmail ( ) : void
Résultat void

IsSMTP() public méthode

Sets Mailer to send message using SMTP.
public IsSMTP ( ) : void
Résultat void

IsSendmail() public méthode

Sets Mailer to send message using the $Sendmail program.
public IsSendmail ( ) : void
Résultat void

MailSend() public méthode

Sends mail using the PHP mail() function.
public MailSend ( $header, $body ) : boolean
Résultat boolean

MsgHTML() public méthode

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

SecureHeader() public méthode

Strips newlines to prevent header injection.
public SecureHeader ( string $str ) : string
$str string String
Résultat string

Send() public méthode

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
Résultat boolean

SendmailSend() public méthode

Sends mail using the $Sendmail program.
public SendmailSend ( $header, $body ) : boolean
Résultat boolean

SetLanguage() public méthode

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
Résultat boolean

SetMessageType() public méthode

Sets the message type.
public SetMessageType ( ) : void
Résultat void

SetWordWrap() public méthode

Set the body wrapping.
public SetWordWrap ( ) : void
Résultat void

Sign() public méthode

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() public méthode

Closes the active SMTP session if one exists.
public SmtpClose ( ) : void
Résultat void

SmtpConnect() public méthode

Initiates a connection to an SMTP server. Returns false if the operation failed.
public SmtpConnect ( ) : boolean
Résultat boolean

SmtpSend() public méthode

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
Résultat boolean

TextLine() public méthode

Returns a formatted mail line.
public TextLine ( $value ) : string
Résultat string

UTF8CharBoundary() public méthode

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
Résultat integer

WrapText() public méthode

Original written by philippe.
public WrapText ( $message, $length, $qp_mode = false ) : string
Résultat string

_mime_types() public méthode

Gets the mime type of the embedded or inline image
public _mime_types ( $ext = '' ) : mime
Résultat mime type of ext

getFile() public méthode

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

get_magic_quotes() public méthode

public get_magic_quotes ( )

set() public méthode

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

Property Details

$AltBody public_oe property

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
Résultat string

$Body public_oe property

If HTML then run IsHTML(true).
public string $Body
Résultat string

$CharSet public_oe property

Sets the CharSet of the message.
public string $CharSet
Résultat string

$ConfirmReadingTo public_oe property

Sets the email address that a reading confirmation will be sent.
public string $ConfirmReadingTo
Résultat string

$ContentType public_oe property

Sets the Content-type of the message.
public string $ContentType
Résultat string

$Encoding public_oe property

Sets the Encoding of the message. Options for this are "8bit", "7bit", "binary", "base64", and "quoted-printable".
public string $Encoding
Résultat string

$ErrorInfo public_oe property

Holds the most recent mailer error message.
public string $ErrorInfo
Résultat string

$From public_oe property

Sets the From email address for the message.
public string $From
Résultat string

$FromName public_oe property

Sets the From name of the message.
public string $FromName
Résultat string

$Helo public_oe property

Sets the SMTP HELO of the message (Default is $Hostname).
public string $Helo
Résultat string

$Host public_oe property

Hosts will be tried in order.
public string $Host
Résultat string

$Hostname public_oe property

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
Résultat string

$Mailer public_oe property

Method to send mail: ("mail", "sendmail", or "smtp").
public string $Mailer
Résultat string

$MessageID public_oe property

If empty, a unique id will be generated.
public string $MessageID
Résultat string

$Password public_oe property

Sets SMTP password.
public string $Password
Résultat string

$PluginDir public_oe property

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
Résultat string

$Port public_oe property

Sets the default SMTP server port.
public int $Port
Résultat integer

$Priority public_oe property

Email priority (1 = High, 3 = Normal, 5 = low).
public int $Priority
Résultat integer

$SMTPAuth public_oe property

Sets SMTP authentication. Utilizes the Username and Password variables.
public bool $SMTPAuth
Résultat boolean

$SMTPDebug public_oe property

Sets SMTP class debugging on or off.
public bool $SMTPDebug
Résultat boolean

$SMTPKeepAlive public_oe property

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
Résultat boolean

$SMTPSecure public_oe property

Options are "", "ssl" or "tls"
public string $SMTPSecure
Résultat string

$Sender public_oe property

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
Résultat string

$Sendmail public_oe property

Sets the path of the sendmail program.
public string $Sendmail
Résultat string

$SingleTo public_oe property

Provides the ability to have the TO field process individual emails, instead of sending to entire TO addresses
public bool $SingleTo
Résultat boolean

$Subject public_oe property

Sets the Subject of the message.
public string $Subject
Résultat string

$Timeout public_oe property

Sets the SMTP server timeout in seconds. This function will not work with the win32 version.
public int $Timeout
Résultat integer

$Username public_oe property

Sets SMTP username.
public string $Username
Résultat string

$Version public_oe property

Holds PHPMailer version.
public string $Version
Résultat string

$WordWrap public_oe property

Sets word wrapping on the body of the message to a given number of characters.
public int $WordWrap
Résultat integer