PHP 클래스 PHPMailer

파일 보기 프로젝트 열기: phpmailer/phpmailer 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$AllowEmpty boolean Whether to allow sending messages with an empty body.
$AltBody string This body can be read by mail clients that do not have HTML email capability such as mutt & Eudora. Clients that can read HTML will view the normal Body.
$AuthType string Options are CRAM-MD5, LOGIN, PLAIN, NTLM, XOAUTH2, attempted in that order if not specified
$Body string If HTML then call isHTML(true).
$CharSet string The character set of the message.
$ConfirmReadingTo string The email address that a reading confirmation should be sent to, also known as read receipt.
$ContentType string The MIME Content-type of the message.
$DKIM_domain string DKIM signing domain name.
$DKIM_identity string Usually the email address used as the source of the email.
$DKIM_passphrase string Used if your key is encrypted.
$DKIM_private string DKIM private key file path.
$DKIM_private_string string If set, takes precedence over $DKIM_private.
$DKIM_selector string DKIM selector.
$Debugoutput string | callable Options: * echo Output plain-text as-is, appropriate for CLI * html Output escaped, line breaks converted to
, appropriate for browser output * error_log Output to error log as configured in php.ini Alternatively, you can provide a callable expecting two params: a message string and the debug level: $mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
$Encoding string Options: "8bit", "7bit", "binary", "base64", and "quoted-printable".
$ErrorInfo string Holds the most recent mailer error message.
$From string The From email address for the message.
$FromName string The From name of the message.
$Helo string Default is $Hostname. If $Hostname is empty, PHPMailer attempts to find one with the same method described above for $Hostname.
$Host string Either a single hostname or multiple semicolon-delimited hostnames. 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"). You can also specify encryption type, for example: (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465"). Hosts will be tried in order.
$Hostname string If empty, PHPMailer attempts to find one with, in order, $_SERVER['SERVER_NAME'], gethostname(), php_uname('n'), or the value 'localhost.localdomain'.
$Ical string Only supported in simple alt or alt_inline message types To generate iCal events, use the bundled extras/EasyPeasyICS.php class or iCalcreator
$LE string The default line ending.
$Mailer string Options: "mail", "sendmail", or "smtp".
$MessageDate string If empty, the current date will be added.
$MessageID string If empty, a unique id will be generated. You can set your own, but it must be in the format "", as defined in RFC5322 section 3.6.4 or it will be ignored.
$Password string SMTP password.
$PluginDir string Useful if the SMTP class is not in the PHP include path.
$Port integer The default SMTP server port.
$Priority integer Options: null (default), 1 = High, 3 = Normal, 5 = low. When null, the header is not set at all.
$Realm string Used for NTLM auth
$ReturnPath string If empty, it will be set to either From or Sender.
$SMTPAuth boolean Uses the Username and Password properties.
$SMTPAutoTLS boolean Be aware that in PHP >= 5.6 this requires that the server's certificates are valid.
$SMTPDebug integer Debug output level. Options: * 0 No output * 1 Commands * 2 Data and commands * 3 As 2 plus connection status * 4 Low-level data output
$SMTPKeepAlive boolean If this is set to true then to close the connection requires an explicit call to smtpClose().
$SMTPOptions array Options array passed to stream_context_create when connecting via SMTP.
$SMTPSecure string Options: '', 'ssl' or 'tls'
$Sender string If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
$Sendmail string The path to the sendmail program.
$SingleTo boolean Only supported in mail and sendmail transports, not in SMTP.
$SingleToArray array Storage for addresses when SingleTo is enabled.
$Subject string The Subject of the message.
$Timeout integer Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
$UseSendmailOptions boolean One which supports sendmail's "-oi -f" options.
$Username string SMTP username.
$Version string The PHPMailer Version number.
$WordWrap integer Set to 0 to not wrap. A useful value here is 78, for RFC2822 section 2.1.1 compliance.
$Workstation string Used for NTLM auth
$XMailer string Options: An empty string for PHPMailer default, whitespace for none, or a string to use
$action_function string The function that handles the result of the send email action. It is called out by send() for each email sent. Value can be any php callable: http://www.php.net/is_callable Parameters: boolean $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 string $from email address of sender
$do_verp boolean Only applicable when sending via SMTP.
$validator string | callable May be a callable to inject your own validator, but there are several built-in validators.

보호된 프로퍼티들

프로퍼티 타입 설명
$CustomHeader array The array of custom headers.
$MIMEBody string The complete compiled MIME message body.
$MIMEHeader string The complete compiled MIME message headers.
$RecipientsQueue array In send(), valid and non duplicate entries are moved to $all_recipients and one of $to, $cc, or $bcc. This array is used only for addresses with IDN.
$ReplyTo array The array of reply-to names and addresses.
$ReplyToQueue array In send(), valid and non duplicate entries are moved to $ReplyTo. This array is used only for addresses with IDN.
$all_recipients array Includes all of $to, $cc, $bcc
$attachment array The array of attachments.
$bcc array The array of 'bcc' names and addresses.
$boundary array The array of MIME boundary strings.
$cc array The array of 'cc' names and addresses.
$error_count integer The number of errors encountered.
$exceptions boolean Whether to throw exceptions for errors.
$language array The array of available languages.
$lastMessageID string The most recent Message-ID (including angular brackets).
$mailHeader string Extra headers that createHeader() doesn't fold in.
$message_type string The message's MIME type.
$sign_cert_file string The S/MIME certificate file path.
$sign_extracerts_file string The optional S/MIME extra certificates ("CA Chain") file path.
$sign_key_file string The S/MIME key file path.
$sign_key_pass string Used only if the key is encrypted.
$smtp SMTP An instance of the SMTP sender class.
$to array The array of 'to' names and addresses.
$uniqueid string Unique ID used for message ID and boundaries.

