Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class phpmailer.php
- [PHP]
- <?php
- /**
- * PHPMailer - PHP email creation and transport class.
- * PHP Version 5
- * @package PHPMailer
- * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
- * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
- * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
- * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
- * @author Brent R. Matzelle (original founder)
- * @copyright 2012 - 2014 Marcus Bointon
- * @copyright 2010 - 2012 Jim Jagielski
- * @copyright 2004 - 2009 Andy Prevost
- * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
- * @note This program is distributed in the hope that it will be useful - WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.
- */
- /**
- * PHPMailer - PHP email creation and transport class.
- * @package PHPMailer
- * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
- * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
- * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
- * @author Brent R. Matzelle (original founder)
- */
- class PHPMailer
- {
- /**
- * The PHPMailer Version number.
- * @type string
- */
- public $Version = '5.2.13';
- /**
- * Email priority.
- * Options: null (default), 1 = High, 3 = Normal, 5 = low.
- * When null, the header is not set at all.
- * @type integer
- */
- public $Priority = null;
- /**
- * The character set of the message.
- * @type string
- */
- public $CharSet = 'iso-8859-1';
- /**
- * The MIME Content-type of the message.
- * @type string
- */
- public $ContentType = 'text/plain';
- /**
- * The message encoding.
- * Options: "8bit", "7bit", "binary", "base64", and "quoted-printable".
- * @type string
- */
- public $Encoding = '8bit';
- /**
- * Holds the most recent mailer error message.
- * @type string
- */
- public $ErrorInfo = '';
- /**
- * The From email address for the message.
- * @type string
- */
- public $From = 'root@localhost';
- /**
- * The From name of the message.
- * @type string
- */
- public $FromName = 'Root User';
- /**
- * The Sender email (Return-Path) of the message.
- * If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
- * @type string
- */
- public $Sender = '';
- /**
- * The Return-Path of the message.
- * If empty, it will be set to either From or Sender.
- * @type string
- * @deprecated 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.
- * @link https://tools.ietf.org/html/rfc5321#section-4.4 RFC5321 reference
- */
- public $ReturnPath = '';
- /**
- * The Subject of the message.
- * @type string
- */
- public $Subject = '';
- /**
- * An HTML or plain text message body.
- * If HTML then call isHTML(true).
- * @type string
- */
- public $Body = '';
- /**
- * The plain-text message body.
- * 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.
- * @type string
- */
- public $AltBody = '';
- /**
- * An iCal message part body.
- * Only supported in simple alt or alt_inline message types
- * To generate iCal events, use the bundled extras/EasyPeasyICS.php class or iCalcreator
- * @link http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/
- * @link http://kigkonsult.se/iCalcreator/
- * @type string
- */
- public $Ical = '';
- /**
- * The complete compiled MIME message body.
- * @access protected
- * @type string
- */
- protected $MIMEBody = '';
- /**
- * The complete compiled MIME message headers.
- * @type string
- * @access protected
- */
- protected $MIMEHeader = '';
- /**
- * Extra headers that createHeader() doesn't fold in.
- * @type string
- * @access protected
- */
- protected $mailHeader = '';
- /**
- * Word-wrap the message body to this number of chars.
- * Set to 0 to not wrap. A useful value here is 78, for RFC2822 section 2.1.1 compliance.
- * @type integer
- */
- public $WordWrap = 0;
- /**
- * Which method to use to send mail.
- * Options: "mail", "sendmail", or "smtp".
- * @type string
- */
- public $Mailer = 'mail';
- /**
- * The path to the sendmail program.
- * @type string
- */
- public $Sendmail = '/usr/sbin/sendmail';
- /**
- * Whether mail() uses a fully sendmail-compatible MTA.
- * One which supports sendmail's "-oi -f" options.
- * @type boolean
- */
- public $UseSendmailOptions = true;
- /**
- * Path to PHPMailer plugins.
- * Useful if the SMTP class is not in the PHP include path.
- * @type string
- * @deprecated Should not be needed now there is an autoloader.
- */
- public $PluginDir = '';
- /**
- * The email address that a reading confirmation should be sent to.
- * @type string
- */
- public $ConfirmReadingTo = '';
- /**
- * The hostname to use in the Message-ID header and as default HELO string.
- * If empty, PHPMailer attempts to find one with, in order,
- * $_SERVER['SERVER_NAME'], gethostname(), php_uname('n'), or the value
- * 'localhost.localdomain'.
- * @type string
- */
- public $Hostname = '';
- /**
- * An ID to be used in the Message-ID header.
- * If empty, a unique id will be generated.
- * @type string
- */
- public $MessageID = '';
- /**
- * The message Date to be used in the Date header.
- * If empty, the current date will be added.
- * @type string
- */
- public $MessageDate = '';
- /**
- * SMTP hosts.
- * 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.
- * @type string
- */
- public $Host = 'poczta.o2.pl';
- /**
- * The default SMTP server port.
- * @type integer
- * @TODO Why is this needed when the SMTP class takes care of it?
- */
- public $Port = 25;
- /**
- * The SMTP HELO of the message.
- * Default is $Hostname. If $Hostname is empty, PHPMailer attempts to find
- * one with the same method described above for $Hostname.
- * @type string
- * @see PHPMailer::$Hostname
- */
- public $Helo = '';
- /**
- * What kind of encryption to use on the SMTP connection.
- * Options: '', 'ssl' or 'tls'
- * @type string
- */
- public $SMTPSecure = '';
- /**
- * Whether to enable TLS encryption automatically if a server supports it,
- * even if `SMTPSecure` is not set to 'tls'.
- * Be aware that in PHP >= 5.6 this requires that the server's certificates are valid.
- * @type boolean
- */
- public $SMTPAutoTLS = true;
- /**
- * Whether to use SMTP authentication.
- * Uses the Username and Password properties.
- * @type boolean
- * @see PHPMailer::$Username
- * @see PHPMailer::$Password
- */
- public $SMTPAuth = true;
- /**
- * Options array passed to stream_context_create when connecting via SMTP.
- * @type array
- */
- public $SMTPOptions = array();
- /**
- * SMTP username.
- * @type string
- */
- public $Username = 'solaris@o2.pl';
- /**
- * SMTP password.
- * @type string
- */
- public $Password = 'pass';
- /**
- * SMTP auth type.
- * Options are LOGIN (default), PLAIN, NTLM, CRAM-MD5
- * @type string
- */
- public $AuthType = '';
- /**
- * SMTP realm.
- * Used for NTLM auth
- * @type string
- */
- public $Realm = '';
- /**
- * SMTP workstation.
- * Used for NTLM auth
- * @type string
- */
- public $Workstation = '';
- /**
- * The SMTP server timeout in seconds.
- * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
- * @type integer
- */
- public $Timeout = 300;
- /**
- * SMTP class debug output mode.
- * Debug output level.
- * Options:
- * * `0` No output
- * * `1` Commands
- * * `2` Data and commands
- * * `3` As 2 plus connection status
- * * `4` Low-level data output
- * @type integer
- * @see SMTP::$do_debug
- */
- public $SMTPDebug = 1;
- /**
- * How to handle debug output.
- * Options:
- * * `echo` Output plain-text as-is, appropriate for CLI
- * * `html` Output escaped, line breaks converted to `<br>`, 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:
- * <code>
- * $mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
- * </code>
- * @type string|callable
- * @see SMTP::$Debugoutput
- */
- public $Debugoutput = 'echo';
- /**
- * Whether to keep SMTP connection open after each message.
- * If this is set to true then to close the connection
- * requires an explicit call to smtpClose().
- * @type boolean
- */
- public $SMTPKeepAlive = false;
- /**
- * Whether to split multiple to addresses into multiple messages
- * or send them all in one message.
- * @type boolean
- */
- public $SingleTo = false;
- /**
- * Storage for addresses when SingleTo is enabled.
- * @type array
- * @TODO This should really not be public
- */
- public $SingleToArray = array();
- /**
- * Whether to generate VERP addresses on send.
- * Only applicable when sending via SMTP.
- * @link https://en.wikipedia.org/wiki/Variable_envelope_return_path
- * @link http://www.postfix.org/VERP_README.html Postfix VERP info
- * @type boolean
- */
- public $do_verp = false;
- /**
- * Whether to allow sending messages with an empty body.
- * @type boolean
- */
- public $AllowEmpty = false;
- /**
- * The default line ending.
- * @note The default remains "\n". We force CRLF where we know
- * it must be used via self::CRLF.
- * @type string
- */
- public $LE = "\n";
- /**
- * DKIM selector.
- * @type string
- */
- public $DKIM_selector = '';
- /**
- * DKIM Identity.
- * Usually the email address used as the source of the email
- * @type string
- */
- public $DKIM_identity = '';
- /**
- * DKIM passphrase.
- * Used if your key is encrypted.
- * @type string
- */
- public $DKIM_passphrase = '';
- /**
- * DKIM signing domain name.
- * @example 'example.com'
- * @type string
- */
- public $DKIM_domain = '';
- /**
- * DKIM private key file path.
- * @type string
- */
- public $DKIM_private = '';
- /**
- * Callback Action function name.
- *
- * 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
- * @type string
- */
- public $action_function = '';
- /**
- * What to put in the X-Mailer header.
- * Options: An empty string for PHPMailer default, whitespace for none, or a string to use
- * @type string
- */
- public $XMailer = '';
- /**
- * Only For XOAUTH - Google
- * Options: An empty string for PHPMailer default, Enter the email used to get access token
- * @type string
- */
- // public $UserEmail = '';
- // public $RefreshToken = '';
- // public $ClientId = '';
- // public $ClientSecret = '';
- /**
- * An instance of the SMTP sender class.
- * @type SMTP
- * @access protected
- */
- protected $smtp = null;
- /**
- * The array of 'to' addresses.
- * @type array
- * @access protected
- */
- protected $to = array();
- /**
- * The array of 'cc' addresses.
- * @type array
- * @access protected
- */
- protected $cc = array();
- /**
- * The array of 'bcc' addresses.
- * @type array
- * @access protected
- */
- protected $bcc = array();
- /**
- * The array of reply-to names and addresses.
- * @type array
- * @access protected
- */
- protected $ReplyTo = array();
- /**
- * An array of all kinds of addresses.
- * Includes all of $to, $cc, $bcc
- * @type array
- * @access protected
- */
- protected $all_recipients = array();
- /**
- * The array of attachments.
- * @type array
- * @access protected
- */
- protected $attachment = array();
- /**
- * The array of custom headers.
- * @type array
- * @access protected
- */
- protected $CustomHeader = array();
- /**
- * The most recent Message-ID (including angular brackets).
- * @type string
- * @access protected
- */
- protected $lastMessageID = '';
- /**
- * The message's MIME type.
- * @type string
- * @access protected
- */
- protected $message_type = '';
- /**
- * The array of MIME boundary strings.
- * @type array
- * @access protected
- */
- protected $boundary = array();
- /**
- * The array of available languages.
- * @type array
- * @access protected
- */
- protected $language = array();
- /**
- * The number of errors encountered.
- * @type integer
- * @access protected
- */
- protected $error_count = 0;
- /**
- * The S/MIME certificate file path.
- * @type string
- * @access protected
- */
- protected $sign_cert_file = '';
- /**
- * The S/MIME key file path.
- * @type string
- * @access protected
- */
- protected $sign_key_file = '';
- /**
- * The optional S/MIME extra certificates ("CA Chain") file path.
- * @type string
- * @access protected
- */
- protected $sign_extracerts_file = '';
- /**
- * The S/MIME password for the key.
- * Used only if the key is encrypted.
- * @type string
- * @access protected
- */
- protected $sign_key_pass = '';
- /**
- * Whether to throw exceptions for errors.
- * @type boolean
- * @access protected
- */
- protected $exceptions = false;
- /**
- * Unique ID used for message ID and boundaries.
- * @type string
- * @access protected
- */
- protected $uniqueid = '';
- /**
- * Error severity: message only, continue processing.
- */
- const STOP_MESSAGE = 0;
- /**
- * Error severity: message, likely ok to continue processing.
- */
- const STOP_CONTINUE = 1;
- /**
- * Error severity: message, plus full stop, critical error reached.
- */
- const STOP_CRITICAL = 2;
- /**
- * SMTP RFC standard line ending.
- */
- const CRLF = "\r\n";
- /**
- * The maximum line length allowed by RFC 2822 section 2.1.1
- * @type integer
- */
- const MAX_LINE_LENGTH = 998;
- /**
- * Constructor.
- * @param boolean $exceptions Should we throw external exceptions?
- */
- public function __construct($exceptions = false)
- {
- $this->exceptions = (boolean)$exceptions;
- }
- [/PHP]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement