Joomla CMS  3.8.5 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.8.5 et du framework Joomla Platform intégré
Référence de la classe PHPMailer
+ Graphe d'héritage de PHPMailer:

Fonctions membres publiques

 __construct ($exceptions=null)
 
 __destruct ()
 
 isHTML ($isHtml=true)
 
 isSMTP ()
 
 isMail ()
 
 isSendmail ()
 
 isQmail ()
 
 addAddress ($address, $name='')
 
 addCC ($address, $name='')
 
 addBCC ($address, $name='')
 
 addReplyTo ($address, $name='')
 
 parseAddresses ($addrstr, $useimap=true)
 
 setFrom ($address, $name='', $auto=true)
 
 getLastMessageID ()
 
 idnSupported ()
 
 punyencodeAddress ($address)
 
 send ()
 
 preSend ()
 
 postSend ()
 
 getSMTPInstance ()
 
 smtpConnect ($options=null)
 
 smtpClose ()
 
 setLanguage ($langcode='en', $lang_path='')
 
 getTranslations ()
 
 addrAppend ($type, $addr)
 
 addrFormat ($addr)
 
 wrapText ($message, $length, $qp_mode=false)
 
 utf8CharBoundary ($encodedText, $maxLength)
 
 setWordWrap ()
 
 createHeader ()
 
 getMailMIME ()
 
 getSentMIMEMessage ()
 
 createBody ()
 
 headerLine ($name, $value)
 
 textLine ($value)
 
 addAttachment ($path, $name='', $encoding='base64', $type='', $disposition='attachment')
 
 getAttachments ()
 
 encodeString ($str, $encoding='base64')
 
 encodeHeader ($str, $position='text')
 
 hasMultiBytes ($str)
 
 has8bitChars ($text)
 
 base64EncodeWrapMB ($str, $linebreak=null)
 
 encodeQP ($string, $line_max=76)
 
 encodeQPphp ( $string, $line_max=76, $space_conv=false)
 
 encodeQ ($str, $position='text')
 
 addStringAttachment ( $string, $filename, $encoding='base64', $type='', $disposition='attachment')
 
 addEmbeddedImage ($path, $cid, $name='', $encoding='base64', $type='', $disposition='inline')
 
 addStringEmbeddedImage ( $string, $cid, $name='', $encoding='base64', $type='', $disposition='inline')
 
 inlineImageExists ()
 
 attachmentExists ()
 
 alternativeExists ()
 
 clearQueuedAddresses ($kind)
 
 clearAddresses ()
 
 clearCCs ()
 
 clearBCCs ()
 
 clearReplyTos ()
 
 clearAllRecipients ()
 
 clearAttachments ()
 
 clearCustomHeaders ()
 
 isError ()
 
 fixEOL ($str)
 
 addCustomHeader ($name, $value=null)
 
 getCustomHeaders ()
 
 msgHTML ($message, $basedir='', $advanced=false)
 
 html2text ($html, $advanced=false)
 
 set ($name, $value='')
 
 secureHeader ($str)
 
 sign ($cert_filename, $key_filename, $key_pass, $extracerts_filename='')
 
 DKIM_QP ($txt)
 
 DKIM_Sign ($signHeader)
 
 DKIM_HeaderC ($signHeader)
 
 DKIM_BodyC ($body)
 
 DKIM_Add ($headers_line, $subject, $body)
 
 getToAddresses ()
 
 getCcAddresses ()
 
 getBccAddresses ()
 
 getReplyToAddresses ()
 
 getAllRecipientAddresses ()
 

Fonctions membres publiques statiques

static validateAddress ($address, $patternselect=null)
 
static rfcDate ()
 
static _mime_types ($ext='')
 
static filenameToType ($filename)
 
static mb_pathinfo ($path, $options=null)
 