공개 메소드들

메소드 설명
DKIM_Add ( string $headers_line, string $subject, string $body ) : string Create the DKIM header and body in a new message header.
DKIM_BodyC ( string $body ) : string Generate a DKIM canonicalization body.
DKIM_HeaderC ( string $signHeader ) : string Generate a DKIM canonicalization header.
DKIM_QP ( string $txt ) : string Quoted-Printable-encode a DKIM header.
DKIM_Sign ( string $signHeader ) : string Generate a DKIM signature.
__construct ( boolean $exceptions = null ) Constructor.
__destruct ( ) Destructor.
_mime_types ( string $ext = '' ) : string Get the MIME type for a file extension.
addAddress ( string $address, string $name = '' ) : boolean Add a "To" address.
addAttachment ( string $path, string $name = '', string $encoding = 'base64', string $type = '', string $disposition = 'attachment' ) : boolean Add an attachment from a path on the filesystem.
addBCC ( string $address, string $name = '' ) : boolean Add a "BCC" address.
addCC ( string $address, string $name = '' ) : boolean Add a "CC" address.
addCustomHeader ( string $name, string $value = null ) : void Add a custom header.
addEmbeddedImage ( string $path, string $cid, string $name = '', string $encoding = 'base64', string $type = '', string $disposition = 'inline' ) : boolean Add an embedded (inline) attachment from a file.
addReplyTo ( string $address, string $name = '' ) : boolean Add a "Reply-To" address.
addStringAttachment ( string $string, string $filename, string $encoding = 'base64', string $type = '', string $disposition = 'attachment' ) : void Add a string or binary attachment (non-filesystem).
addStringEmbeddedImage ( string $string, string $cid, string $name = '', string $encoding = 'base64', string $type = '', string $disposition = 'inline' ) : boolean Add an embedded stringified attachment.
addrAppend ( string $type, array $addr ) : string Create recipient headers.
addrFormat ( array $addr ) : string Format an address for use in a message header.
alternativeExists ( ) : boolean Check if this message has an alternative body set.
attachmentExists ( ) : boolean Check if an attachment (non-inline) is present.
base64EncodeWrapMB ( string $str, string $linebreak = null ) : string Encode and wrap long multibyte strings for mail headers without breaking lines within a character.
clearAddresses ( ) : void Clear all To recipients.
clearAllRecipients ( ) : void Clear all recipient types.
clearAttachments ( ) : void Clear all filesystem, string, and binary attachments.
clearBCCs ( ) : void Clear all BCC recipients.
clearCCs ( ) : void Clear all CC recipients.
clearCustomHeaders ( ) : void Clear all custom headers.
clearQueuedAddresses ( string $kind ) : void Clear queued addresses of given kind.
clearReplyTos ( ) : void Clear all ReplyTo recipients.
createBody ( ) : string Assemble the message body.
createHeader ( ) : string Assemble message headers.
encodeHeader ( string $str, string $position = 'text' ) : string Encode a header string optimally.
encodeQ ( string $str, string $position = 'text' ) : string Encode a string using Q encoding.
encodeQP ( string $string, integer $line_max = 76 ) : string Encode a string in quoted-printable format.
encodeQPphp ( string $string, integer $line_max = 76, boolean $space_conv = false ) : string Backward compatibility wrapper for an old QP encoding function that was removed.
encodeString ( string $str, string $encoding = 'base64' ) : string Encode a string in requested format.
filenameToType ( string $filename ) : string Map a file name to a MIME type.
fixEOL ( string $str ) : string Ensure consistent line endings in a string.
getAllRecipientAddresses ( ) : array Allows for public read access to 'all_recipients' property.
getAttachments ( ) : array Return the array of attachments.
getBccAddresses ( ) : array Allows for public read access to 'bcc' property.
getCcAddresses ( ) : array Allows for public read access to 'cc' property.
getCustomHeaders ( ) : array Returns all custom headers.
getLastMessageID ( ) : string Return the Message-ID header of the last email.
getMailMIME ( ) : string Get the message MIME type headers.
getReplyToAddresses ( ) : array Allows for public read access to 'ReplyTo' property.
getSMTPInstance ( ) : SMTP Get an instance to use for SMTP operations.
getSentMIMEMessage ( ) : string Returns the whole MIME message.
getToAddresses ( ) : array Allows for public read access to 'to' property.
getTranslations ( ) : array Get the array of strings for the current language.
has8bitChars ( string $text ) : boolean Does a string contain any 8-bit chars (in any charset)?
hasLineLongerThanMax ( string $str ) : boolean Detect if a string contains a line longer than the maximum line length allowed.
hasMultiBytes ( string $str ) : boolean Check if a string contains multi-byte characters.
headerLine ( string $name, string $value ) : string Format a header line.
html2text ( string $html, boolean | callable $advanced = false ) : string Convert an HTML string into plain text.
idnSupported ( ) : boolean Tells whether IDNs (Internationalized Domain Names) are supported or not. This requires the "intl" and "mbstring" PHP extensions.
inlineImageExists ( ) : boolean Check if an inline attachment is present.
isError ( ) : boolean Check if an error occurred.
isHTML ( boolean $isHtml = true ) : void Sets message type to HTML or plain.
isMail ( ) : void Send messages using PHP's mail() function.
isQmail ( ) : void Send messages using qmail.
isSMTP ( ) : void Send messages using SMTP.
isSendmail ( ) : void Send messages using $Sendmail.
mb_pathinfo ( string $path, integer | string $options = null ) : string | array Multi-byte-safe pathinfo replacement.
msgHTML ( string $message, string $basedir = '', boolean | callable $advanced = false ) : string Create a message body from an HTML string.
normalizeBreaks ( string $text, string $breaktype = " " ) : string Normalize line breaks in a string.
parseAddresses ( string $addrstr, boolean $useimap = true ) : array Parse and validate a string containing one or more RFC822-style comma-separated email addresses of the form "display name
" into an array of name/address pairs.
postSend ( ) : boolean Actually send a message.
preSend ( ) : boolean Prepare a message for sending.
punyencodeAddress ( string $address ) : string Converts IDN in given email address to its ASCII form, also known as punycode, if possible.
rfcDate ( ) : string Return an RFC 822 formatted date.
secureHeader ( string $str ) : string Strip newlines to prevent header injection.
send ( ) : boolean Create a message and send it.
set ( string $name, mixed $value = '' ) : boolean Set or reset instance properties.
setFrom ( string $address, string $name = '', boolean $auto = true ) : boolean Set the From and FromName properties.
setLanguage ( string $langcode = 'en', string $lang_path = '' ) : boolean Set the language for error messages.
setWordWrap ( ) : void Apply word wrapping to the message body.
sign ( string $cert_filename, string $key_filename, string $key_pass, string $extracerts_filename = '' ) Set the public and private key files and password for S/MIME signing.
smtpClose ( ) : void Close the active SMTP session if one exists.
smtpConnect ( array $options = null ) : boolean Initiate a connection to an SMTP server.
textLine ( string $value ) : string Return a formatted mail line.
utf8CharBoundary ( string $encodedText, integer $maxLength ) : integer Find the last character boundary prior to $maxLength in a utf-8 quoted-printable encoded string.
validateAddress ( string $address, string | callable $patternselect = null ) : boolean Check that a string looks like an email address.
wrapText ( string $message, integer $length, boolean $qp_mode = false ) : string Word-wrap message.

