[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Emails/ -> class.phpmailer.php (summary)

PHPMailer - PHP email creation and transport class NOTE: Requires PHP version 5 or later

Author: Andy Prevost
Author: Marcus Bointon
Author: Jim Jagielski
Copyright: 2010 - 2012 Jim Jagielski
Copyright: 2004 - 2009 Andy Prevost
License: http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
File Size: 2957 lines (96 kb)
Included or required: 4 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

PHPMailer:: (86 methods):
  mail_passthru()
  edebug()
  __construct()
  __destruct()
  IsHTML()
  IsSMTP()
  IsMail()
  IsSendmail()
  IsQmail()
  AddAddress()
  AddCC()
  AddBCC()
  AddReplyTo()
  AddAnAddress()
  SetFrom()
  ValidateAddress()
  Send()
  PreSend()
  PostSend()
  SendmailSend()
  MailSend()
  SmtpSend()
  SmtpConnect()
  SmtpClose()
  SetLanguage()
  GetTranslations()
  AddrAppend()
  AddrFormat()
  WrapText()
  UTF8CharBoundary()
  SetWordWrap()
  CreateHeader()
  GetMailMIME()
  GetSentMIMEMessage()
  CreateBody()
  GetBoundary()
  EndBoundary()
  SetMessageType()
  HeaderLine()
  TextLine()
  AddAttachment()
  GetAttachments()
  AttachAll()
  EncodeFile()
  EncodeString()
  EncodeHeader()
  HasMultiBytes()
  Base64EncodeWrapMB()
  EncodeQP()
  EncodeQPphp()
  EncodeQ()
  AddStringAttachment()
  AddEmbeddedImage()
  AddStringEmbeddedImage()
  InlineImageExists()
  AttachmentExists()
  AlternativeExists()
  ClearAddresses()
  ClearCCs()
  ClearBCCs()
  ClearReplyTos()
  ClearAllRecipients()
  ClearAttachments()
  ClearCustomHeaders()
  SetError()
  RFCDate()
  ServerHostname()
  Lang()
  IsError()
  FixEOL()
  AddCustomHeader()
  MsgHTML()
  html2text()
  _mime_types()
  filenameToType()
  mb_pathinfo()
  set()
  SecureHeader()
  NormalizeBreaks()
  Sign()
  DKIM_QP()
  DKIM_Sign()
  DKIM_HeaderC()
  DKIM_BodyC()
  DKIM_Add()
  doCallback()

phpmailerException:: (1 method):
  errorMessage()


Class: PHPMailer  - X-Ref

PHP email creation and transport class

mail_passthru($to, $subject, $body, $header, $params)   X-Ref
Calls actual mail() function, but 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: string $to To
param: string $subject Subject
param: string $body Message Body
param: string $header Additional Header(s)
param: string $params Params
return: bool

edebug($str)   X-Ref
Outputs debugging info via user-defined method

param: string $str

__construct($exceptions = false)   X-Ref
Constructor

param: boolean $exceptions Should we throw external exceptions?

__destruct()   X-Ref
Destructor


IsHTML($ishtml = true)   X-Ref
Sets message type to HTML.

param: bool $ishtml
return: void

IsSMTP()   X-Ref
Sets Mailer to send message using SMTP.

return: void

IsMail()   X-Ref
Sets Mailer to send message using PHP mail() function.

return: void

IsSendmail()   X-Ref
Sets Mailer to send message using the $Sendmail program.

return: void

IsQmail()   X-Ref
Sets Mailer to send message using the qmail MTA.

return: void

AddAddress($address, $name = '')   X-Ref
Adds a "To" address.

param: string $address
param: string $name
return: boolean true on success, false if address already used

AddCC($address, $name = '')   X-Ref
Adds a "Cc" address.
Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.

param: string $address
param: string $name
return: boolean true on success, false if address already used

AddBCC($address, $name = '')   X-Ref
Adds a "Bcc" address.
Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.

param: string $address
param: string $name
return: boolean true on success, false if address already used

AddReplyTo($address, $name = '')   X-Ref
Adds a "Reply-to" address.

param: string $address
param: string $name
return: boolean

AddAnAddress($kind, $address, $name = '')   X-Ref
Adds an address to one of the recipient arrays
Addresses that have been added already return false, but do not throw exceptions

param: string $kind One of 'to', 'cc', 'bcc', 'ReplyTo'
param: string $address The email address to send to
param: string $name
return: boolean true on success, false if address already used or invalid in some way

SetFrom($address, $name = '', $auto = true)   X-Ref
Set the From and FromName properties

param: string $address
param: string $name
param: boolean $auto Whether to also set the Sender address, defaults to true
return: boolean

ValidateAddress($address)   X-Ref
Check that a string looks roughly like an email address should
Static so it can be used without instantiation, public so people can overload
Conforms to RFC5322: Uses *correct* regex on which FILTER_VALIDATE_EMAIL is
based; So why not use FILTER_VALIDATE_EMAIL? Because it was broken to
not allow a@b type valid addresses :(

param: string $address The email address to check
return: boolean

Send()   X-Ref
Creates message and assigns Mailer. If the message is
not sent successfully then it returns false.  Use the ErrorInfo
variable to view description of the error.

return: bool

PreSend()   X-Ref
Prep mail by constructing all message entities

return: bool

PostSend()   X-Ref
Actual Email transport function
Send the email via the selected mechanism

return: bool

SendmailSend($header, $body)   X-Ref
Sends mail using the $Sendmail program.

param: string $header The message headers
param: string $body The message body
return: bool

MailSend($header, $body)   X-Ref
Sends mail using the PHP mail() function.

param: string $header The message headers
param: string $body The message body
return: bool

SmtpSend($header, $body)   X-Ref
Sends mail via SMTP using PhpSMTP
Returns false if there is a bad MAIL FROM, RCPT, or DATA input.

param: string $header The message headers
param: string $body The message body
return: bool

SmtpConnect($options = array()   X-Ref
Initiates a connection to an SMTP server.
Returns false if the operation failed.

param: array $options An array of options compatible with stream_context_create()
return: bool

SmtpClose()   X-Ref
Closes the active SMTP session if one exists.

return: void

SetLanguage($langcode = 'en', $lang_path = 'language/')   X-Ref
Sets the language for all class error messages.
Returns false if it cannot load the language file.  The default language is English.

param: string $langcode ISO 639-1 2-character language code (e.g. Portuguese: "br")
param: string $lang_path Path to the language file directory
return: bool

GetTranslations()   X-Ref
Return the current array of language strings

return: array

AddrAppend($type, $addr)   X-Ref
Creates recipient headers.

param: string $type
param: array $addr
return: string

AddrFormat($addr)   X-Ref
Formats an address correctly.

param: string $addr
return: string

WrapText($message, $length, $qp_mode = false)   X-Ref
Wraps message for use with mailers that do not
automatically perform wrapping and for quoted-printable.
Original written by philippe.

param: string $message The message to wrap
param: integer $length The line length to wrap to
param: boolean $qp_mode Whether to run in Quoted-Printable mode
return: string

UTF8CharBoundary($encodedText, $maxLength)   X-Ref
Finds last character boundary prior to maxLength in a utf-8
quoted (printable) encoded string.
Original written by Colin Brown.

param: string $encodedText utf-8 QP text
param: int    $maxLength   find last character boundary prior to this length
return: int

SetWordWrap()   X-Ref
Set the body wrapping.

return: void

CreateHeader()   X-Ref
Assembles message header.

return: string The assembled header

GetMailMIME()   X-Ref
Returns the message MIME.

return: string

GetSentMIMEMessage()   X-Ref
Returns the MIME message (headers and body). Only really valid post PreSend().

return: string

CreateBody()   X-Ref
Assembles the message body.  Returns an empty string on failure.

return: string The assembled message body

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

param: string $boundary
param: string $charSet
param: string $contentType
param: string $encoding
return: string

EndBoundary($boundary)   X-Ref
Returns the end of a message boundary.

param: string $boundary
return: string

SetMessageType()   X-Ref
Sets the message type.

return: void

HeaderLine($name, $value)   X-Ref
Returns a formatted header line.

param: string $name
param: string $value
return: string

TextLine($value)   X-Ref
Returns a formatted mail line.

param: string $value
return: string

AddAttachment($path, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment')   X-Ref
Adds an attachment from a path on the filesystem.
Returns false if the file could not be found
or accessed.

param: string $path Path to the attachment.
param: string $name Overrides the attachment name.
param: string $encoding File encoding (see $Encoding).
param: string $type File extension (MIME) type.
param: string $disposition Disposition to use
return: bool

GetAttachments()   X-Ref
Return the current array of attachments

return: array

AttachAll($disposition_type, $boundary)   X-Ref
Attaches all fs, string, and binary attachments to the message.
Returns an empty string on failure.

param: string $disposition_type
param: string $boundary
return: string

EncodeFile($path, $encoding = 'base64')   X-Ref
Encodes attachment in requested format.
Returns an empty string on failure.

param: string $path The full path to the file
param: string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
return: string

EncodeString($str, $encoding = 'base64')   X-Ref
Encodes string to requested format.
Returns an empty string on failure.

param: string $str The text to encode
param: string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
return: string

EncodeHeader($str, $position = 'text')   X-Ref
Encode a header string to best (shortest) of Q, B, quoted or none.

param: string $str
param: string $position
return: string

HasMultiBytes($str)   X-Ref
Checks if a string contains multibyte characters.

param: string $str multi-byte text to wrap encode
return: bool

Base64EncodeWrapMB($str, $lf=null)   X-Ref
Correctly encodes and wraps long multibyte strings for mail headers
without breaking lines within a character.
Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php

param: string $str multi-byte text to wrap encode
param: string $lf string to use as linefeed/end-of-line
return: string

EncodeQP($string, $line_max = 76)   X-Ref
Encode string to RFC2045 (6.7) quoted-printable format

param: string $string The text to encode
param: integer $line_max Number of chars allowed on a line before wrapping
return: string

EncodeQPphp($string, $line_max = 76, $space_conv = false)   X-Ref
Wrapper to preserve BC for old QP encoding function that was removed

param: string $string
param: integer $line_max
param: bool $space_conv
return: string

EncodeQ($str, $position = 'text')   X-Ref
Encode string to q encoding.

param: string $str the text to encode
param: string $position Where the text is going to be used, see the RFC for what that means
return: string

AddStringAttachment($string, $filename, $encoding = 'base64', $type = '', $disposition = 'attachment')   X-Ref
Adds a string or binary attachment (non-filesystem) to the list.
This method can be used to attach ascii or binary data,
such as a BLOB record from a database.

param: string $string String attachment data.
param: string $filename Name of the attachment.
param: string $encoding File encoding (see $Encoding).
param: string $type File extension (MIME) type.
param: string $disposition Disposition to use
return: void

AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline')   X-Ref
Add an embedded attachment from a file.
This can include images, sounds, and just about any other document type.

param: string $path Path to the attachment.
param: string $cid Content ID of the attachment; Use this to reference
param: string $name Overrides the attachment name.
param: string $encoding File encoding (see $Encoding).
param: string $type File MIME type.
param: string $disposition Disposition to use
return: bool True on successfully adding an attachment

AddStringEmbeddedImage($string, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline')   X-Ref
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: string $string The attachment binary data.
param: string $cid Content ID of the attachment; Use this to reference
param: string $name
param: string $encoding File encoding (see $Encoding).
param: string $type MIME type.
param: string $disposition Disposition to use
return: bool True on successfully adding an attachment

InlineImageExists()   X-Ref
Returns true if an inline attachment is present.

return: bool

AttachmentExists()   X-Ref
Returns true if an attachment (non-inline) is present.

return: bool

AlternativeExists()   X-Ref
Does this message have an alternative body set?

return: bool

ClearAddresses()   X-Ref
Clears all recipients assigned in the TO array.  Returns void.

return: void

ClearCCs()   X-Ref
Clears all recipients assigned in the CC array.  Returns void.

return: void

ClearBCCs()   X-Ref
Clears all recipients assigned in the BCC array.  Returns void.

return: void

ClearReplyTos()   X-Ref
Clears all recipients assigned in the ReplyTo array.  Returns void.

return: void

ClearAllRecipients()   X-Ref
Clears all recipients assigned in the TO, CC and BCC
array.  Returns void.

return: void

ClearAttachments()   X-Ref
Clears all previously set filesystem, string, and binary
attachments.  Returns void.

return: void

ClearCustomHeaders()   X-Ref
Clears all custom headers.  Returns void.

return: void

SetError($msg)   X-Ref
Adds the error message to the error container.

param: string $msg
return: void

RFCDate()   X-Ref
Returns the proper RFC 822 formatted date.

return: string

ServerHostname()   X-Ref
Returns the server hostname or 'localhost.localdomain' if unknown.

return: string

Lang($key)   X-Ref
Returns a message in the appropriate language.

param: string $key
return: string

IsError()   X-Ref
Returns true if an error occurred.

return: bool

FixEOL($str)   X-Ref
Changes every end of line from CRLF, CR or LF to $this->LE.

param: string $str String to FixEOL
return: string

AddCustomHeader($name, $value=null)   X-Ref
Adds a custom header. $name value can be overloaded to contain
both header name and value (name:value)

param: string $name custom header name
param: string $value header value
return: void

MsgHTML($message, $basedir = '', $advanced = false)   X-Ref
Creates a message from an HTML string, making modifications for inline images and backgrounds
and creates a plain-text version by converting the HTML
Overwrites any existing values in $this->Body and $this->AltBody

param: string $message HTML message string
param: string $basedir baseline directory for path
param: bool $advanced Whether to use the advanced HTML to text converter
return: string $message

html2text($html, $advanced = false)   X-Ref
Convert an HTML string into a plain text version

param: string $html The HTML text to convert
param: bool $advanced Should this use the more complex html2text converter or just a simple one?
return: string

_mime_types($ext = '')   X-Ref
Gets the MIME type of the embedded or inline image

param: string $ext File extension
return: string MIME type of ext

filenameToType($filename)   X-Ref
Try to map a file name to a MIME type, default to application/octet-stream

param: string $filename A file name or full path, does not need to exist as a file
return: string

mb_pathinfo($path, $options = null)   X-Ref
Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe.
Works similarly to the one in PHP >= 5.2.0

param: string $path A filename or path, does not need to exist as a file
param: 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
return: string|array

set($name, $value = '')   X-Ref
Set (or reset) Class Objects (variables)

Usage Example:
$page->set('X-Priority', '3');

param: string $name
param: mixed $value
return: bool

SecureHeader($str)   X-Ref
Strips newlines to prevent header injection.

param: string $str
return: string

NormalizeBreaks($text, $breaktype = "\r\n")   X-Ref
Normalize 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: string $text
param: string $breaktype What kind of line break to use, defaults to CRLF
return: string

Sign($cert_filename, $key_filename, $key_pass)   X-Ref
Set the private key file and password to sign the message.

param: string $cert_filename
param: string $key_filename
param: string $key_pass Password for private key

DKIM_QP($txt)   X-Ref
Set the private key file and password to sign the message.

param: string $txt
return: string

DKIM_Sign($s)   X-Ref
Generate DKIM signature

param: string $s Header
return: string

DKIM_HeaderC($s)   X-Ref
Generate DKIM Canonicalization Header

param: string $s Header
return: string

DKIM_BodyC($body)   X-Ref
Generate DKIM Canonicalization Body

param: string $body Message Body
return: string

DKIM_Add($headers_line, $subject, $body)   X-Ref
Create the DKIM header, body, as new header

param: string $headers_line Header lines
param: string $subject Subject
param: string $body Body
return: string

doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from = null)   X-Ref
Perform callback

param: boolean $isSent
param: string $to
param: string $cc
param: string $bcc
param: string $subject
param: string $body
param: string $from

Class: phpmailerException  - X-Ref

Exception handler for PHPMailer

errorMessage()   X-Ref
Prettify error message output

return: string



Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1