static normalizeBreaks ($text, $breaktype="\")
 
static hasLineLongerThanMax ($str)
 

Champs de données

 $Version = '5.2.26'
 
 $Priority = null
 
 $CharSet = 'iso-8859-1'
 
 $ContentType = 'text/plain'
 
 $Encoding = '8bit'
 
 $ErrorInfo = ''
 
 $From = 'root@localhost'
 
 $FromName = 'Root User'
 
 $Sender = ''
 
 $ReturnPath = ''
 
 $Subject = ''
 
 $Body = ''
 
 $AltBody = ''
 
 $Ical = ''
 
 $WordWrap = 0
 
 $Mailer = 'mail'
 
 $Sendmail = '/usr/sbin/sendmail'
 
 $UseSendmailOptions = true
 
 $PluginDir = ''
 
 $ConfirmReadingTo = ''
 
 $Hostname = ''
 
 $MessageID = ''
 
 $MessageDate = ''
 
 $Host = 'localhost'
 
 $Port = 25
 
 $Helo = ''
 
 $SMTPSecure = ''
 
 $SMTPAutoTLS = true
 
 $SMTPAuth = false
 
 $SMTPOptions = array()
 
 $Username = ''
 
 $Password = ''
 
 $AuthType = ''
 
 $Realm = ''
 
 $Workstation = ''
 
 $Timeout = 300
 
 $SMTPDebug = 0
 
 $Debugoutput = 'echo'
 
 $SMTPKeepAlive = false
 
 $SingleTo = false
 
 $SingleToArray = array()
 
 $do_verp = false
 
 $AllowEmpty = false
 
 $LE = "\n"
 
 $DKIM_selector = ''
 
 $DKIM_identity = ''
 
 $DKIM_passphrase = ''
 
 $DKIM_domain = ''
 
 $DKIM_private = ''
 
 $DKIM_private_string = ''
 
 $action_function = ''
 
 $XMailer = ''
 
const STOP_MESSAGE = 0
 
const STOP_CONTINUE = 1
 
const STOP_CRITICAL = 2
 
const CRLF = "\r\n"
 
const MAX_LINE_LENGTH = 998
 

Attributs publics statiques

static $validator = 'auto'
 

Fonctions membres protégées

 edebug ($str)
 
 addOrEnqueueAnAddress ($kind, $address, $name)
 
 addAnAddress ($kind, $address, $name='')
 
 sendmailSend ($header, $body)
 
 mailSend ($header, $body)
 
 smtpSend ($header, $body)
 
 generateId ()
 
 getBoundary ($boundary, $charSet, $contentType, $encoding)
 
 endBoundary ($boundary)
 
 setMessageType ()
 
 attachAll ($disposition_type, $boundary)
 
 encodeFile ($path, $encoding='base64')
 
 setError ($msg)
 
 serverHostname ()
 
 lang ($key)
 
 doCallback ($isSent, $to, $cc, $bcc, $subject, $body, $from)
 

Fonctions membres protégées statiques

static isShellSafe ($string)
 

Attributs protégés

 $MIMEBody = ''
 
 $MIMEHeader = ''
 
 $mailHeader = ''
 
 $smtp = null
 
 $to = array()
 
 $cc = array()
 
 $bcc = array()
 
 $ReplyTo = array()
 
 $all_recipients = array()
 
 $RecipientsQueue = array()
 
 $ReplyToQueue = array()
 
 $attachment = array()
 
 $CustomHeader = array()
 
 $lastMessageID = ''
 
 $message_type = ''
 
 $boundary = array()
 
 $language = array()
 
 $error_count = 0
 
 $sign_cert_file = ''
 
 $sign_key_file = ''
 
 $sign_extracerts_file = ''
 
 $sign_key_pass = ''
 
 $exceptions = false
 
 $uniqueid = ''
 

Fonctions membres privées

 mailPassthru ($to, $subject, $body, $header, $params)
 

Documentation des constructeurs et destructeur

◆ __construct()

__construct (   $exceptions = null)

Constructor.

Paramètres
boolean$exceptionsShould we throw external exceptions?

Références $exceptions, et null.

◆ __destruct()

__destruct ( )

Destructor.

Références smtpClose().

Documentation des fonctions membres

◆ _mime_types()

static _mime_types (   $ext = '')
static

Get the MIME type for a file extension.

Paramètres
string$extFile extension public
Renvoie
string MIME type of file.

◆ addAddress()

addAddress (   $address,
  $name = '' 
)

Add a "To" address.

Paramètres
string$addressThe email address to send to
string$name
Renvoie
boolean true on success, false if address already used or invalid in some way

Références $name, et addOrEnqueueAnAddress().

◆ addAnAddress()

addAnAddress (   $kind,
  $address,
  $name = '' 
)
protected

Add an address to one of the recipient arrays or to the ReplyTo array. Addresses that have been added already return false, but do not throw exceptions.

Paramètres
string$kindOne of 'to', 'cc', 'bcc', or 'ReplyTo'
string$addressThe email address to send, resp. to reply to
string$name
Exceptions
phpmailerException
Renvoie
boolean true on success, false if address already used or invalid in some way protected

Références $name, edebug(), lang(), setError(), et validateAddress().

◆ addAttachment()

addAttachment (   $path,
  $name = '',
  $encoding = 'base64',
  $type = '',
  $disposition = 'attachment' 
)

Add an attachment from a path on the filesystem. Never use a user-supplied path to a file! Returns false if the file could not be found or read.

Paramètres
string$pathPath to the attachment.
string$nameOverrides the attachment name.
string$encodingFile encoding (see $Encoding).
string$typeFile extension (MIME) type.
string$dispositionDisposition to use
Exceptions
phpmailerException
Renvoie
boolean

Références $name, $path, $type, edebug(), lang(), et setError().

◆ addBCC()

addBCC (   $address,
  $name = '' 
)

Add a "BCC" address.

Note
: This function works with the SMTP mailer on win32, not with the "mail" mailer.
Paramètres
string$addressThe email address to send to
string$name
Renvoie
boolean true on success, false if address already used or invalid in some way

Références $name, et addOrEnqueueAnAddress().

◆ addCC()

addCC (   $address,
  $name = '' 
)

Add a "CC" address.

Note
: This function works with the SMTP mailer on win32, not with the "mail" mailer.
Paramètres
string$addressThe email address to send to
string$name
Renvoie
boolean true on success, false if address already used or invalid in some way

Références $name, et addOrEnqueueAnAddress().

◆ addCustomHeader()

addCustomHeader (   $name,
  $value = null 
)

Add a custom header. $name value can be overloaded to contain both header name and value (name:value) public

Paramètres
string$nameCustom header name
string$valueHeader value
Renvoie
void

Références $name, $value, et null.

◆ addEmbeddedImage()

addEmbeddedImage (   $path,
  $cid,
  $name = '',
  $encoding = 'base64',
  $type = '',
  $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' attachments 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. Never use a user-supplied path to a file!

Paramètres
string$pathPath to the attachment.
string$cidContent ID of the attachment; Use this to reference the content when using an embedded image in HTML.
string$nameOverrides the attachment name.
string$encodingFile encoding (see $Encoding).
string$typeFile MIME type.
string$dispositionDisposition to use
Renvoie
boolean True on successfully adding an attachment

Références $name, $path, $type, lang(), et setError().

Référencé par msgHTML().

◆ addOrEnqueueAnAddress()

addOrEnqueueAnAddress (   $kind,
  $address,
  $name 
)
protected

Add an address to one of the recipient arrays or to the ReplyTo array. Because PHPMailer can't validate addresses with an IDN without knowing the PHPMailer::$CharSet (that can still be modified after calling this function), addition of such addresses is delayed until send(). Addresses that have been added already return false, but do not throw exceptions.

Paramètres
string$kindOne of 'to', 'cc', 'bcc', or 'ReplyTo'
string$addressThe email address to send, resp. to reply to
string$name
Exceptions
phpmailerException
Renvoie
boolean true on success, false if address already used or invalid in some way protected

Références $name, $params, edebug(), has8bitChars(), idnSupported(), lang(), et setError().

Référencé par addAddress(), addBCC(), addCC(), et addReplyTo().

◆ addrAppend()

addrAppend (   $type,
  $addr 
)

Create recipient headers. public

Paramètres
string$type
array$addrAn 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@e.nosp@m.xamp.nosp@m.le.co.nosp@m.m', 'Joe User'), array('zoe@e.nosp@m.xamp.nosp@m.le.co.nosp@m.m', 'Zoe User'))
Renvoie
string

Références $LE, $type, et addrFormat().

Référencé par createHeader(), et preSend().

◆ addReplyTo()

addReplyTo (   $address,
  $name = '' 
)

Add a "Reply-To" address.

Paramètres
string$addressThe email address to reply to
string$name
Renvoie
boolean true on success, false if address already used or invalid in some way

Références $name, et addOrEnqueueAnAddress().

◆ addrFormat()

addrFormat (   $addr)

Format an address for use in a message header. public

Paramètres
array$addrA 2-element indexed array, element 0 containing an address, element 1 containing a name like array('joe@e.nosp@m.xamp.nosp@m.le.co.nosp@m.m', 'Joe User')
Renvoie
string

Références encodeHeader(), et secureHeader().

Référencé par addrAppend(), createHeader(), et mailSend().

◆ addStringAttachment()

addStringAttachment (   $string,
  $filename,
  $encoding = 'base64',
  $type = '',
  $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.

Paramètres
string$stringString attachment data.
string$filenameName of the attachment.
string$encodingFile encoding (see $Encoding).
string$typeFile extension (MIME) type.
string$dispositionDisposition to use
Renvoie
void

Références $type.

◆ addStringEmbeddedImage()

addStringEmbeddedImage (   $string,
  $cid,
  $name = '',
  $encoding = 'base64',
  $type = '',
  $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'.

Paramètres
string$stringThe attachment binary data.
string$cidContent ID of the attachment; Use this to reference the content when using an embedded image in HTML.
string$name
string$encodingFile encoding (see $Encoding).
string$typeMIME type.
string$dispositionDisposition to use
Renvoie
boolean True on successfully adding an attachment

Références $name, et $type.

Référencé par msgHTML().

◆ alternativeExists()

alternativeExists ( )

Check if this message has an alternative body set.

Renvoie
boolean

Référencé par msgHTML(), preSend(), et setMessageType().

◆ attachAll()

attachAll (   $disposition_type,
  $boundary 
)
protected

Attach all file, string, and binary attachments to the message. Returns an empty string on failure. protected

Paramètres
string$disposition_type
string$boundary
Renvoie
string

Références $attachment, $boundary, $LE, $mime, $name, $path, $type, encodeFile(), encodeHeader(), encodeString(), isError(), et secureHeader().

Référencé par createBody().

◆ attachmentExists()

attachmentExists ( )

Check if an attachment (non-inline) is present.

Renvoie
boolean

Références $attachment.

Référencé par setMessageType().

◆ base64EncodeWrapMB()

base64EncodeWrapMB (   $str,
  $linebreak = null 
)

Encode and wrap long multibyte strings for mail headers without breaking lines within a character. Adapted from a function by paravoid public string $str multi-byte text to wrap encode string $linebreak string to use as linefeed/end-of-line string

Références $i, $LE, $offset, $start, et null.

Référencé par encodeHeader().

◆ clearAddresses()

clearAddresses ( )

Clear all To recipients.

Renvoie
void

Références $to, et clearQueuedAddresses().

◆ clearAllRecipients()

clearAllRecipients ( )

Clear all recipient types.

Renvoie
void

◆ clearAttachments()

clearAttachments ( )

Clear all filesystem, string, and binary attachments.

Renvoie
void

◆ clearBCCs()

clearBCCs ( )

Clear all BCC recipients.

Renvoie
void

Références $bcc, et clearQueuedAddresses().

◆ clearCCs()

clearCCs ( )

Clear all CC recipients.

Renvoie
void

Références $cc, et clearQueuedAddresses().

◆ clearCustomHeaders()

clearCustomHeaders ( )

Clear all custom headers.

Renvoie
void

◆ clearQueuedAddresses()

clearQueuedAddresses (   $kind)

Clear queued addresses of given kind. protected

Paramètres
string$kind'to', 'cc', or 'bcc'
Renvoie
void

Références $params, et $RecipientsQueue.

Référencé par clearAddresses(), clearBCCs(), et clearCCs().

◆ clearReplyTos()

clearReplyTos ( )

Clear all ReplyTo recipients.

Renvoie
void

◆ createBody()

createBody ( )

Assemble the message body. Returns an empty string on failure. public

Exceptions
phpmailerException
Renvoie
string The assembled message body

Références $CharSet, $Encoding, $file, $LE, $parts, $uniqueid, attachAll(), elseif, encodeString(), endBoundary(), generateId(), getBoundary(), getMailMIME(), has8bitChars(), headerLine(), isError(), lang(), null, setWordWrap(), et textLine().

Référencé par preSend().

◆ createHeader()

createHeader ( )

Assemble message headers. public

Renvoie
string The assembled headers

Références $MessageID, addrAppend(), addrFormat(), elseif, encodeHeader(), getMailMIME(), headerLine(), secureHeader(), et serverHostname().

Référencé par preSend().

◆ DKIM_Add()

DKIM_Add (   $headers_line,
  $subject,
  $body 
)

Create the DKIM header and body in a new message header. public

Paramètres
string$headers_lineHeader lines
string$subjectSubject
string$bodyBody
Renvoie
string

Références $current, $date, $subject, $to, DKIM_BodyC(), DKIM_HeaderC(), DKIM_QP(), DKIM_Sign(), et elseif.

Référencé par preSend().

◆ DKIM_BodyC()

DKIM_BodyC (   $body)

Generate a DKIM canonicalization body. public

Paramètres
string$bodyMessage Body
Renvoie
string

Référencé par DKIM_Add().

◆ DKIM_HeaderC()

DKIM_HeaderC (   $signHeader)

Generate a DKIM canonicalization header. public

Paramètres
string$signHeaderHeader
Renvoie
string

Références $key, et $value.

Référencé par DKIM_Add().

◆ DKIM_QP()

DKIM_QP (   $txt)

Quoted-Printable-encode a DKIM header. public

Paramètres
string$txt
Renvoie
string

Références $i.

Référencé par DKIM_Add().

◆ DKIM_Sign()

DKIM_Sign (   $signHeader)

Generate a DKIM signature. public

Paramètres
string$signHeader
Exceptions
phpmailerException
Renvoie
string The DKIM signature value

Références $hash, et lang().

Référencé par DKIM_Add().

◆ doCallback()

doCallback (   $isSent,
  $to,
  $cc,
  $bcc,
  $subject,
  $body,
  $from 
)
protected

Perform a callback.

Paramètres
boolean$isSent
array$to
array$cc
array$bcc
string$subject
string$body
string$from

Références $bcc, $cc, $params, $subject, et $to.

Référencé par mailSend(), sendmailSend(), et smtpSend().

◆ edebug()

edebug (   $str)
protected

Output debugging info via user-defined method. Only generates output if SMTP debug output is enabled (

Voir également
SMTP::$do_debug).
PHPMailer::$Debugoutput
PHPMailer::$SMTPDebug
Paramètres
string$str

Références ENT_QUOTES.

Référencé par addAnAddress(), addAttachment(), addOrEnqueueAnAddress(), postSend(), preSend(), setFrom(), PHPMailerOAuth\smtpConnect(), et smtpConnect().

◆ encodeFile()

encodeFile (   $path,
  $encoding = 'base64' 
)
protected

Encode a file attachment in requested format. Returns an empty string on failure.

Paramètres
string$pathThe full path to the file
string$encodingThe encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
Exceptions
phpmailerExceptionprotected
Renvoie
string

Références $path, encodeString(), lang(), et setError().

Référencé par attachAll().

◆ encodeHeader()

encodeHeader (   $str,
  $position = 'text' 
)

Encode a header string optimally. Picks shortest of Q, B, quoted-printable or none. public

Paramètres
string$str
string$position
Renvoie
string

PhpMissingBreakStatementInspection

Références $position, base64EncodeWrapMB(), encodeQ(), hasMultiBytes(), et wrapText().

Référencé par addrFormat(), attachAll(), createHeader(), mailPassthru(), et preSend().

◆ encodeQ()

encodeQ (   $str,
  $position = 'text' 
)

Encode a string using Q encoding. string $str the text to encode string $position Where the text is going to be used, see the RFC for what that means public string

PhpMissingBreakStatementInspection

Références $position.

Référencé par encodeHeader().

◆ encodeQP()

encodeQP (   $string,
  $line_max = 76 
)

Encode a string in quoted-printable format. According to RFC2045 section 6.7. public

Paramètres
string$stringThe text to encode
integer$line_maxNumber of chars allowed on a line before wrapping
Renvoie
string Adapted from this comment

Référencé par encodeQPphp(), et encodeString().

◆ encodeQPphp()

encodeQPphp (   $string,
  $line_max = 76,
  $space_conv = false 
)

Backward compatibility wrapper for an old QP encoding function that was removed.

Voir également
PHPMailer::encodeQP() public
Paramètres
string$string
integer$line_max
boolean$space_conv
Renvoie
string
Obsolète:
Use encodeQP instead.
Paramètres
$space_convPhpUnusedParameterInspection

Références encodeQP().

◆ encodeString()

encodeString (   $str,
  $encoding = 'base64' 
)

Encode a string in requested format. Returns an empty string on failure.

Paramètres
string$strThe text to encode
string$encodingThe encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' public
Renvoie
string

Références $LE, encodeQP(), fixEOL(), lang(), et setError().

Référencé par attachAll(), createBody(), et encodeFile().

◆ endBoundary()

endBoundary (   $boundary)
protected

Return the end of a message boundary. protected

Paramètres
string$boundary
Renvoie
string

Références $boundary, et $LE.

Référencé par createBody().

◆ filenameToType()

static filenameToType (   $filename)
static

Map a file name to a MIME type. Defaults to 'application/octet-stream', i.e.. arbitrary binary data.

Paramètres
string$filenameA file name or full path, does not need to exist as a file
Renvoie
string

◆ fixEOL()

fixEOL (   $str)

Ensure consistent line endings in a string. Changes every end of line from CRLF, CR or LF to $this->LE. public

Paramètres
string$strString to fixEOL
Renvoie
string

Référencé par encodeString(), et wrapText().

◆ generateId()

generateId ( )
protected

Create unique ID

Renvoie
string

Référencé par createBody().

◆ getAllRecipientAddresses()

getAllRecipientAddresses ( )

Allows for public read access to 'all_recipients' property.

Note
: Before the send() call, queued addresses (i.e. with IDN) are not yet included. public
Renvoie
array

Références $all_recipients.

◆ getAttachments()

getAttachments ( )

Return the array of attachments.

Renvoie
array

Références $attachment.

◆ getBccAddresses()

getBccAddresses ( )

Allows for public read access to 'bcc' property.

Note
: Before the send() call, queued addresses (i.e. with IDN) are not yet included. public
Renvoie
array

Références $bcc.

◆ getBoundary()

getBoundary (   $boundary,
  $charSet,
  $contentType,
  $encoding 
)
protected

Return the start of a message boundary. protected

Paramètres
string$boundary
string$charSet
string$contentType
string$encoding
Renvoie
string

Références $boundary, $CharSet, $ContentType, $Encoding, $LE, headerLine(), et textLine().

Référencé par createBody().

◆ getCcAddresses()

getCcAddresses ( )

Allows for public read access to 'cc' property.

Note
: Before the send() call, queued addresses (i.e. with IDN) are not yet included. public
Renvoie
array

Références $cc.

◆ getCustomHeaders()

getCustomHeaders ( )

Returns all custom headers.

Renvoie
array

Références $CustomHeader.

◆ getLastMessageID()

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.

Renvoie
string

Références $lastMessageID.

◆ getMailMIME()

getMailMIME ( )

Get the message MIME type headers. public

Renvoie
string

Références $LE, headerLine(), et textLine().

Référencé par createBody(), et createHeader().

◆ getReplyToAddresses()

getReplyToAddresses ( )

Allows for public read access to 'ReplyTo' property.

Note
: Before the send() call, queued addresses (i.e. with IDN) are not yet included. public
Renvoie
array

Références $ReplyTo.

◆ getSentMIMEMessage()

getSentMIMEMessage ( )

Returns the whole MIME message. Includes complete headers and body. Only valid post preSend().

Voir également
PHPMailer::preSend() public
Renvoie
string

Références $MIMEBody.

◆ getSMTPInstance()

getSMTPInstance ( )

Get an instance to use for SMTP operations. Override this function to load your own SMTP implementation

Renvoie
SMTP

Références $smtp.

Référencé par PHPMailerOAuth\smtpConnect(), et smtpConnect().

◆ getToAddresses()

getToAddresses ( )

Allows for public read access to 'to' property.

Note
: Before the send() call, queued addresses (i.e. with IDN) are not yet included. public
Renvoie
array

Références $to.

◆ getTranslations()

getTranslations ( )

Get the array of strings for the current language.

Renvoie
array

Références $language.

◆ has8bitChars()

has8bitChars (   $text)

Does a string contain any 8-bit chars (in any charset)?

Paramètres
string$text
Renvoie
boolean

Références $text.

Référencé par addOrEnqueueAnAddress(), createBody(), punyencodeAddress(), et setFrom().

◆ hasLineLongerThanMax()

static hasLineLongerThanMax (   $str)
static

Detect if a string contains a line longer than the maximum line length allowed.

Paramètres
string$str
Renvoie
boolean

◆ hasMultiBytes()

hasMultiBytes (   $str)

Check if a string contains multi-byte characters. public

Paramètres
string$strmulti-byte text to wrap encode
Renvoie
boolean

Référencé par encodeHeader().

◆ headerLine()

headerLine (   $name,
  $value 
)

Format a header line. public

Paramètres
string$name
string$value
Renvoie
string

Références $LE, $name, et $value.

Référencé par createBody(), createHeader(), getBoundary(), getMailMIME(), et preSend().

◆ html2text()

html2text (   $html,
  $advanced = false 
)

Convert an HTML string into plain text. This is used by msgHTML(). Note - older versions of this function used a bundled advanced converter which was been removed for license reasons in #232. Example usage: // Use default conversion $plain = $mail->html2text($html); // Use your own custom converter $plain = $mail->html2text($html, function($html) { $converter = new MyHtml2text($html); return $converter->get_text(); });

Paramètres
string$htmlThe HTML text to convert
boolean | callable$advancedAny boolean value to use the internal converter, or provide your own callable for custom conversion.
Renvoie
string

Références $html, et ENT_QUOTES.

Référencé par msgHTML().

◆ idnSupported()

idnSupported ( )

Tells whether IDNs (Internationalized Domain Names) are supported or not. This requires the "intl" and "mbstring" PHP extensions.

Renvoie
bool "true" if required functions for IDN support are present

Référencé par addOrEnqueueAnAddress(), punyencodeAddress(), et setFrom().

◆ inlineImageExists()

inlineImageExists ( )

Check if an inline attachment is present. public

Renvoie
boolean

Références $attachment.

Référencé par setMessageType().

◆ isError()

isError ( )

Check if an error occurred. public

Renvoie
boolean True if an error did occur.

Référencé par attachAll(), et createBody().

◆ isHTML()

isHTML (   $isHtml = true)

Sets message type to HTML or plain.

Paramètres
boolean$isHtmlTrue for HTML mode.
Renvoie
void

Référencé par msgHTML().

◆ isMail()

isMail ( )

Send messages using PHP's mail() function.

Renvoie
void

Référencé par Mail\useSendmail(), et Mail\useSmtp().

◆ isQmail()

isQmail ( )

Send messages using qmail.

Renvoie
void

◆ isSendmail()

isSendmail ( )

Send messages using $Sendmail.

Renvoie
void

◆ isShellSafe()

static isShellSafe (   $string)
staticprotected

Fix CVE-2016-10033 and CVE-2016-10045 by disallowing potentially unsafe shell characters.

Note that escapeshellarg and escapeshellcmd are inadequate for our purposes, especially on Windows.

Paramètres
string$stringThe string to be validated
Voir également
https://github.com/PHPMailer/PHPMailer/issues/924 CVE-2016-10045 bug report protected
Renvoie
boolean

Références $i.

◆ isSMTP()

isSMTP ( )

Send messages using SMTP.

Renvoie
void

Référencé par Mail\useSmtp().

◆ lang()

lang (   $key)
protected

Get an error message in the current language. protected

Paramètres
string$key
Renvoie
string

Références $key, et setLanguage().

Référencé par addAnAddress(), addAttachment(), addEmbeddedImage(), addOrEnqueueAnAddress(), createBody(), DKIM_Sign(), encodeFile(), encodeString(), mailSend(), preSend(), sendmailSend(), set(), setError(), setFrom(), PHPMailerOAuth\smtpConnect(), smtpConnect(), et smtpSend().

◆ mailPassthru()

mailPassthru (   $to,
  $subject,
  $body,
  $header,
  $params 
)
private

Call mail() in a safe_mode-aware fashion. Also, unless sendmail_path points to sendmail (or something that claims to be sendmail), don't pass params (not a perfect fix, but it will do)

Paramètres
string$toTo
string$subjectSubject
string$bodyMessage Body
string$headerAdditional Header(s)
string$paramsParams private
Renvoie
boolean

Références $params, $subject, $to, encodeHeader(), et secureHeader().

Référencé par mailSend().

◆ mailSend()

mailSend (   $header,
  $body 
)
protected

Send mail using the PHP mail() function.

Paramètres
string$headerThe message headers
string$bodyThe message body phpmailerException protected boolean

Références $params, $to, addrFormat(), doCallback(), lang(), mailPassthru(), null, et validateAddress().

Référencé par postSend().

◆ mb_pathinfo()

static mb_pathinfo (   $path,
  $options = null 
)
static

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 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 string|array

Références $options, et $path.

◆ msgHTML()

msgHTML (   $message,
  $basedir = '',
  $advanced = false 
)

Create a message body from an HTML string. Automatically inlines images and creates a plain-text version by converting the HTML, overwriting any existing values in Body and AltBody. Do not source $message content from user input! $basedir is prepended when handling relative URLs, e.g.

and must not be empty will look for an image file in $basedir/images/a.png and convert it to inline. If you don't provide a $basedir, relative paths will be left untouched (and thus probably break in email) If you don't want to apply these transformations to your HTML, just set Body and AltBody directly. public

Paramètres
string$messageHTML message string
string$basedirAbsolute path to a base directory to prepend to relative paths to images
boolean | callable$advancedWhether to use the internal HTML to text converter or your own custom converter
Voir également
PHPMailer::html2text()
Renvoie
string $message The transformed message Body

Références $Body, $data, $images, $message, $url, addEmbeddedImage(), addStringEmbeddedImage(), alternativeExists(), html2text(), isHTML(), et normalizeBreaks().

◆ normalizeBreaks()

static normalizeBreaks (   $text,
  $breaktype = "\r\n" 
)
static

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.

Paramètres
string$text
string$breaktypeWhat kind of line break to use, defaults to CRLF
Renvoie
string public

Références $text.

Référencé par msgHTML().

◆ parseAddresses()

parseAddresses (   $addrstr,
  $useimap = true 
)

Parse and validate a string containing one or more RFC822-style comma-separated email addresses of the form "display name <address>" into an array of name/address pairs. Uses the imap_rfc822_parse_adrlist function if the IMAP extension is available. Note that quotes in the name part are removed.

Paramètres
string$addrstrThe address list string
bool$useimapWhether to use the IMAP extension to parse the list
Renvoie
array A more careful implementation

Références $list, $name, et validateAddress().

◆ postSend()

postSend ( )

Actually send a message. Send the email via the selected mechanism

Exceptions
phpmailerException
Renvoie
boolean

Références edebug(), mailSend(), sendmailSend(), setError(), et smtpSend().

Référencé par send().

◆ preSend()

◆ punyencodeAddress()

punyencodeAddress (   $address)

Converts IDN in given email address to its ASCII form, also known as punycode, if possible. Important: Address must be passed in same encoding as currently set in PHPMailer::$CharSet. This function silently returns unmodified address if:

  • No conversion is necessary (i.e. domain name is not an IDN, or is already in ASCII form)
  • Conversion to punycode is impossible (e.g. required PHP functions are not available) or fails for any reason (e.g. domain has characters not allowed in an IDN)
    Voir également
    PHPMailer::$CharSet
    Paramètres
    string$addressThe email address to convert
    Renvoie
    string The encoded address in ASCII form

Références has8bitChars(), et idnSupported().

Référencé par preSend().

◆ rfcDate()

static rfcDate ( )
static

Return an RFC 822 formatted date. public

Renvoie
string

◆ secureHeader()

secureHeader (   $str)

Strip newlines to prevent header injection. public

Paramètres
string$str
Renvoie
string

Référencé par addrFormat(), attachAll(), createHeader(), mailPassthru(), et preSend().

◆ send()

send ( )

Create a message and send it. Uses the sending method specified by $Mailer.

Exceptions
phpmailerException
Renvoie
boolean false on error - See the ErrorInfo property for details of the error.

Références postSend(), preSend(), et setError().

◆ sendmailSend()

sendmailSend (   $header,
  $body 
)
protected

Send mail using the $Sendmail program.

Paramètres
string$headerThe message headers
string$bodyThe message body
Voir également
PHPMailer::$Sendmail
Exceptions
phpmailerExceptionprotected
Renvoie
boolean

Références doCallback(), et lang().

Référencé par postSend().

◆ serverHostname()

serverHostname ( )
protected

Get the server hostname. Returns 'localhost.localdomain' if unknown. protected

Renvoie
string

Références $Hostname, et elseif.

Référencé par createHeader(), PHPMailerOAuth\smtpConnect(), et smtpConnect().

◆ set()

set (   $name,
  $value = '' 
)

Set or reset instance properties. You should avoid this function - it's more verbose, less efficient, more error-prone and harder to debug than setting properties directly. Usage Example: ‘$mail->set('SMTPSecure’, 'tls');` is the same as: ‘$mail->SMTPSecure = 'tls’;` public

Paramètres
string$nameThe property name to set
mixed$valueThe value to set the property to
Renvoie
boolean Should this not be using the __set() magic function?

Références $name, $value, lang(), et setError().

◆ setError()

setError (   $msg)
protected

Add an error message to the error container. protected

Paramètres
string$msg
Renvoie
void

Références lang().

Référencé par addAnAddress(), addAttachment(), addEmbeddedImage(), addOrEnqueueAnAddress(), encodeFile(), encodeString(), postSend(), preSend(), InstallerModelManage\publish(), UsersModelMail\send(), send(), set(), setFrom(), et smtpSend().

◆ setFrom()

setFrom (   $address,
  $name = '',
  $auto = true 
)

Set the From and FromName properties.

Paramètres
string$address
string$name
boolean$autoWhether to also set the Sender address, defaults to true
Exceptions
phpmailerException
Renvoie
boolean

Références $name, edebug(), has8bitChars(), idnSupported(), lang(), setError(), et validateAddress().

◆ setLanguage()

setLanguage (   $langcode = 'en',
  $lang_path = '' 
)

Set the language for error messages. Returns false if it cannot load the language file. The default language is English.

Paramètres
string$langcodeISO 639-1 2-character language code (e.g. French is "fr")
string$lang_pathPath to the language file directory, with trailing separator (slash)
Renvoie
boolean public

Références $PHPMAILER_LANG, et DIRECTORY_SEPARATOR.

Référencé par Mail\__construct(), et lang().

◆ setMessageType()

setMessageType ( )
protected

Set the message type. PHPMailer only supports some preset message types, not arbitrary MIME structures. protected

Renvoie
void

Références $type, alternativeExists(), attachmentExists(), et inlineImageExists().

Référencé par preSend().

◆ setWordWrap()

setWordWrap ( )

Apply word wrapping to the message body. Wraps the message body to the number of chars set in the WordWrap property. You should only do this to plain-text bodies as wrapping HTML tags may break them. This is called automatically by createBody(), so you don't need to call it yourself. public

Renvoie
void

Références wrapText().

Référencé par createBody().

◆ sign()

sign (   $cert_filename,
  $key_filename,
  $key_pass,
  $extracerts_filename = '' 
)

Set the public and private key files and password for S/MIME signing. public

Paramètres
string$cert_filename
string$key_filename
string$key_passPassword for private key
string$extracerts_filenameOptional path to chain certificate

◆ smtpClose()

smtpClose ( )

Close the active SMTP session if one exists.

Renvoie
void

Référencé par __destruct().

◆ smtpConnect()

smtpConnect (   $options = null)

Initiate a connection to an SMTP server. Returns false if the operation failed.

Paramètres
array$optionsAn array of options compatible with stream_context_create() SMTP public
Exceptions
phpmailerException
Renvoie
boolean

Références $Helo, $options, $Port, $prefix, $SMTPOptions, $SMTPSecure, edebug(), elseif, getSMTPInstance(), lang(), null, et serverHostname().

Référencé par smtpSend().

◆ smtpSend()

smtpSend (   $header,
  $body 
)
protected

Send mail via SMTP. Returns false if there is a bad MAIL FROM, RCPT, or DATA input. Uses the PHPMailerSMTP class by default.

Voir également
PHPMailer::getSMTPInstance() to use a different class.
Paramètres
string$headerThe message headers
string$bodyThe message body
Exceptions
phpmailerExceptionSMTP protected
Renvoie
boolean

Références $From, $Sender, $to, doCallback(), lang(), setError(), smtpConnect(), et validateAddress().

Référencé par postSend().

◆ textLine()

textLine (   $value)

Return a formatted mail line. public

Paramètres
string$value
Renvoie
string

Références $LE, et $value.

Référencé par createBody(), getBoundary(), et getMailMIME().

◆ utf8CharBoundary()

utf8CharBoundary (   $encodedText,
  $maxLength 
)

Find the last character boundary prior to $maxLength in a utf-8 quoted-printable encoded string. Original written by Colin Brown. public

Paramètres
string$encodedTextutf-8 QP text
integer$maxLengthFind the last character boundary prior to this length
Renvoie
integer

Références elseif.

Référencé par wrapText().

◆ validateAddress()

static validateAddress (   $address,
  $patternselect = null 
)
static

Check that a string looks like an email address.

Paramètres
string$addressThe email address to check
string | callable$patternselectA selector for the validation pattern to use :
  • auto Pick best pattern 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;
  • 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. Alternatively you may pass in a callable to inject your own validator, for example: PHPMailer::validateAddress('user@.nosp@m.exam.nosp@m.ple.c.nosp@m.om', function($address) { return (strpos($address, '@') !== false); }); You can also set the PHPMailer::$validator static to a callable, allowing built-in methods to use your validator.
Renvoie
boolean

public

Uses the same RFC5322 regex on which FILTER_VALIDATE_EMAIL is based, but allows dotless domains. 2009-2010 Michael Rushton Feel free to use and redistribute this code. But please keep this copyright notice. This is the pattern used in the HTML5 spec for validation of 'email' type form input elements. http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email)

Références elseif.

Référencé par addAnAddress(), mailSend(), parseAddresses(), preSend(), setFrom(), et smtpSend().

◆ wrapText()

wrapText (   $message,
  $length,
  $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.

Paramètres
string$messageThe message to wrap
integer$lengthThe line length to wrap to
boolean$qp_modeWhether to run in Quoted-Printable mode public
Renvoie
string

Références $LE, $message, elseif, fixEOL(), et utf8CharBoundary().

Référencé par encodeHeader(), et setWordWrap().

Documentation des champs

◆ $action_function

$action_function = ''

◆ $all_recipients

$all_recipients = array()
protected

Référencé par getAllRecipientAddresses().

◆ $AllowEmpty

$AllowEmpty = false

◆ $AltBody

$AltBody = ''

◆ $attachment

$attachment = array()
protected

◆ $AuthType

$AuthType = ''

◆ $bcc

◆ $Body

$Body = ''

Référencé par msgHTML().

◆ $boundary

$boundary = array()
protected

Référencé par attachAll(), endBoundary(), et getBoundary().

◆ $cc

$cc = array()
protected

◆ $CharSet

$CharSet = 'iso-8859-1'

Référencé par createBody(), et getBoundary().

◆ $ConfirmReadingTo

$ConfirmReadingTo = ''

◆ $ContentType

$ContentType = 'text/plain'

Référencé par getBoundary().

◆ $CustomHeader

$CustomHeader = array()
protected

Référencé par getCustomHeaders().

◆ $Debugoutput

$Debugoutput = 'echo'

◆ $DKIM_domain

$DKIM_domain = ''

◆ $DKIM_identity

$DKIM_identity = ''

◆ $DKIM_passphrase

$DKIM_passphrase = ''

◆ $DKIM_private

$DKIM_private = ''

◆ $DKIM_private_string

$DKIM_private_string = ''

◆ $DKIM_selector

$DKIM_selector = ''

◆ $do_verp

$do_verp = false

◆ $Encoding

$Encoding = '8bit'

Référencé par createBody(), et getBoundary().

◆ $error_count

$error_count = 0
protected

◆ $ErrorInfo

$ErrorInfo = ''

◆ $exceptions

$exceptions = false
protected

◆ $From

$From = 'root@localhost'

Référencé par smtpSend().

◆ $FromName

$FromName = 'Root User'

◆ $Helo

$Helo = ''

◆ $Host

$Host = 'localhost'

◆ $Hostname

$Hostname = ''

Référencé par serverHostname().

◆ $Ical

$Ical = ''

◆ $language

$language = array()
protected

Référencé par getTranslations().

◆ $lastMessageID

$lastMessageID = ''
protected

Référencé par getLastMessageID().

◆ $LE

◆ $Mailer

$Mailer = 'mail'

◆ $mailHeader

$mailHeader = ''
protected

◆ $message_type

$message_type = ''
protected

◆ $MessageDate

$MessageDate = ''

◆ $MessageID

$MessageID = ''

Référencé par createHeader().

◆ $MIMEBody

$MIMEBody = ''
protected

Référencé par getSentMIMEMessage().

◆ $MIMEHeader

$MIMEHeader = ''
protected

Référencé par preSend().

◆ $Password

$Password = ''

◆ $PluginDir

$PluginDir = ''

◆ $Port

$Port = 25

◆ $Priority

$Priority = null

◆ $Realm

$Realm = ''

◆ $RecipientsQueue

$RecipientsQueue = array()
protected

Référencé par clearQueuedAddresses().

◆ $ReplyTo

$ReplyTo = array()
protected

Référencé par getReplyToAddresses().

◆ $ReplyToQueue

$ReplyToQueue = array()
protected

◆ $ReturnPath

$ReturnPath = ''

◆ $Sender

$Sender = ''

Référencé par smtpSend().

◆ $Sendmail

$Sendmail = '/usr/sbin/sendmail'

◆ $sign_cert_file

$sign_cert_file = ''
protected

◆ $sign_extracerts_file

$sign_extracerts_file = ''
protected

◆ $sign_key_file

$sign_key_file = ''
protected

◆ $sign_key_pass

$sign_key_pass = ''
protected

◆ $SingleTo

$SingleTo = false

◆ $SingleToArray

$SingleToArray = array()

◆ $smtp

$smtp = null
protected

Référencé par getSMTPInstance().

◆ $SMTPAuth

$SMTPAuth = false

◆ $SMTPAutoTLS

$SMTPAutoTLS = true

◆ $SMTPDebug

$SMTPDebug = 0

◆ $SMTPKeepAlive

$SMTPKeepAlive = false

◆ $SMTPOptions

$SMTPOptions = array()

Référencé par smtpConnect().

◆ $SMTPSecure

$SMTPSecure = ''

◆ $Subject

$Subject = ''

◆ $Timeout

$Timeout = 300

◆ $to

◆ $uniqueid

$uniqueid = ''
protected

Référencé par createBody().

◆ $Username

$Username = ''

◆ $UseSendmailOptions

$UseSendmailOptions = true

◆ $validator

$validator = 'auto'
static

◆ $Version

$Version = '5.2.26'

◆ $WordWrap

$WordWrap = 0

◆ $Workstation

$Workstation = ''

◆ $XMailer

$XMailer = ''

◆ CRLF

const CRLF = "\r\n"

SMTP RFC standard line ending.

◆ MAX_LINE_LENGTH

const MAX_LINE_LENGTH = 998

◆ STOP_CONTINUE

const STOP_CONTINUE = 1

Error severity: message, likely ok to continue processing.

◆ STOP_CRITICAL

const STOP_CRITICAL = 2

Error severity: message, plus full stop, critical error reached.

◆ STOP_MESSAGE

const STOP_MESSAGE = 0

Error severity: message only, continue processing.


La documentation de cette classe a été générée à partir du fichier suivant :