보호된 메소드들

메소드 설명
addAnAddress ( string $kind, string $address, string $name = '' ) : boolean Add an address to one of the recipient arrays or to the ReplyTo array.
addOrEnqueueAnAddress ( string $kind, string $address, string $name ) : boolean 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().
attachAll ( string $disposition_type, string $boundary ) : string Attach all file, string, and binary attachments to the message.
doCallback ( boolean $isSent, array $to, array $cc, array $bcc, string $subject, string $body, string $from ) Perform a callback.
edebug ( string $str ) Output debugging info via user-defined method.
encodeFile ( string $path, string $encoding = 'base64' ) : string Encode a file attachment in requested format.
endBoundary ( string $boundary ) : string Return the end of a message boundary.
generateId ( ) : string Create unique ID
getBoundary ( string $boundary, string $charSet, string $contentType, string $encoding ) : string Return the start of a message boundary.
lang ( string $key ) : string Get an error message in the current language.
mailSend ( string $header, string $body ) : boolean Send mail using the PHP mail() function.
sendmailSend ( string $header, string $body ) : boolean Send mail using the $Sendmail program.
serverHostname ( ) : string Get the server hostname.
setError ( string $msg ) : void Add an error message to the error container.
setMessageType ( ) : void Set the message type.
smtpSend ( string $header, string $body ) : boolean Send mail via SMTP.

비공개 메소드들

메소드 설명
mailPassthru ( string $to, string $subject, string $body, string $header, string $params ) : boolean Call mail() in a safe_mode-aware fashion.

메소드 상세

DKIM_Add() 공개 메소드

Create the DKIM header and body in a new message header.
public DKIM_Add ( string $headers_line, string $subject, string $body ) : string
$headers_line string Header lines
$subject string Subject
$body string Body
리턴 string

DKIM_BodyC() 공개 메소드

Generate a DKIM canonicalization body.
public DKIM_BodyC ( string $body ) : string
$body string Message Body
리턴 string

DKIM_HeaderC() 공개 메소드

Generate a DKIM canonicalization header.
public DKIM_HeaderC ( string $signHeader ) : string
$signHeader string Header
리턴 string

DKIM_QP() 공개 메소드

Quoted-Printable-encode a DKIM header.
public DKIM_QP ( string $txt ) : string
$txt string
리턴 string

DKIM_Sign() 공개 메소드

Generate a DKIM signature.
public DKIM_Sign ( string $signHeader ) : string
$signHeader string
리턴 string The DKIM signature value

__construct() 공개 메소드

Constructor.
public __construct ( boolean $exceptions = null )
$exceptions boolean Should we throw external exceptions?

__destruct() 공개 메소드

Destructor.
public __destruct ( )

_mime_types() 공개 정적인 메소드

Get the MIME type for a file extension.
public static _mime_types ( string $ext = '' ) : string
$ext string File extension
리턴 string MIME type of file.

addAddress() 공개 메소드

Add a "To" address.
public addAddress ( string $address, string $name = '' ) : boolean
$address string The email address to send to
$name string
리턴 boolean true on success, false if address already used or invalid in some way

addAnAddress() 보호된 메소드

Addresses that have been added already return false, but do not throw exceptions.
protected addAnAddress ( string $kind, string $address, string $name = '' ) : boolean
$kind string One of 'to', 'cc', 'bcc', or 'ReplyTo'
$address string The email address to send, resp. to reply to
$name string
리턴 boolean true on success, false if address already used or invalid in some way

addAttachment() 공개 메소드

Returns false if the file could not be found or read.
public addAttachment ( string $path, string $name = '', string $encoding = 'base64', string $type = '', string $disposition = 'attachment' ) : 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.
$disposition string Disposition to use
리턴 boolean

addBCC() 공개 메소드

Add a "BCC" address.
public addBCC ( string $address, string $name = '' ) : boolean
$address string The email address to send to
$name string
리턴 boolean true on success, false if address already used or invalid in some way

addCC() 공개 메소드

Add a "CC" address.
public addCC ( string $address, string $name = '' ) : boolean
$address string The email address to send to
$name string
리턴 boolean true on success, false if address already used or invalid in some way

addCustomHeader() 공개 메소드

$name value can be overloaded to contain both header name and value (name:value)
public addCustomHeader ( string $name, string $value = null ) : void
$name string Custom header name
$value string Header value
리턴 void

addEmbeddedImage() 공개 메소드

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.
public addEmbeddedImage ( string $path, string $cid, string $name = '', string $encoding = 'base64', string $type = '', string $disposition = 'inline' ) : boolean
$path string Path to the attachment.
$cid string Content ID of the attachment; Use this to reference the content when using an embedded image in HTML.
$name string Overrides the attachment name.
$encoding string File encoding (see $Encoding).
$type string File MIME type.
$disposition string Disposition to use
리턴 boolean True on successfully adding an attachment

addOrEnqueueAnAddress() 보호된 메소드

Addresses that have been added already return false, but do not throw exceptions.
protected addOrEnqueueAnAddress ( string $kind, string $address, string $name ) : boolean
$kind string One of 'to', 'cc', 'bcc', or 'ReplyTo'
$address string The email address to send, resp. to reply to
$name string
리턴 boolean true on success, false if address already used or invalid in some way

addReplyTo() 공개 메소드

Add a "Reply-To" address.
public addReplyTo ( string $address, string $name = '' ) : boolean
$address string The email address to reply to
$name string
리턴 boolean true on success, false if address already used or invalid in some way

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 = '', string $disposition = 'attachment' ) : void
$string string String attachment data.
$filename string Name of the attachment.
$encoding string File encoding (see $Encoding).
$type string File extension (MIME) type.
$disposition string Disposition to use
리턴 void

addStringEmbeddedImage() 공개 메소드

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'.
public addStringEmbeddedImage ( string $string, string $cid, string $name = '', string $encoding = 'base64', string $type = '', string $disposition = 'inline' ) : boolean
$string string The attachment binary data.
$cid string Content ID of the attachment; Use this to reference the content when using an embedded image in HTML.
$name string
$encoding string File encoding (see $Encoding).
$type string MIME type.
$disposition string Disposition to use
리턴 boolean True on successfully adding an attachment

addrAppend() 공개 메소드

Create recipient headers.
public addrAppend ( string $type, array $addr ) : string
$type string
$addr array An 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('[email protected]', 'Joe User'), array('[email protected]', 'Zoe User'))
리턴 string

addrFormat() 공개 메소드

Format an address for use in a message header.
public addrFormat ( array $addr ) : string
$addr array A 2-element indexed array, element 0 containing an address, element 1 containing a name like array('[email protected]', 'Joe User')
리턴 string

alternativeExists() 공개 메소드

Check if this message has an alternative body set.
public alternativeExists ( ) : boolean
리턴 boolean

attachAll() 보호된 메소드

Returns an empty string on failure.
protected attachAll ( string $disposition_type, string $boundary ) : string
$disposition_type string
$boundary string
리턴 string

attachmentExists() 공개 메소드

Check if an attachment (non-inline) is present.
public attachmentExists ( ) : boolean
리턴 boolean

base64EncodeWrapMB() 공개 메소드

Adapted from a function by paravoid
public base64EncodeWrapMB ( string $str, string $linebreak = null ) : string
$str string multi-byte text to wrap encode
$linebreak string string to use as linefeed/end-of-line
리턴 string

clearAddresses() 공개 메소드

Clear all To recipients.
public clearAddresses ( ) : void
리턴 void

clearAllRecipients() 공개 메소드

Clear all recipient types.
public clearAllRecipients ( ) : void
리턴 void

clearAttachments() 공개 메소드

Clear all filesystem, string, and binary attachments.
public clearAttachments ( ) : void
리턴 void

clearBCCs() 공개 메소드

Clear all BCC recipients.
public clearBCCs ( ) : void
리턴 void

clearCCs() 공개 메소드

Clear all CC recipients.
public clearCCs ( ) : void
리턴 void

clearCustomHeaders() 공개 메소드

Clear all custom headers.
public clearCustomHeaders ( ) : void
리턴 void

clearQueuedAddresses() 공개 메소드

Clear queued addresses of given kind.
public clearQueuedAddresses ( string $kind ) : void
$kind string 'to', 'cc', or 'bcc'
리턴 void

clearReplyTos() 공개 메소드

Clear all ReplyTo recipients.
public clearReplyTos ( ) : void
리턴 void

createBody() 공개 메소드

Returns an empty string on failure.
public createBody ( ) : string
리턴 string The assembled message body

createHeader() 공개 메소드

Assemble message headers.
public createHeader ( ) : string
리턴 string The assembled headers

doCallback() 보호된 메소드

Perform a callback.
protected doCallback ( boolean $isSent, array $to, array $cc, array $bcc, string $subject, string $body, string $from )
$isSent boolean
$to array
$cc array
$bcc array
$subject string
$body string
$from string

edebug() 보호된 메소드

Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug).
또한 보기: PHPMailer::$Debugoutput
또한 보기: PHPMailer::$SMTPDebug
protected edebug ( string $str )
$str string

encodeFile() 보호된 메소드

Returns an empty string on failure.
protected encodeFile ( string $path, string $encoding = 'base64' ) : string
$path string The full path to the file
$encoding string The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
리턴 string

encodeHeader() 공개 메소드

Picks shortest of Q, B, quoted-printable or none.
public encodeHeader ( string $str, string $position = 'text' ) : string
$str string
$position string
리턴 string

encodeQ() 공개 메소드

Encode a string using Q encoding.
public encodeQ ( string $str, string $position = 'text' ) : string
$str string the text to encode
$position string Where the text is going to be used, see the RFC for what that means
리턴 string

encodeQP() 공개 메소드

According to RFC2045 section 6.7.
public encodeQP ( string $string, integer $line_max = 76 ) : string
$string string The text to encode
$line_max integer Number of chars allowed on a line before wrapping
리턴 string

encodeQPphp() 공개 메소드

Backward compatibility wrapper for an old QP encoding function that was removed.
또한 보기: PHPMailer::encodeQP()
사용 중단: Use encodeQP instead.
public encodeQPphp ( string $string, integer $line_max = 76, boolean $space_conv = false ) : string
$string string
$line_max integer
$space_conv boolean
리턴 string

encodeString() 공개 메소드

Returns an empty string on failure.
public encodeString ( string $str, string $encoding = 'base64' ) : string
$str string The text to encode
$encoding string The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
리턴 string

endBoundary() 보호된 메소드

Return the end of a message boundary.
protected endBoundary ( string $boundary ) : string
$boundary string
리턴 string

filenameToType() 공개 정적인 메소드

Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
public static filenameToType ( string $filename ) : string
$filename string A file name or full path, does not need to exist as a file
리턴 string

fixEOL() 공개 메소드

Changes every end of line from CRLF, CR or LF to $this->LE.
public fixEOL ( string $str ) : string
$str string String to fixEOL
리턴 string

generateId() 보호된 메소드

Create unique ID
protected generateId ( ) : string
리턴 string

getAllRecipientAddresses() 공개 메소드

Allows for public read access to 'all_recipients' property.
public getAllRecipientAddresses ( ) : array
리턴 array

getAttachments() 공개 메소드

Return the array of attachments.
public getAttachments ( ) : array
리턴 array

getBccAddresses() 공개 메소드

Allows for public read access to 'bcc' property.
public getBccAddresses ( ) : array
리턴 array

getBoundary() 보호된 메소드

Return the start of a message boundary.
protected getBoundary ( string $boundary, string $charSet, string $contentType, string $encoding ) : string
$boundary string
$charSet string
$contentType string
$encoding string
리턴 string

getCcAddresses() 공개 메소드

Allows for public read access to 'cc' property.
public getCcAddresses ( ) : array
리턴 array

getCustomHeaders() 공개 메소드

Returns all custom headers.
public getCustomHeaders ( ) : array
리턴 array

getLastMessageID() 공개 메소드

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.
public getLastMessageID ( ) : string
리턴 string

getMailMIME() 공개 메소드

Get the message MIME type headers.
public getMailMIME ( ) : string
리턴 string

getReplyToAddresses() 공개 메소드

Allows for public read access to 'ReplyTo' property.
public getReplyToAddresses ( ) : array
리턴 array

getSMTPInstance() 공개 메소드

Override this function to load your own SMTP implementation
public getSMTPInstance ( ) : SMTP
리턴 SMTP

getSentMIMEMessage() 공개 메소드

Includes complete headers and body. Only valid post preSend().
또한 보기: PHPMailer::preSend()
public getSentMIMEMessage ( ) : string
리턴 string

getToAddresses() 공개 메소드

Allows for public read access to 'to' property.
public getToAddresses ( ) : array
리턴 array

getTranslations() 공개 메소드

Get the array of strings for the current language.
public getTranslations ( ) : array
리턴 array

has8bitChars() 공개 메소드

Does a string contain any 8-bit chars (in any charset)?
public has8bitChars ( string $text ) : boolean
$text string
리턴 boolean

hasLineLongerThanMax() 공개 정적인 메소드

Detect if a string contains a line longer than the maximum line length allowed.
public static hasLineLongerThanMax ( string $str ) : boolean
$str string
리턴 boolean

hasMultiBytes() 공개 메소드

Check if a string contains multi-byte characters.
public hasMultiBytes ( string $str ) : boolean
$str string multi-byte text to wrap encode
리턴 boolean

headerLine() 공개 메소드

Format a header line.
public headerLine ( string $name, string $value ) : string
$name string
$value string
리턴 string

html2text() 공개 메소드

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(); });
public html2text ( string $html, boolean | callable $advanced = false ) : string
$html string The HTML text to convert
$advanced boolean | callable Any boolean value to use the internal converter, or provide your own callable for custom conversion.
리턴 string

idnSupported() 공개 메소드

Tells whether IDNs (Internationalized Domain Names) are supported or not. This requires the "intl" and "mbstring" PHP extensions.
public idnSupported ( ) : boolean
리턴 boolean "true" if required functions for IDN support are present

inlineImageExists() 공개 메소드

Check if an inline attachment is present.
public inlineImageExists ( ) : boolean
리턴 boolean

isError() 공개 메소드

Check if an error occurred.
public isError ( ) : boolean
리턴 boolean True if an error did occur.

isHTML() 공개 메소드

Sets message type to HTML or plain.
public isHTML ( boolean $isHtml = true ) : void
$isHtml boolean True for HTML mode.
리턴 void

isMail() 공개 메소드

Send messages using PHP's mail() function.
public isMail ( ) : void
리턴 void

isQmail() 공개 메소드

Send messages using qmail.
public isQmail ( ) : void
리턴 void

isSMTP() 공개 메소드

Send messages using SMTP.
public isSMTP ( ) : void
리턴 void

isSendmail() 공개 메소드

Send messages using $Sendmail.
public isSendmail ( ) : void
리턴 void

lang() 보호된 메소드

Get an error message in the current language.
protected lang ( string $key ) : string
$key string
리턴 string

mailSend() 보호된 메소드

Send mail using the PHP mail() function.
protected mailSend ( string $header, string $body ) : boolean
$header string The message headers
$body string The message body
리턴 boolean

mb_pathinfo() 공개 정적인 메소드

Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe. Works similarly to the one in PHP >= 5.2.0
public static mb_pathinfo ( string $path, integer | string $options = null ) : string | array
$path string A filename or path, does not need to exist as a file
$options integer | string Either a PATHINFO_* constant, or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2
리턴 string | array

msgHTML() 공개 메소드

Automatically inlines images and creates a plain-text version by converting the HTML, overwriting any existing values in Body and AltBody. $basedir is used when handling relative image paths, e.g. will look for an image file in $basedir/images/a.png and convert it to inline. If you don't want to apply these transformations to your HTML, just set Body and AltBody yourself.
public msgHTML ( string $message, string $basedir = '', boolean | callable $advanced = false ) : string
$message string HTML message string
$basedir string base directory for relative paths to images
$advanced boolean | callable Whether to use the internal HTML to text converter or your own custom converter @see PHPMailer::html2text()
리턴 string $message The transformed message Body

normalizeBreaks() 공개 정적인 메소드

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.
public static normalizeBreaks ( string $text, string $breaktype = " " ) : string
$text string
$breaktype string What kind of line break to use, defaults to CRLF
리턴 string

parseAddresses() 공개 메소드

Uses the imap_rfc822_parse_adrlist function if the IMAP extension is available. Note that quotes in the name part are removed.
public parseAddresses ( string $addrstr, boolean $useimap = true ) : array
$addrstr string The address list string
$useimap boolean Whether to use the IMAP extension to parse the list
리턴 array

postSend() 공개 메소드

Send the email via the selected mechanism
public postSend ( ) : boolean
리턴 boolean

preSend() 공개 메소드

Prepare a message for sending.
public preSend ( ) : boolean
리턴 boolean

punyencodeAddress() 공개 메소드

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)
또한 보기: PHPMailer::$CharSet
public punyencodeAddress ( string $address ) : string
$address string The email address to convert
리턴 string The encoded address in ASCII form

rfcDate() 공개 정적인 메소드

Return an RFC 822 formatted date.
public static rfcDate ( ) : string
리턴 string

secureHeader() 공개 메소드

Strip newlines to prevent header injection.
public secureHeader ( string $str ) : string
$str string
리턴 string

send() 공개 메소드

Uses the sending method specified by $Mailer.
public send ( ) : boolean
리턴 boolean false on error - See the ErrorInfo property for details of the error.

sendmailSend() 보호된 메소드

Send mail using the $Sendmail program.
또한 보기: PHPMailer::$Sendmail
protected sendmailSend ( string $header, string $body ) : boolean
$header string The message headers
$body string The message body
리턴 boolean

serverHostname() 보호된 메소드

Returns 'localhost.localdomain' if unknown.
protected serverHostname ( ) : string
리턴 string

set() 공개 메소드

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 set ( string $name, mixed $value = '' ) : boolean
$name string The property name to set
$value mixed The value to set the property to
리턴 boolean

setError() 보호된 메소드

Add an error message to the error container.
protected setError ( string $msg ) : void
$msg string
리턴 void

setFrom() 공개 메소드

Set the From and FromName properties.
public setFrom ( string $address, string $name = '', boolean $auto = true ) : boolean
$address string
$name string
$auto boolean Whether to also set the Sender address, defaults to true
리턴 boolean

setLanguage() 공개 메소드

Returns false if it cannot load the language file. The default language is English.
public setLanguage ( string $langcode = 'en', string $lang_path = '' ) : boolean
$langcode string ISO 639-1 2-character language code (e.g. French is "fr")
$lang_path string Path to the language file directory, with trailing separator (slash)
리턴 boolean

setMessageType() 보호된 메소드

PHPMailer only supports some preset message types, not arbitrary MIME structures.
protected setMessageType ( ) : void
리턴 void

setWordWrap() 공개 메소드

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 setWordWrap ( ) : void
리턴 void

sign() 공개 메소드

Set the public and private key files and password for S/MIME signing.
public sign ( string $cert_filename, string $key_filename, string $key_pass, string $extracerts_filename = '' )
$cert_filename string
$key_filename string
$key_pass string Password for private key
$extracerts_filename string Optional path to chain certificate

smtpClose() 공개 메소드

Close the active SMTP session if one exists.
public smtpClose ( ) : void
리턴 void

smtpConnect() 공개 메소드

Returns false if the operation failed.
public smtpConnect ( array $options = null ) : boolean
$options array An array of options compatible with stream_context_create()
리턴 boolean

smtpSend() 보호된 메소드

Returns false if there is a bad MAIL FROM, RCPT, or DATA input. Uses the PHPMailerSMTP class by default.
또한 보기: PHPMailer::getSMTPInstance() to use a different class.
protected smtpSend ( string $header, string $body ) : boolean
$header string The message headers
$body string The message body
리턴 boolean

textLine() 공개 메소드

Return a formatted mail line.
public textLine ( string $value ) : string
$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 the last character boundary prior to this length
리턴 integer

validateAddress() 공개 정적인 메소드

Check that a string looks like an email address.
public static validateAddress ( string $address, string | callable $patternselect = null ) : boolean
$address string The email address to check
$patternselect string | callable A 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('[email protected]', 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.
리턴 boolean

wrapText() 공개 메소드

For use with mailers that do not automatically perform wrapping and for quoted-printable encoded messages. Original written by philippe.
public wrapText ( string $message, integer $length, boolean $qp_mode = false ) : string
$message string The message to wrap
$length integer The line length to wrap to
$qp_mode boolean Whether to run in Quoted-Printable mode
리턴 string

프로퍼티 상세

$AllowEmpty 공개적으로 프로퍼티

Whether to allow sending messages with an empty body.
public bool $AllowEmpty
리턴 boolean

$AltBody 공개적으로 프로퍼티

This body can be read by mail clients that do not have HTML email capability such as mutt & Eudora. Clients that can read HTML will view the normal Body.
public string $AltBody
리턴 string

$AuthType 공개적으로 프로퍼티

Options are CRAM-MD5, LOGIN, PLAIN, NTLM, XOAUTH2, attempted in that order if not specified
public string $AuthType
리턴 string

$Body 공개적으로 프로퍼티

If HTML then call isHTML(true).
public string $Body
리턴 string

$CharSet 공개적으로 프로퍼티

The character set of the message.
public string $CharSet
리턴 string

$ConfirmReadingTo 공개적으로 프로퍼티

The email address that a reading confirmation should be sent to, also known as read receipt.
public string $ConfirmReadingTo
리턴 string

$ContentType 공개적으로 프로퍼티

The MIME Content-type of the message.
public string $ContentType
리턴 string

$CustomHeader 보호되어 있는 프로퍼티

The array of custom headers.
protected array $CustomHeader
리턴 array

$DKIM_domain 공개적으로 프로퍼티

DKIM signing domain name.
public string $DKIM_domain
리턴 string

$DKIM_identity 공개적으로 프로퍼티

Usually the email address used as the source of the email.
public string $DKIM_identity
리턴 string

$DKIM_passphrase 공개적으로 프로퍼티

Used if your key is encrypted.
public string $DKIM_passphrase
리턴 string

$DKIM_private 공개적으로 프로퍼티

DKIM private key file path.
public string $DKIM_private
리턴 string

$DKIM_private_string 공개적으로 프로퍼티

If set, takes precedence over $DKIM_private.
public string $DKIM_private_string
리턴 string

$DKIM_selector 공개적으로 프로퍼티

DKIM selector.
public string $DKIM_selector
리턴 string

$Debugoutput 공개적으로 프로퍼티

Options: * echo Output plain-text as-is, appropriate for CLI * html Output escaped, line breaks converted to
, appropriate for browser output * error_log Output to error log as configured in php.ini Alternatively, you can provide a callable expecting two params: a message string and the debug level: $mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
또한 보기: SMTP::$Debugoutput
public string|callable $Debugoutput
리턴 string | callable

$Encoding 공개적으로 프로퍼티

Options: "8bit", "7bit", "binary", "base64", and "quoted-printable".
public string $Encoding
리턴 string

$ErrorInfo 공개적으로 프로퍼티

Holds the most recent mailer error message.
public string $ErrorInfo
리턴 string

$From 공개적으로 프로퍼티

The From email address for the message.
public string $From
리턴 string

$FromName 공개적으로 프로퍼티

The From name of the message.
public string $FromName
리턴 string

$Helo 공개적으로 프로퍼티

Default is $Hostname. If $Hostname is empty, PHPMailer attempts to find one with the same method described above for $Hostname.
또한 보기: PHPMailer::$Hostname
public string $Helo
리턴 string

$Host 공개적으로 프로퍼티

Either a single hostname or multiple semicolon-delimited hostnames. 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"). You can also specify encryption type, for example: (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465"). Hosts will be tried in order.
public string $Host
리턴 string

$Hostname 공개적으로 프로퍼티

If empty, PHPMailer attempts to find one with, in order, $_SERVER['SERVER_NAME'], gethostname(), php_uname('n'), or the value 'localhost.localdomain'.
public string $Hostname
리턴 string

$Ical 공개적으로 프로퍼티

Only supported in simple alt or alt_inline message types To generate iCal events, use the bundled extras/EasyPeasyICS.php class or iCalcreator
public string $Ical
리턴 string

$LE 공개적으로 프로퍼티

The default line ending.
public string $LE
리턴 string

$MIMEBody 보호되어 있는 프로퍼티

The complete compiled MIME message body.
protected string $MIMEBody
리턴 string

$MIMEHeader 보호되어 있는 프로퍼티

The complete compiled MIME message headers.
protected string $MIMEHeader
리턴 string

$Mailer 공개적으로 프로퍼티

Options: "mail", "sendmail", or "smtp".
public string $Mailer
리턴 string

$MessageDate 공개적으로 프로퍼티

If empty, the current date will be added.
public string $MessageDate
리턴 string

$MessageID 공개적으로 프로퍼티

If empty, a unique id will be generated. You can set your own, but it must be in the format "", as defined in RFC5322 section 3.6.4 or it will be ignored.
또한 보기: https://tools.ietf.org/html/rfc5322#section-3.6.4
public string $MessageID
리턴 string

$Password 공개적으로 프로퍼티

SMTP password.
public string $Password
리턴 string

$PluginDir 공개적으로 프로퍼티

Useful if the SMTP class is not in the PHP include path.
사용 중단: Should not be needed now there is an autoloader.
public string $PluginDir
리턴 string

$Port 공개적으로 프로퍼티

The default SMTP server port.
public int $Port
리턴 integer

$Priority 공개적으로 프로퍼티

Options: null (default), 1 = High, 3 = Normal, 5 = low. When null, the header is not set at all.
public int $Priority
리턴 integer

$Realm 공개적으로 프로퍼티

Used for NTLM auth
public string $Realm
리턴 string

$RecipientsQueue 보호되어 있는 프로퍼티

In send(), valid and non duplicate entries are moved to $all_recipients and one of $to, $cc, or $bcc. This array is used only for addresses with IDN.
또한 보기: PHPMailer::$to @see PHPMailer::$cc @see PHPMailer::$bcc
또한 보기: PHPMailer::$all_recipients
protected array $RecipientsQueue
리턴 array

$ReplyTo 보호되어 있는 프로퍼티

The array of reply-to names and addresses.
protected array $ReplyTo
리턴 array

$ReplyToQueue 보호되어 있는 프로퍼티

In send(), valid and non duplicate entries are moved to $ReplyTo. This array is used only for addresses with IDN.
또한 보기: PHPMailer::$ReplyTo
protected array $ReplyToQueue
리턴 array

$ReturnPath 공개적으로 프로퍼티

If empty, it will be set to either From or Sender.
사용 중단: Email senders should never set a return-path header; it's the receiver's job (RFC5321 section 4.4), so this no longer does anything.
public string $ReturnPath
리턴 string

$SMTPAuth 공개적으로 프로퍼티

Uses the Username and Password properties.
또한 보기: PHPMailer::$Username
또한 보기: PHPMailer::$Password
public bool $SMTPAuth
리턴 boolean

$SMTPAutoTLS 공개적으로 프로퍼티

Be aware that in PHP >= 5.6 this requires that the server's certificates are valid.
public bool $SMTPAutoTLS
리턴 boolean

$SMTPDebug 공개적으로 프로퍼티

Debug output level. Options: * 0 No output * 1 Commands * 2 Data and commands * 3 As 2 plus connection status * 4 Low-level data output
또한 보기: SMTP::$do_debug
public int $SMTPDebug
리턴 integer

$SMTPKeepAlive 공개적으로 프로퍼티

If this is set to true then to close the connection requires an explicit call to smtpClose().
public bool $SMTPKeepAlive
리턴 boolean

$SMTPOptions 공개적으로 프로퍼티

Options array passed to stream_context_create when connecting via SMTP.
public array $SMTPOptions
리턴 array

$SMTPSecure 공개적으로 프로퍼티

Options: '', 'ssl' or 'tls'
public string $SMTPSecure
리턴 string

$Sender 공개적으로 프로퍼티

If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
public string $Sender
리턴 string

$Sendmail 공개적으로 프로퍼티

The path to the sendmail program.
public string $Sendmail
리턴 string

$SingleTo 공개적으로 프로퍼티

Only supported in mail and sendmail transports, not in SMTP.
public bool $SingleTo
리턴 boolean

$SingleToArray 공개적으로 프로퍼티

Storage for addresses when SingleTo is enabled.
public array $SingleToArray
리턴 array

$Subject 공개적으로 프로퍼티

The Subject of the message.
public string $Subject
리턴 string

$Timeout 공개적으로 프로퍼티

Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
public int $Timeout
리턴 integer

$UseSendmailOptions 공개적으로 프로퍼티

One which supports sendmail's "-oi -f" options.
public bool $UseSendmailOptions
리턴 boolean

$Username 공개적으로 프로퍼티

SMTP username.
public string $Username
리턴 string

$Version 공개적으로 프로퍼티

The PHPMailer Version number.
public string $Version
리턴 string

$WordWrap 공개적으로 프로퍼티

Set to 0 to not wrap. A useful value here is 78, for RFC2822 section 2.1.1 compliance.
public int $WordWrap
리턴 integer

$Workstation 공개적으로 프로퍼티

Used for NTLM auth
public string $Workstation
리턴 string

$XMailer 공개적으로 프로퍼티

Options: An empty string for PHPMailer default, whitespace for none, or a string to use
public string $XMailer
리턴 string

$action_function 공개적으로 프로퍼티

The function that handles the result of the send email action. It is called out by send() for each email sent. Value can be any php callable: http://www.php.net/is_callable Parameters: boolean $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 string $from email address of sender
public string $action_function
리턴 string

$all_recipients 보호되어 있는 프로퍼티

Includes all of $to, $cc, $bcc
또한 보기: PHPMailer::$to @see PHPMailer::$cc @see PHPMailer::$bcc
protected array $all_recipients
리턴 array

$attachment 보호되어 있는 프로퍼티

The array of attachments.
protected array $attachment
리턴 array

$bcc 보호되어 있는 프로퍼티

The array of 'bcc' names and addresses.
protected array $bcc
리턴 array

$boundary 보호되어 있는 프로퍼티

The array of MIME boundary strings.
protected array $boundary
리턴 array

$cc 보호되어 있는 프로퍼티

The array of 'cc' names and addresses.
protected array $cc
리턴 array

$do_verp 공개적으로 프로퍼티

Only applicable when sending via SMTP.
public bool $do_verp
리턴 boolean

$error_count 보호되어 있는 프로퍼티

The number of errors encountered.
protected int $error_count
리턴 integer

$exceptions 보호되어 있는 프로퍼티

Whether to throw exceptions for errors.
protected bool $exceptions
리턴 boolean

$language 보호되어 있는 프로퍼티

The array of available languages.
protected array $language
리턴 array

$lastMessageID 보호되어 있는 프로퍼티

The most recent Message-ID (including angular brackets).
protected string $lastMessageID
리턴 string

$mailHeader 보호되어 있는 프로퍼티

Extra headers that createHeader() doesn't fold in.
protected string $mailHeader
리턴 string

$message_type 보호되어 있는 프로퍼티

The message's MIME type.
protected string $message_type
리턴 string

$sign_cert_file 보호되어 있는 프로퍼티

The S/MIME certificate file path.
protected string $sign_cert_file
리턴 string

$sign_extracerts_file 보호되어 있는 프로퍼티

The optional S/MIME extra certificates ("CA Chain") file path.
protected string $sign_extracerts_file
리턴 string

$sign_key_file 보호되어 있는 프로퍼티

The S/MIME key file path.
protected string $sign_key_file
리턴 string

$sign_key_pass 보호되어 있는 프로퍼티

Used only if the key is encrypted.
protected string $sign_key_pass
리턴 string

$smtp 보호되어 있는 프로퍼티

An instance of the SMTP sender class.
protected SMTP $smtp
리턴 SMTP

$to 보호되어 있는 프로퍼티

The array of 'to' names and addresses.
protected array $to
리턴 array

$uniqueid 보호되어 있는 프로퍼티

Unique ID used for message ID and boundaries.
protected string $uniqueid
리턴 string

$validator 공개적으로 정적으로 프로퍼티

May be a callable to inject your own validator, but there are several built-in validators.
또한 보기: PHPMailer::validateAddress()
public static string|callable $validator
리턴 string | callable