+++ /dev/null
-docs/phpdoc/
-test/message.txt
-test/testbootstrap.php
-test/*.pem
-build/
-vendor/
+++ /dev/null
-build:
- environment:
- php: '5.6.0'
-
-before_commands:
- - "composer install --prefer-source"
-
-tools:
- external_code_coverage:
- enabled: true
- timeout: 300
- filter:
- excluded_paths:
- - 'docs/*'
- - 'examples/*'
- - 'extras/*'
- - 'test/*'
- - 'vendor/*'
-
- php_code_coverage:
- enabled: false
- filter:
- excluded_paths:
- - 'docs/*'
- - 'examples/*'
- - 'extras/*'
- - 'test/*'
- - 'vendor/*'
-
- php_code_sniffer:
- enabled: true
- config:
- standard: PSR2
- sniffs:
- generic:
- files:
- one_class_per_file_sniff: false
- filter:
- excluded_paths:
- - 'docs/*'
- - 'examples/*'
- - 'extras/*'
- - 'test/*'
- - 'vendor/*'
-
- # Copy/Paste Detector
- php_cpd:
- enabled: true
- excluded_dirs:
- - docs
- - examples
- - extras
- - test
- - vendor
-
- # PHP CS Fixer (http://http://cs.sensiolabs.org/).
- php_cs_fixer:
- enabled: true
- config:
- level: psr2
- filter:
- excluded_paths:
- - 'docs/*'
- - 'examples/*'
- - 'extras/*'
- - 'test/*'
- - 'vendor/*'
-
- # Analyzes the size and structure of a PHP project.
- php_loc:
- enabled: true
- excluded_dirs:
- - docs
- - examples
- - extras
- - test
- - vendor
-
- # PHP Mess Detector (http://phpmd.org).
- php_mess_detector:
- enabled: true
- config:
- rulesets:
- - codesize
- - unusedcode
- - naming
- - design
- naming_rules:
- short_variable: { minimum: 2 }
- filter:
- excluded_paths:
- - 'docs/*'
- - 'examples/*'
- - 'extras/*'
- - 'test/*'
- - 'vendor/*'
-
- # Analyzes the size and structure of a PHP project.
- php_pdepend:
- enabled: true
- excluded_dirs:
- - docs
- - examples
- - extras
- - test
- - vendor
-
- # Runs Scrutinizer's PHP Analyzer Tool
- # https://scrutinizer-ci.com/docs/tools/php/php-analyzer/config_reference
- php_analyzer:
- enabled: true
- config:
- checkstyle:
- enabled: true
- naming:
- enabled: true
- property_name: ^[_a-zA-Z][a-zA-Z0-9_]*$ #Allow underscores & caps
- method_name: ^(?:[_a-zA-Z]|__)[a-zA-Z0-9_]*$ #Allow underscores & caps
- parameter_name: ^[a-z][a-zA-Z0-9_]*$ # Allow underscores
- local_variable: ^[a-zA-Z][a-zA-Z0-9_]*$ #Allow underscores & caps
- exception_name: ^[a-zA-Z][a-zA-Z0-9]*Exception$
- isser_method_name: ^(?:[_a-zA-Z]|__)[a-zA-Z0-9]*$ #Allow underscores & caps
- filter:
- excluded_paths:
- - 'docs/*'
- - 'examples/*'
- - 'extras/*'
- - 'test/*'
- - 'vendor/*'
-
- # Security Advisory Checker
- sensiolabs_security_checker: true
+++ /dev/null
-language: php
-php:
- - 7.0
- - 5.6
- - 5.5
- - 5.4
- - 5.3
- - hhvm
-
-matrix:
- allow_failures:
- - php: hhvm
-
-before_install:
- - sudo apt-get update -qq
- - sudo apt-get install -y -qq postfix
-before_script:
- - sudo service postfix stop
- - smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 &
- - mkdir -p build/logs
- - cd test
- - cp testbootstrap-dist.php testbootstrap.php
- - chmod +x fakesendmail.sh
- - sudo mkdir -p /var/qmail/bin
- - sudo cp fakesendmail.sh /var/qmail/bin/sendmail
- - sudo cp fakesendmail.sh /usr/sbin/sendmail
- - echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' > $(php --ini|grep -m 1 "ini files in:"|cut -d ":" -f 2)/sendmail.ini
-script:
- - phpunit --configuration ../travis.phpunit.xml.dist
-after_script:
- - wget https://scrutinizer-ci.com/ocular.phar
- - php ocular.phar code-coverage:upload --format=php-clover ../build/logs/clover.xml
--- /dev/null
+GPL Cooperation Commitment
+Version 1.0
+
+Before filing or continuing to prosecute any legal proceeding or claim
+(other than a Defensive Action) arising from termination of a Covered
+License, we commit to extend to the person or entity ('you') accused
+of violating the Covered License the following provisions regarding
+cure and reinstatement, taken from GPL version 3. As used here, the
+term 'this License' refers to the specific Covered License being
+enforced.
+
+ However, if you cease all violation of this License, then your
+ license from a particular copyright holder is reinstated (a)
+ provisionally, unless and until the copyright holder explicitly
+ and finally terminates your license, and (b) permanently, if the
+ copyright holder fails to notify you of the violation by some
+ reasonable means prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+ reinstated permanently if the copyright holder notifies you of the
+ violation by some reasonable means, this is the first time you
+ have received notice of violation of this License (for any work)
+ from that copyright holder, and you cure the violation prior to 30
+ days after your receipt of the notice.
+
+We intend this Commitment to be irrevocable, and binding and
+enforceable against us and assignees of or successors to our
+copyrights.
+
+Definitions
+
+'Covered License' means the GNU General Public License, version 2
+(GPLv2), the GNU Lesser General Public License, version 2.1
+(LGPLv2.1), or the GNU Library General Public License, version 2
+(LGPLv2), all as published by the Free Software Foundation.
+
+'Defensive Action' means a legal proceeding or claim that We bring
+against you in response to a prior proceeding or claim initiated by
+you or your affiliate.
+
+'We' means each contributor to this repository as of the date of
+inclusion of this file, including subsidiaries of a corporate
+contributor.
+
+This work is available under a Creative Commons Attribution-ShareAlike
+4.0 International license (https://creativecommons.org/licenses/by-sa/4.0/).
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
- Preamble
+ Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
-
+\f
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
+\f
+ GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
-
+
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
-
+\f
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
-
+\f
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
-
+\f
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
- e) verify that the user has already received a copy of these
+ e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
-
+\f
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
-
+\f
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
-
+\f
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
- NO WARRANTY
+ NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
- END OF TERMS AND CONDITIONS
-
+ END OF TERMS AND CONDITIONS
+\f
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
-That's all there is to it!
-
-
+That's all there is to it!
\ No newline at end of file
function PHPMailerAutoload($classname)
{
//Can't use __DIR__ as it's only in PHP 5.3+
- $filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';
+ $filename = dirname(__FILE__).DIRECTORY_SEPARATOR.$classname.'.php';
if (is_readable($filename)) {
require $filename;
}
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/badges/quality-score.png?s=3758e21d279becdf847a557a56a3ed16dfec9d5d)](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/)
[![Code Coverage](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/badges/coverage.png?s=3fe6ca5fe8cd2cdf96285756e42932f7ca256962)](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/)
-[![Latest Stable Version](https://poser.pugx.org/phpmailer/phpmailer/v/stable.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![Total Downloads](https://poser.pugx.org/phpmailer/phpmailer/downloads)](https://packagist.org/packages/phpmailer/phpmailer) [![Latest Unstable Version](https://poser.pugx.org/phpmailer/phpmailer/v/unstable.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![License](https://poser.pugx.org/phpmailer/phpmailer/license.svg)](https://packagist.org/packages/phpmailer/phpmailer)
+[![Latest Stable Version](https://poser.pugx.org/phpmailer/phpmailer/v/stable.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![Total Downloads](https://poser.pugx.org/phpmailer/phpmailer/downloads)](https://packagist.org/packages/phpmailer/phpmailer) [![Latest Unstable Version](https://poser.pugx.org/phpmailer/phpmailer/v/unstable.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![License](https://poser.pugx.org/phpmailer/phpmailer/license.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![API Docs](https://github.com/phpmailer/phpmailer/workflows/Docs/badge.svg)](http://phpmailer.github.io/PHPMailer/)
## Class Features
-
- Probably the world's most popular code for sending email from PHP!
- Used by many open-source projects: WordPress, Drupal, 1CRM, SugarCRM, Yii, Joomla! and many more
- Integrated SMTP support - send without a local mail server
-- Send emails with multiple TOs, CCs, BCCs and REPLY-TOs
+- Send emails with multiple To, CC, BCC and Reply-to addresses
- Multipart/alternative emails for mail clients that do not read HTML email
+- Add attachments, including inline
- Support for UTF-8 content and 8bit, base64, binary, and quoted-printable encodings
-- SMTP authentication with LOGIN, PLAIN, NTLM, CRAM-MD5 and Google's XOAUTH2 mechanisms over SSL and TLS transports
-- Error messages in 47 languages!
+- SMTP authentication with LOGIN, PLAIN, CRAM-MD5, and XOAUTH2 mechanisms over SSL and SMTP+STARTTLS transports
+- Validates email addresses automatically
+- Protect against header injection attacks
+- Error messages in over 50 languages!
- DKIM and S/MIME signing support
-- Compatible with PHP 5.0 and later
+- Compatible with PHP 5.5 and later
+- Namespaced to prevent name clashes
- Much more!
## Why you might need it
+Many PHP developers need to send email from their code. The only PHP function that supports this is [`mail()`](https://www.php.net/manual/en/function.mail.php). However, it does not provide any assistance for making use of popular features such as encryption, authentication, HTML messages, and attachments.
-Many PHP developers utilize email in their code. The only PHP function that supports this is the `mail()` function. However, it does not provide any assistance for making use of popular features such as HTML-based emails and attachments.
-
-Formatting email correctly is surprisingly difficult. There are myriad overlapping RFCs, requiring tight adherence to horribly complicated formatting and encoding rules - the vast majority of code that you'll find online that uses the `mail()` function directly is just plain wrong!
-*Please* don't be tempted to do it yourself - if you don't use PHPMailer, there are many other excellent libraries that you should look at before rolling your own - try SwiftMailer, Zend_Mail, eZcomponents etc.
+Formatting email correctly is surprisingly difficult. There are myriad overlapping RFCs, requiring tight adherence to horribly complicated formatting and encoding rules – the vast majority of code that you'll find online that uses the `mail()` function directly is just plain wrong!
+*Please* don't be tempted to do it yourself – if you don't use PHPMailer, there are many other excellent libraries that you should look at before rolling your own. Try [SwiftMailer](https://swiftmailer.symfony.com/), [Zend/Mail](https://zendframework.github.io/zend-mail/), [ZetaComponents](https://github.com/zetacomponents/Mail) etc.
-The PHP `mail()` function usually sends via a local mail server, typically fronted by a `sendmail` binary on Linux, BSD and OS X platforms, however, Windows usually doesn't include a local mail server; PHPMailer's integrated SMTP implementation allows email sending on Windows platforms without a local mail server.
+The PHP `mail()` function usually sends via a local mail server, typically fronted by a `sendmail` binary on Linux, BSD, and macOS platforms, however, Windows usually doesn't include a local mail server; PHPMailer's integrated SMTP implementation allows email sending on Windows platforms without a local mail server.
## License
-
-This software is distributed under the [LGPL 2.1](http://www.gnu.org/licenses/lgpl-2.1.html) license. Please read LICENSE for information on the
-software availability and distribution.
+This software is distributed under the [LGPL 2.1](http://www.gnu.org/licenses/lgpl-2.1.html) license, along with the [GPL Cooperation Commitment](https://gplcc.github.io/gplcc/). Please read LICENSE for information on the software availability and distribution.
## Installation & loading
-
-PHPMailer is available via [Composer/Packagist](https://packagist.org/packages/phpmailer/phpmailer) (using semantic versioning), so just add this line to your `composer.json` file:
+PHPMailer is available on [Packagist](https://packagist.org/packages/phpmailer/phpmailer) (using semantic versioning), and installation via [Composer](https://getcomposer.org) is the recommended way to install PHPMailer. Just add this line to your `composer.json` file:
```json
-"phpmailer/phpmailer": "~5.2"
+"phpmailer/phpmailer": "~6.1"
```
-or
+or run
```sh
composer require phpmailer/phpmailer
```
-If you want to use the Gmail XOAUTH2 authentication class, you will also need to add a dependency on the `league/oauth2-client` package.
+Note that the `vendor` folder and the `vendor/autoload.php` script are generated by Composer; they are not part of PHPMailer.
+
+If you want to use the Gmail XOAUTH2 authentication class, you will also need to add a dependency on the `league/oauth2-client` package in your `composer.json`.
-Alternatively, copy the contents of the PHPMailer folder into one of the `include_path` directories specified in your PHP configuration. If you don't speak git or just want a tarball, click the 'zip' button at the top of the page in GitHub.
+Alternatively, if you're not using Composer, copy the contents of the PHPMailer folder into one of the `include_path` directories specified in your PHP configuration and load each class file manually:
-If you're not using composer's autoloader, PHPMailer provides an SPL-compatible autoloader, and that is the preferred way of loading the library - just `require '/path/to/PHPMailerAutoload.php';` and everything should work. The autoloader does not throw errors if it can't find classes so it prepends itself to the SPL list, allowing your own (or your framework's) autoloader to catch errors. SPL autoloading was introduced in PHP 5.1.0, so if you are using a version older than that you will need to require/include each class manually.
+```php
+<?php
+use PHPMailer\PHPMailer\PHPMailer;
+use PHPMailer\PHPMailer\Exception;
-PHPMailer does *not* declare a namespace because namespaces were only introduced in PHP 5.3.
+require 'path/to/PHPMailer/src/Exception.php';
+require 'path/to/PHPMailer/src/PHPMailer.php';
+require 'path/to/PHPMailer/src/SMTP.php';
+```
-If you want to use Google's XOAUTH2 authentication mechanism, you need to be running at least PHP 5.4, and load the dependencies listed in `composer.json`.
+If you're not using the `SMTP` class explicitly (you're probably not), you don't need a `use` line for the SMTP class.
-### Minimal installation
+If you don't speak git or just want a tarball, click the 'zip' button on the right of the project page in GitHub, though note that docs and examples are not included in the tarball.
+
+## Legacy versions
+PHPMailer 5.2 (which is compatible with PHP 5.0 - 7.0) is no longer being supported, even for security updates. You will find the latest version of 5.2 in the [5.2-stable branch](https://github.com/PHPMailer/PHPMailer/tree/5.2-stable). If you're using PHP 5.5 or later (which you should be), switch to the 6.x releases.
-While installing the entire package manually or with composer is simple, convenient and reliable, you may want to include only vital files in your project. At the very least you will need [class.phpmailer.php](https://github.com/PHPMailer/PHPMailer/tree/master/class.phpmailer.php). If you're using SMTP, you'll need [class.smtp.php](https://github.com/PHPMailer/PHPMailer/tree/master/class.smtp.php), and if you're using POP-before SMTP, you'll need [class.pop3.php](https://github.com/PHPMailer/PHPMailer/tree/master/class.pop3.php). For all of these, we recommend you use [the autoloader](https://github.com/PHPMailer/PHPMailer/tree/master/PHPMailerAutoload.php) too as otherwise you will either have to `require` all classes manually or use some other autoloader. You can skip the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder if you're not showing errors to users and can make do with English-only errors. You may need the additional classes in the [extras](extras/) folder if you are using those features, including NTLM authentication and ics generation. If you're using Google XOAUTH2 you will need `class.phpmaileroauth.php` and `class.oauth.php` classes too, as well as the composer dependencies.
+### Upgrading from 5.2
+The biggest changes are that source files are now in the `src/` folder, and PHPMailer now declares the namespace `PHPMailer\PHPMailer`. This has several important effects – [read the upgrade guide](https://github.com/PHPMailer/PHPMailer/tree/master/UPGRADING.md) for more details.
+
+### Minimal installation
+While installing the entire package manually or with Composer is simple, convenient, and reliable, you may want to include only vital files in your project. At the very least you will need [src/PHPMailer.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/PHPMailer.php). If you're using SMTP, you'll need [src/SMTP.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/SMTP.php), and if you're using POP-before SMTP, you'll need [src/POP3.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/POP3.php). You can skip the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder if you're not showing errors to users and can make do with English-only errors. If you're using XOAUTH2 you will need [src/OAuth.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/OAuth.php) as well as the Composer dependencies for the services you wish to authenticate with. Really, it's much easier to use Composer!
## A Simple Example
```php
<?php
-require 'PHPMailerAutoload.php';
-
-$mail = new PHPMailer;
-
-//$mail->SMTPDebug = 3; // Enable verbose debug output
-
-$mail->isSMTP(); // Set mailer to use SMTP
-$mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers
-$mail->SMTPAuth = true; // Enable SMTP authentication
-$mail->Username = 'user@example.com'; // SMTP username
-$mail->Password = 'secret'; // SMTP password
-$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
-$mail->Port = 587; // TCP port to connect to
-
-$mail->setFrom('from@example.com', 'Mailer');
-$mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient
-$mail->addAddress('ellen@example.com'); // Name is optional
-$mail->addReplyTo('info@example.com', 'Information');
-$mail->addCC('cc@example.com');
-$mail->addBCC('bcc@example.com');
-
-$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
-$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
-$mail->isHTML(true); // Set email format to HTML
-
-$mail->Subject = 'Here is the subject';
-$mail->Body = 'This is the HTML message body <b>in bold!</b>';
-$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
-
-if(!$mail->send()) {
- echo 'Message could not be sent.';
- echo 'Mailer Error: ' . $mail->ErrorInfo;
-} else {
+// Import PHPMailer classes into the global namespace
+// These must be at the top of your script, not inside a function
+use PHPMailer\PHPMailer\PHPMailer;
+use PHPMailer\PHPMailer\SMTP;
+use PHPMailer\PHPMailer\Exception;
+
+// Load Composer's autoloader
+require 'vendor/autoload.php';
+
+// Instantiation and passing `true` enables exceptions
+$mail = new PHPMailer(true);
+
+try {
+ //Server settings
+ $mail->SMTPDebug = SMTP::DEBUG_SERVER; // Enable verbose debug output
+ $mail->isSMTP(); // Send using SMTP
+ $mail->Host = 'smtp1.example.com'; // Set the SMTP server to send through
+ $mail->SMTPAuth = true; // Enable SMTP authentication
+ $mail->Username = 'user@example.com'; // SMTP username
+ $mail->Password = 'secret'; // SMTP password
+ $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` also accepted
+ $mail->Port = 587; // TCP port to connect to
+
+ //Recipients
+ $mail->setFrom('from@example.com', 'Mailer');
+ $mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient
+ $mail->addAddress('ellen@example.com'); // Name is optional
+ $mail->addReplyTo('info@example.com', 'Information');
+ $mail->addCC('cc@example.com');
+ $mail->addBCC('bcc@example.com');
+
+ // Attachments
+ $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
+ $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
+
+ // Content
+ $mail->isHTML(true); // Set email format to HTML
+ $mail->Subject = 'Here is the subject';
+ $mail->Body = 'This is the HTML message body <b>in bold!</b>';
+ $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
+
+ $mail->send();
echo 'Message has been sent';
+} catch (Exception $e) {
+ echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
```
You'll find plenty more to play with in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder.
+If you are re-using the instance (e.g. when sending to a mailing list), you may need to clear the recipient list to avoid sending duplicate messages. See [the mailing list example](https://github.com/PHPMailer/PHPMailer/blob/master/examples/mailing_list.phps) for further guidance.
+
That's it. You should now be ready to use PHPMailer!
## Localization
-PHPMailer defaults to English, but in the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder you'll find numerous (46 at the time of writing!) translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this:
+PHPMailer defaults to English, but in the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder you'll find many translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this:
```php
// To load the French version
$mail->setLanguage('fr', '/optional/path/to/language/directory/');
```
-We welcome corrections and new languages - if you're looking for corrections to do, run the [phpmailerLangTest.php](https://github.com/PHPMailer/PHPMailer/tree/master/test/phpmailerLangTest.php) script in the tests folder and it will show any missing translations.
+We welcome corrections and new languages - if you're looking for corrections to do, run the [PHPMailerLangTest.php](https://github.com/PHPMailer/PHPMailer/tree/master/test/PHPMailerLangTest.php) script in the tests folder and it will show any missing translations.
## Documentation
+Start reading at the [GitHub wiki](https://github.com/PHPMailer/PHPMailer/wiki). If you're having trouble, this should be the first place you look as it's the most frequently updated.
Examples of how to use PHPMailer for common scenarios can be found in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder. If you're looking for a good starting point, we recommend you start with [the Gmail example](https://github.com/PHPMailer/PHPMailer/tree/master/examples/gmail.phps).
-There are tips and a troubleshooting guide in the [GitHub wiki](https://github.com/PHPMailer/PHPMailer/wiki). If you're having trouble, this should be the first place you look as it's the most frequently updated.
+Note that in order to reduce PHPMailer's deployed code footprint, the examples are no longer included if you load PHPMailer via Composer or via [GitHub's zip file download](https://github.com/PHPMailer/PHPMailer/archive/master.zip), so you'll need to either clone the git repository or use the above links to get to the examples directly.
Complete generated API documentation is [available online](http://phpmailer.github.io/PHPMailer/).
-You'll find some basic user-level docs in the [docs](docs/) folder, and you can generate complete API-level documentation using the [generatedocs.sh](https://github.com/PHPMailer/PHPMailer/tree/master/docs/generatedocs.sh) shell script in the docs folder, though you'll need to install [PHPDocumentor](http://www.phpdoc.org) first. You may find [the unit tests](https://github.com/PHPMailer/PHPMailer/tree/master/test/phpmailerTest.php) a good source of how to do various operations such as encryption.
+You can generate complete API-level documentation by running `phpdoc` in the top-level folder, and documentation will appear in the `docs` folder, though you'll need to have [PHPDocumentor](http://www.phpdoc.org) installed. You may find [the unit tests](https://github.com/PHPMailer/PHPMailer/blob/master/test/PHPMailerTest.php) a good source of how to do various operations such as encryption.
If the documentation doesn't cover what you need, search the [many questions on Stack Overflow](http://stackoverflow.com/questions/tagged/phpmailer), and before you ask a question about "SMTP Error: Could not connect to SMTP host.", [read the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting).
## Tests
-
-There is a PHPUnit test script in the [test](https://github.com/PHPMailer/PHPMailer/tree/master/test/) folder.
+There is a PHPUnit test script in the [test](https://github.com/PHPMailer/PHPMailer/tree/master/test/) folder. PHPMailer uses PHPUnit 4.8 - we would use 5.x but we need to run on PHP 5.5.
Build status: [![Build Status](https://travis-ci.org/PHPMailer/PHPMailer.svg)](https://travis-ci.org/PHPMailer/PHPMailer)
If this isn't passing, is there something you can do to help?
## Security
-
Please disclose any vulnerabilities found responsibly - report any security problems found to the maintainers privately.
-PHPMailer versions prior to 5.2.14 (released November 2015) are vulnerable to [CVE-2015-8476](https://web.nvd.nist.gov/view/vuln/detail?vulnId=) an SMTP CRLF injection bug permitting arbitrary message sending.
+PHPMailer versions prior to 5.2.22 (released January 9th 2017) have a local file disclosure vulnerability, [CVE-2017-5223](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-5223). If content passed into `msgHTML()` is sourced from unfiltered user input, relative paths can map to absolute local file paths and added as attachments. Also note that `addAttachment` (just like `file_get_contents`, `passthru`, `unlink`, etc) should not be passed user-sourced params either! Reported by Yongxiang Li of Asiasecurity.
-PHPMailer versions prior to 5.2.10 (released May 2015) are vulnerable to [CVE-2008-5619](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-5619), a remote code execution vulnerability in the bundled html2text library. This file was removed in 5.2.10, so if you are using a version prior to that and make use of the html2text function, it's vitally important that you upgrade and remove this file.
+PHPMailer versions prior to 5.2.20 (released December 28th 2016) are vulnerable to [CVE-2016-10045](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10045) a remote code execution vulnerability, responsibly reported by [Dawid Golunski](https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10045-Vuln-Patch-Bypass.html), and patched by Paul Buonopane (@Zenexer).
-See [SECURITY](https://github.com/PHPMailer/PHPMailer/tree/master/SECURITY) for older security issues.
+PHPMailer versions prior to 5.2.18 (released December 2016) are vulnerable to [CVE-2016-10033](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10033) a critical remote code execution vulnerability, responsibly reported by [Dawid Golunski](http://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10033-Vuln.html).
-## Contributing
+See [SECURITY](https://github.com/PHPMailer/PHPMailer/tree/master/SECURITY.md) for more detail on security issues.
+## Contributing
Please submit bug reports, suggestions and pull requests to the [GitHub issue tracker](https://github.com/PHPMailer/PHPMailer/issues).
We're particularly interested in fixing edge-cases, expanding test coverage and updating translations.
-With the move to the PHPMailer GitHub organisation, you'll need to update any remote URLs referencing the old GitHub location with a command like this from within your clone:
+If you found a mistake in the docs, or want to add something, go ahead and amend the wiki - anyone can edit it.
+
+If you have git clones from prior to the move to the PHPMailer GitHub organisation, you'll need to update any remote URLs referencing the old GitHub location with a command like this from within your clone:
```sh
git remote set-url upstream https://github.com/PHPMailer/PHPMailer.git
```
-Please *don't* use the SourceForge or Google Code projects any more.
+Please *don't* use the SourceForge or Google Code projects any more; they are obsolete and no longer maintained.
## Sponsorship
-
Development time and resources for PHPMailer are provided by [Smartmessages.net](https://info.smartmessages.net/), a powerful email marketing system.
<a href="https://info.smartmessages.net/"><img src="https://www.smartmessages.net/img/smartmessages-logo.svg" width="250" height="28" alt="Smartmessages email marketing"></a>
-Other contributions are gladly received, whether in beer 🍺, T-shirts 👕, Amazon wishlist raids, or cold, hard cash 💰.
+Other contributions are gladly received, whether in beer 🍺, T-shirts 👕, Amazon wishlist raids, or cold, hard cash 💰. If you'd like to donate to say "thank you" to maintainers or contributors, please contact them through individual profile pages via [the contributors page](https://github.com/PHPMailer/PHPMailer/graphs/contributors).
## Changelog
-
See [changelog](changelog.md).
## History
- PHPMailer was originally written in 2001 by Brent R. Matzelle as a [SourceForge project](http://sourceforge.net/projects/phpmailer/).
- Marcus Bointon (coolbru on SF) and Andy Prevost (codeworxtech) took over the project in 2004.
- Became an Apache incubator project on Google Code in 2010, managed by Jim Jagielski.
-- Marcus created his fork on [GitHub](https://github.com/Synchro/PHPMailer).
-- Jim and Marcus decide to join forces and use GitHub as the canonical and official repo for PHPMailer.
-- PHPMailer moves to the [PHPMailer organisation](https://github.com/PHPMailer) on GitHub.
+- Marcus created his fork on [GitHub](https://github.com/Synchro/PHPMailer) in 2008.
+- Jim and Marcus decide to join forces and use GitHub as the canonical and official repo for PHPMailer in 2013.
+- PHPMailer moves to the [PHPMailer organisation](https://github.com/PHPMailer) on GitHub in 2013.
### What's changed since moving from SourceForge?
- Official successor to the SourceForge and Google Code projects.
+++ /dev/null
-# Security notices relating to PHPMailer
-
-Please disclose any vulnerabilities found responsibly - report any security problems found to the maintainers privately.
-
-PHPMailer versions prior to 5.2.14 (released November 2015) are vulnerable to [CVE-2015-8476](https://web.nvd.nist.gov/view/vuln/detail?vulnId=) an SMTP CRLF injection bug permitting arbitrary message sending.
-
-PHPMailer versions prior to 5.2.10 (released May 2015) are vulnerable to [CVE-2008-5619](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-5619), a remote code execution vulnerability in the bundled html2text library. This file was removed in 5.2.10, so if you are using a version prior to that and make use of the html2text function, it's vitally important that you upgrade and remove this file.
-
-PHPMailer versions prior to 2.0.7 and 2.2.1 are vulnerable to [CVE-2012-0796](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2012-0796), an email header injection attack.
-
-Joomla 1.6.0 uses PHPMailer in an unsafe way, allowing it to reveal local file paths, reported in [CVE-2011-3747](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2011-3747).
-
-PHPMailer didn't sanitise the `$lang_path` parameter in `SetLanguage`. This wasn't a problem in itself, but some apps (PHPClassifieds, ATutor) also failed to sanitise user-provided parameters passed to it, permitting semi-arbitrary local file inclusion, reported in [CVE-2010-4914](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-4914), [CVE-2007-2021](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-2021) and [CVE-2006-5734](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2006-5734).
-
-PHPMailer 1.7.2 and earlier contained a possible DDoS vulnerability reported in [CVE-2005-1807](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2005-1807).
-
-PHPMailer 1.7 and earlier (June 2003) have a possible vulnerability in the `SendmailSend` method where shell commands may not be sanitised. Reported in [CVE-2007-3215](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-3215).
-
--- /dev/null
+# Security notices relating to PHPMailer
+
+Please disclose any vulnerabilities found responsibly - report any security problems found to the maintainers privately.
+
+PHPMailer versions prior to 6.0.6 and 5.2.27 are vulnerable to an object injection attack by passing `phar://` paths into `addAttachment()` and other functions that may receive unfiltered local paths, possibly leading to RCE. Recorded as [CVE-2018-19296](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2018-19296). See [this article](https://knasmueller.net/5-answers-about-php-phar-exploitation) for more info on this type of vulnerability. Mitigated by blocking the use of paths containing URL-protocol style prefixes such as `phar://`. Reported by Sehun Oh of cyberone.kr.
+
+PHPMailer versions prior to 5.2.24 (released July 26th 2017) have an XSS vulnerability in one of the code examples, [CVE-2017-11503](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-11503). The `code_generator.phps` example did not filter user input prior to output. This file is distributed with a `.phps` extension, so it it not normally executable unless it is explicitly renamed, and the file is not included when PHPMailer is loaded through composer, so it is safe by default. There was also an undisclosed potential XSS vulnerability in the default exception handler (unused by default). Patches for both issues kindly provided by Patrick Monnerat of the Fedora Project.
+
+PHPMailer versions prior to 5.2.22 (released January 9th 2017) have a local file disclosure vulnerability, [CVE-2017-5223](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-5223). If content passed into `msgHTML()` is sourced from unfiltered user input, relative paths can map to absolute local file paths and added as attachments. Also note that `addAttachment` (just like `file_get_contents`, `passthru`, `unlink`, etc) should not be passed user-sourced params either! Reported by Yongxiang Li of Asiasecurity.
+
+PHPMailer versions prior to 5.2.20 (released December 28th 2016) are vulnerable to [CVE-2016-10045](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10045) a remote code execution vulnerability, responsibly reported by [Dawid Golunski](https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10045-Vuln-Patch-Bypass.html), and patched by Paul Buonopane (@Zenexer).
+
+PHPMailer versions prior to 5.2.18 (released December 2016) are vulnerable to [CVE-2016-10033](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10033) a remote code execution vulnerability, responsibly reported by [Dawid Golunski](http://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10033-Vuln.html).
+
+PHPMailer versions prior to 5.2.14 (released November 2015) are vulnerable to [CVE-2015-8476](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2015-8476) an SMTP CRLF injection bug permitting arbitrary message sending.
+
+PHPMailer versions prior to 5.2.10 (released May 2015) are vulnerable to [CVE-2008-5619](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-5619), a remote code execution vulnerability in the bundled html2text library. This file was removed in 5.2.10, so if you are using a version prior to that and make use of the html2text function, it's vitally important that you upgrade and remove this file.
+
+PHPMailer versions prior to 2.0.7 and 2.2.1 are vulnerable to [CVE-2012-0796](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2012-0796), an email header injection attack.
+
+Joomla 1.6.0 uses PHPMailer in an unsafe way, allowing it to reveal local file paths, reported in [CVE-2011-3747](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2011-3747).
+
+PHPMailer didn't sanitise the `$lang_path` parameter in `SetLanguage`. This wasn't a problem in itself, but some apps (PHPClassifieds, ATutor) also failed to sanitise user-provided parameters passed to it, permitting semi-arbitrary local file inclusion, reported in [CVE-2010-4914](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-4914), [CVE-2007-2021](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-2021) and [CVE-2006-5734](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2006-5734).
+
+PHPMailer 1.7.2 and earlier contained a possible DDoS vulnerability reported in [CVE-2005-1807](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2005-1807).
+
+PHPMailer 1.7 and earlier (June 2003) have a possible vulnerability in the `SendmailSend` method where shell commands may not be sanitised. Reported in [CVE-2007-3215](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-3215).
+
-5.2.16
\ No newline at end of file
+6.1.4
\ No newline at end of file
+++ /dev/null
-# ChangeLog
-
-## Version 5.2.16 (June 6th 2016)
-* Added DKIM example
-* Fixed empty additional_parameters problem
-* Fixed wrong version number in VERSION file!
-* Improve line-length tests
-* Use instance settings for SMTP::connect by default
-* Use more secure auth mechanisms first
-
-## Version 5.2.15 (May 10th 2016)
-* Added ability to inject custom address validators, and set the default validator
-* Fix TLS 1.2 compatibility
-* Remove some excess line breaks in MIME structure
-* Updated Polish, Russian, Brazilian Portuguese, Georgian translations
-* More DRY!
-* Improve error messages
-* Update dependencies
-* Add example showing how to handle multiple form file uploads
-* Improve SMTP example
-* Improve Windows compatibility
-* Use consistent names for temp files
-* Fix gmail XOAUTH2 scope, thanks to @sherryl4george
-* Fix extra line break in getSentMIMEMessage()
-* Improve DKIM signing to use SHA-2
-
-## Version 5.2.14 (Nov 1st 2015)
-* Allow addresses with IDN (Internationalized Domain Name) in PHP 5.3+, thanks to @fbonzon
-* Allow access to POP3 errors
-* Make all POP3 private properties and methods protected
-* **SECURITY** Fix vulnerability that allowed email addresses with line breaks (valid in RFC5322) to pass to SMTP, permitting message injection at the SMTP level. Mitigated in both the address validator and in the lower-level SMTP class. Thanks to Takeshi Terada.
-* Updated Brazilian Portuguese translations (Thanks to @phelipealves)
-
-## Version 5.2.13 (Sep 14th 2015)
-* Rename internal oauth class to avoid name clashes
-* Improve Estonian translations
-
-## Version 5.2.12 (Sep 1st 2015)
-* Fix incorrect composer package dependencies
-* Skip existing embedded image `cid`s in `msgHTML`
-
-## Version 5.2.11 (Aug 31st 2015)
-* Don't switch to quoted-printable for long lines if already using base64
-* Fixed Travis-CI config when run on PHP 7
-* Added Google XOAUTH2 authentication mechanism, thanks to @sherryl4george
-* Add address parser for RFC822-format addresses
-* Update MS Office MIME types
-* Don't convert line breaks when using quoted-printable encoding
-* Handle MS Exchange returning an invalid empty AUTH-type list in EHLO
-* Don't set name or filename properties on MIME parts that don't have one
-
-## Version 5.2.10 (May 4th 2015)
-* Add custom header getter
-* Use `application/javascript` for .js attachments
-* Improve RFC2821 compliance for timelimits, especially for end-of-data
-* Add Azerbaijani translations (Thanks to @mirjalal)
-* Minor code cleanup for robustness
-* Add Indonesian translations (Thanks to @ceceprawiro)
-* Avoid `error_log` Debugoutput naming clash
-* Add ability to parse server capabilities in response to EHLO (useful for SendGrid etc)
-* Amended default values for WordWrap to match RFC
-* Remove html2text converter class (has incompatible license)
-* Provide new mechanism for injecting html to text converters
-* Improve pointers to docs and support in README
-* Add example file upload script
-* Refactor and major cleanup of EasyPeasyICS, now a lot more usable
-* Make set() method simpler and more reliable
-* Add Malay translation (Thanks to @nawawi)
-* Add Bulgarian translation (Thanks to @mialy)
-* Add Armenian translation (Thanks to Hrayr Grigoryan)
-* Add Slovenian translation (Thanks to Klemen Tušar)
-* More efficient word wrapping
-* Add support for S/MIME signing with additional CA certificate (thanks to @IgitBuh)
-* Fix incorrect MIME structure when using S/MIME signing and isMail() (#372)
-* Improved checks and error messages for missing extensions
-* Store and report SMTP errors more consistently
-* Add MIME multipart preamble for better Outlook compatibility
-* Enable TLS encryption automatically if the server offers it
-* Provide detailed errors when individual recipients fail
-* Report more errors when connecting
-* Add extras classes to composer classmap
-* Expose stream_context_create options via new SMTPOptions property
-* Automatic encoding switch to quoted-printable if message lines are too long
-* Add Korean translation (Thanks to @ChalkPE)
-* Provide a pointer to troubleshooting docs on SMTP connection failure
-
-## Version 5.2.9 (Sept 25th 2014)
-* **Important: The autoloader is no longer autoloaded by the PHPMailer class**
-* Update html2text from https://github.com/mtibben/html2text
-* Improve Arabic translations (Thanks to @tarekdj)
-* Consistent handling of connection variables in SMTP and POP3
-* PHPDoc cleanup
-* Update composer to use PHPUnit 4.1
-* Pass consistent params to callbacks
-* More consistent handling of error states and debug output
-* Use property defaults, remove constructors
-* Remove unreachable code
-* Use older regex validation pattern for troublesome PCRE library versions
-* Improve PCRE detection in older PHP versions
-* Handle debug output consistently, and always in UTF-8
-* Allow user-defined debug output method via a callable
-* msgHTML now converts data URIs to embedded images
-* SMTP::getLastReply() will now always be populated
-* Improved example code in README
-* Ensure long filenames in Content-Disposition are encoded correctly
-* Simplify SMTP debug output mechanism, clarify levels with constants
-* Add SMTP connection check example
-* Simplify examples, don't use mysql* functions
-
-## Version 5.2.8 (May 14th 2014)
-* Increase timeout to match RFC2821 section 4.5.3.2 and thus not fail greetdelays, fixes #104
-* Add timestamps to default debug output
-* Add connection events and new level 3 to debug output options
-* Chinese language update (Thanks to @binaryoung)
-* Allow custom Mailer types (Thanks to @michield)
-* Cope with spaces around SMTP host specs
-* Fix processing of multiple hosts in connect string
-* Added Galician translation (Thanks to @donatorouco)
-* Autoloader now prepends
-* Docs updates
-* Add Latvian translation (Thanks to @eddsstudio)
-* Add Belarusian translation (Thanks to @amaksymiuk)
-* Make autoloader work better on older PHP versions
-* Avoid double-encoding if mbstring is overloading mail()
-* Add Portuguese translation (Thanks to @Jonadabe)
-* Make quoted-printable encoder respect line ending setting
-* Improve Chinese translation (Thanks to @PeterDaveHello)
-* Add Georgian translation (Thanks to @akalongman)
-* Add Greek translation (Thanks to @lenasterg)
-* Fix serverHostname on PHP < 5.3
-* Improve performance of SMTP class
-* Implement automatic 7bit downgrade
-* Add Vietnamese translation (Thanks to @vinades)
-* Improve example images, switch to PNG
-* Add Croatian translation (Thanks to @hrvoj3e)
-* Remove setting the Return-Path and deprecate the Return-path property - it's just wrong!
-* Fix language file loading if CWD has changed (@stephandesouza)
-* Add HTML5 email validation pattern
-* Improve Turkish translations (Thanks to @yasinaydin)
-* Improve Romanian translations (Thanks to @aflorea)
-* Check php.ini for path to sendmail/qmail before using default
-* Improve Farsi translation (Thanks to @MHM5000)
-* Don't use quoted-printable encoding for multipart types
-* Add Serbian translation (Thanks to ajevremovic at gmail.com)
-* Remove useless PHP5 check
-* Use SVG for build status badges
-* Store MessageDate on creation
-* Better default behaviour for validateAddress
-
-## Version 5.2.7 (September 12th 2013)
-* Add Ukrainian translation from @Krezalis
-* Support for do_verp
-* Fix bug in CRAM-MD5 AUTH
-* Propagate Debugoutput option to SMTP class (@Reblutus)
-* Determine MIME type of attachments automatically
-* Add cross-platform, multibyte-safe pathinfo replacement (with tests) and use it
-* Add a new 'html' Debugoutput type
-* Clean up SMTP debug output, remove embedded HTML
-* Some small changes in header formatting to improve IETF msglint test results
-* Update test_script to use some recently changed features, rename to code_generator
-* Generated code actually works!
-* Update SyntaxHighlighter
-* Major overhaul and cleanup of example code
-* New PHPMailer graphic
-* msgHTML now uses RFC2392-compliant content ids
-* Add line break normalization function and use it in msgHTML
-* Don't set unnecessary reply-to addresses
-* Make fakesendmail.sh a bit cleaner and safer
-* Set a content-transfer-encoding on multiparts (fixes msglint error)
-* Fix cid generation in msgHTML (Thanks to @digitalthought)
-* Fix handling of multiple SMTP servers (Thanks to @NanoCaiordo)
-* SMTP->connect() now supports stream context options (Thanks to @stanislavdavid)
-* Add support for iCal event alternatives (Thanks to @reblutus)
-* Update to Polish language file (Thanks to Krzysztof Kowalewski)
-* Update to Norwegian language file (Thanks to @datagutten)
-* Update to Hungarian language file (Thanks to @dominicus-75)
-* Add Persian/Farsi translation from @jaii
-* Make SMTPDebug property type match type in SMTP class
-* Add unit tests for DKIM
-* Major refactor of SMTP class
-* Reformat to PSR-2 coding standard
-* Introduce autoloader
-* Allow overriding of SMTP class
-* Overhaul of PHPDocs
-* Fix broken Q-encoding
-* Czech language update (Thanks to @nemelu)
-* Removal of excess blank lines in messages
-* Added fake POP server and unit tests for POP-before-SMTP
-
-## Version 5.2.6 (April 11th 2013)
-* Reflect move to PHPMailer GitHub organisation at https://github.com/PHPMailer/PHPMailer
-* Fix unbumped version numbers
-* Update packagist.org with new location
-* Clean up Changelog
-
-## Version 5.2.5 (April 6th 2013)
-* First official release after move from Google Code
-* Fixes for qmail when sending via mail()
-* Merge in changes from Google code 5.2.4 release
-* Minor coding standards cleanup in SMTP class
-* Improved unit tests, now tests S/MIME signing
-* Travis-CI support on GitHub, runs tests with fake SMTP server
-
-## Version 5.2.4 (February 19, 2013)
-* Fix tag and version bug.
-* un-deprecate isSMTP(), isMail(), IsSendmail() and isQmail().
-* Numerous translation updates
-
-## Version 5.2.3 (February 8, 2013)
-* Fix issue with older PCREs and ValidateAddress() (Bugz: 124)
-* Add CRAM-MD5 authentication, thanks to Elijah madden, https://github.com/okonomiyaki3000
-* Replacement of obsolete Quoted-Printable encoder with a much better implementation
-* Composer package definition
-* New language added: Hebrew
-
-## Version 5.2.2 (December 3, 2012)
-* Some fixes and syncs from https://github.com/Synchro/PHPMailer
-* Add Slovak translation, thanks to Michal Tinka
-
-## Version 5.2.2-rc2 (November 6, 2012)
-* Fix SMTP server rotation (Bugz: 118)
-* Allow override of autogen'ed 'Date' header (for Drupal's
- og_mailinglist module)
-* No whitespace after '-f' option (Bugz: 116)
-* Work around potential warning (Bugz: 114)
-
-## Version 5.2.2-rc1 (September 28, 2012)
-* Header encoding works with long lines (Bugz: 93)
-* Turkish language update (Bugz: 94)
-* undefined $pattern in EncodeQ bug squashed (Bugz: 98)
-* use of mail() in safe_mode now works (Bugz: 96)
-* ValidateAddress() now 'public static' so people can override the
- default and use their own validation scheme.
-* ValidateAddress() no longer uses broken FILTER_VALIDATE_EMAIL
-* Added in AUTH PLAIN SMTP authentication
-
-## Version 5.2.2-beta2 (August 17, 2012)
-* Fixed Postfix VERP support (Bugz: 92)
-* Allow action_function callbacks to pass/use
- the From address (passed as final param)
-* Prevent inf look for get_lines() (Bugz: 77)
-* New public var ($UseSendmailOptions). Only pass sendmail()
- options iff we really are using sendmail or something sendmail
- compatible. (Bugz: 75)
-* default setting for LE returned to "\n" due to popular demand.
-
-## Version 5.2.2-beta1 (July 13, 2012)
-* Expose PreSend() and PostSend() as public methods to allow
- for more control if serializing message sending.
-* GetSentMIMEMessage() only constructs the message copy when
- needed. Save memory.
-* Only pass params to mail() if the underlying MTA is
- "sendmail" (as defined as "having the string sendmail
- in its pathname") [#69]
-* Attachments now work with Amazon SES and others [Bugz#70]
-* Debug output now sent to stdout (via echo) or error_log [Bugz#5]
-* New var: Debugoutput (for above) [Bugz#5]
-* SMTP reads now Timeout aware (new var: Timeout=15) [Bugz#71]
-* SMTP reads now can have a Timelimit associated with them
- (new var: Timelimit=30)[Bugz#71]
-* Fix quoting issue associated with charsets
-* default setting for LE is now RFC compliant: "\r\n"
-* Return-Path can now be user defined (new var: ReturnPath)
- (the default is "" which implies no change from previous
- behavior, which was to use either From or Sender) [Bugz#46]
-* X-Mailer header can now be disabled (by setting to a
- whitespace string, eg " ") [Bugz#66]
-* Bugz closed: #68, #60, #42, #43, #59, #55, #66, #48, #49,
- #52, #31, #41, #5. #70, #69
-
-## Version 5.2.1 (January 16, 2012)
-* Closed several bugs #5
-* Performance improvements
-* MsgHTML() now returns the message as required.
-* New method: GetSentMIMEMessage() (returns full copy of sent message)
-
-## Version 5.2 (July 19, 2011)
-* protected MIME body and header
-* better DKIM DNS Resource Record support
-* better aly handling
-* htmlfilter class added to extras
-* moved to Apache Extras
-
-## Version 5.1 (October 20, 2009)
-* fixed filename issue with AddStringAttachment (thanks to Tony)
-* fixed "SingleTo" property, now works with Senmail, Qmail, and SMTP in
- addition to PHP mail()
-* added DKIM digital signing functionality, new properties:
- - DKIM_domain (sets the domain name)
- - DKIM_private (holds DKIM private key)
- - DKIM_passphrase (holds your DKIM passphrase)
- - DKIM_selector (holds the DKIM "selector")
- - DKIM_identity (holds the identifying email address)
-* added callback function support
- - callback function parameters include:
- result, to, cc, bcc, subject and body
- - see the test/test_callback.php file for usage.
-* added "auto" identity functionality
- - can automatically add:
- - Return-path (if Sender not set)
- - Reply-To (if ReplyTo not set)
- - can be disabled:
- - $mail->SetFrom('yourname@yourdomain.com','First Last',false);
- - or by adding the $mail->Sender and/or $mail->ReplyTo properties
-
-Note: "auto" identity added to help with emails ending up in spam or junk boxes because of missing headers
-
-## Version 5.0.2 (May 24, 2009)
-* Fix for missing attachments when inline graphics are present
-* Fix for missing Cc in header when using SMTP (mail was sent,
- but not displayed in header -- Cc receiver only saw email To:
- line and no Cc line, but did get the email (To receiver
- saw same)
-
-## Version 5.0.1 (April 05, 2009)
-* Temporary fix for missing attachments
-
-## Version 5.0.0 (April 02, 2009)
-With the release of this version, we are initiating a new version numbering
-system to differentiate from the PHP4 version of PHPMailer.
-Most notable in this release is fully object oriented code.
-
-### class.smtp.php:
-* Refactored class.smtp.php to support new exception handling
-* code size reduced from 29.2 Kb to 25.6 Kb
-* Removed unnecessary functions from class.smtp.php:
- - public function Expand($name) {
- - public function Help($keyword="") {
- - public function Noop() {
- - public function Send($from) {
- - public function SendOrMail($from) {
- - public function Verify($name) {
-
-### class.phpmailer.php:
-* Refactored class.phpmailer.php with new exception handling
-* Changed processing functionality of Sendmail and Qmail so they cannot be
- inadvertently used
-* removed getFile() function, just became a simple wrapper for
- file_get_contents()
-* added check for PHP version (will gracefully exit if not at least PHP 5.0)
-* enhanced code to check if an attachment source is the same as an embedded or
- inline graphic source to eliminate duplicate attachments
-
-### New /test_script
-We have written a test script you can use to test the script as part of your
-installation. Once you press submit, the test script will send a multi-mime
-email with either the message you type in or an HTML email with an inline
-graphic. Two attachments are included in the email (one of the attachments
-is also the inline graphic so you can see that only one copy of the graphic
-is sent in the email). The test script will also display the functional
-script that you can copy/paste to your editor to duplicate the functionality.
-
-### New examples
-All new examples in both basic and advanced modes. Advanced examples show
- Exception handling.
-
-### PHPDocumentator (phpdocs) documentation for PHPMailer version 5.0.0
-All new documentation
-
-## Version 2.3 (November 06, 2008)
-* added Arabic language (many thanks to Bahjat Al Mostafa)
-* removed English language from language files and made it a default within
- class.phpmailer.php - if no language is found, it will default to use
- the english language translation
-* fixed public/private declarations
-* corrected line 1728, $basedir to $directory
-* added $sign_cert_file to avoid improper duplicate use of $sign_key_file
-* corrected $this->Hello on line 612 to $this->Helo
-* changed default of $LE to "\r\n" to comply with RFC 2822. Can be set by the user
- if default is not acceptable
-* removed trim() from return results in EncodeQP
-* /test and three files it contained are removed from version 2.3
-* fixed phpunit.php for compliance with PHP5
-* changed $this->AltBody = $textMsg; to $this->AltBody = html_entity_decode($textMsg);
-* We have removed the /phpdoc from the downloads. All documentation is now on
- the http://phpmailer.codeworxtech.com website.
-
-## Version 2.2.1 () July 19 2008
-* fixed line 1092 in class.smtp.php (my apologies, error on my part)
-
-## Version 2.2 () July 15 2008
-* Fixed redirect issue (display of UTF-8 in thank you redirect)
-* fixed error in getResponse function declaration (class.pop3.php)
-* PHPMailer now PHP6 compliant
-* fixed line 1092 in class.smtp.php (endless loop from missing = sign)
-
-## Version 2.1 (Wed, June 04 2008)
-NOTE: WE HAVE A NEW LANGUAGE VARIABLE FOR DIGITALLY SIGNED S/MIME EMAILS. IF YOU CAN HELP WITH LANGUAGES OTHER THAN ENGLISH AND SPANISH, IT WOULD BE APPRECIATED.
-
-* added S/MIME functionality (ability to digitally sign emails)
- BIG THANKS TO "sergiocambra" for posting this patch back in November 2007.
- The "Signed Emails" functionality adds the Sign method to pass the private key
- filename and the password to read it, and then email will be sent with
- content-type multipart/signed and with the digital signature attached.
-* fully compatible with E_STRICT error level
- - Please note:
- In about half the test environments this development version was subjected
- to, an error was thrown for the date() functions used (line 1565 and 1569).
- This is NOT a PHPMailer error, it is the result of an incorrectly configured
- PHP5 installation. The fix is to modify your 'php.ini' file and include the
- date.timezone = Etc/UTC (or your own zone)
- directive, to your own server timezone
- - If you do get this error, and are unable to access your php.ini file:
- In your PHP script, add
- `date_default_timezone_set('Etc/UTC');`
- - do not try to use
- `$myVar = date_default_timezone_get();`
- as a test, it will throw an error.
-* added ability to define path (mainly for embedded images)
- function `MsgHTML($message,$basedir='')` ... where:
- `$basedir` is the fully qualified path
-* fixed `MsgHTML()` function:
- - Embedded Images where images are specified by `<protocol>://` will not be altered or embedded
-* fixed the return value of SMTP exit code ( pclose )
-* addressed issue of multibyte characters in subject line and truncating
-* added ability to have user specified Message ID
- (default is still that PHPMailer create a unique Message ID)
-* corrected unidentified message type to 'application/octet-stream'
-* fixed chunk_split() multibyte issue (thanks to Colin Brown, et al).
-* added check for added attachments
-* enhanced conversion of HTML to text in MsgHTML (thanks to "brunny")
-
-## Version 2.1.0beta2 (Sun, Dec 02 2007)
-* implemented updated EncodeQP (thanks to coolbru, aka Marcus Bointon)
-* finished all testing, all known bugs corrected, enhancements tested
-
-Note: will NOT work with PHP4.
-
-Please note, this is BETA software **DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS; INTENDED STRICTLY FOR TESTING**
-
-## Version 2.1.0beta1
-Please note, this is BETA software
-** DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS
- INTENDED STRICTLY FOR TESTING
-
-## Version 2.0.0 rc2 (Fri, Nov 16 2007), interim release
-* implements new property to control VERP in class.smtp.php
- example (requires instantiating class.smtp.php):
- $mail->do_verp = true;
-* POP-before-SMTP functionality included, thanks to Richard Davey
- (see class.pop3.php & pop3_before_smtp_test.php for examples)
-* included example showing how to use PHPMailer with GMAIL
-* fixed the missing Cc in SendMail() and Mail()
-
-## Version 2.0.0 rc1 (Thu, Nov 08 2007), interim release
-* dramatically simplified using inline graphics ... it's fully automated and requires no user input
-* added automatic document type detection for attachments and pictures
-* added MsgHTML() function to replace Body tag for HTML emails
-* fixed the SendMail security issues (input validation vulnerability)
-* enhanced the AddAddresses functionality so that the "Name" portion is used in the email address
-* removed the need to use the AltBody method (set from the HTML, or default text used)
-* set the PHP Mail() function as the default (still support SendMail, SMTP Mail)
-* removed the need to set the IsHTML property (set automatically)
-* added Estonian language file by Indrek Päri
-* added header injection patch
-* added "set" method to permit users to create their own pseudo-properties like 'X-Headers', etc.
-* fixed warning message in SMTP get_lines method
-* added TLS/SSL SMTP support.
-* PHPMailer has been tested with PHP4 (4.4.7) and PHP5 (5.2.7)
-* Works with PHP installed as a module or as CGI-PHP
-NOTE: will NOT work with PHP5 in E_STRICT error mode
-
-## Version 1.73 (Sun, Jun 10 2005)
-* Fixed denial of service bug: http://www.cybsec.com/vuln/PHPMailer-DOS.pdf
-* Now has a total of 20 translations
-* Fixed alt attachments bug: http://tinyurl.com/98u9k
-
-## Version 1.72 (Wed, May 25 2004)
-* Added Dutch, Swedish, Czech, Norwegian, and Turkish translations.
-* Received: Removed this method because spam filter programs like
- SpamAssassin reject this header.
-* Fixed error count bug.
-* SetLanguage default is now "language/".
-* Fixed magic_quotes_runtime bug.
-
-## Version 1.71 (Tue, Jul 28 2003)
-* Made several speed enhancements
-* Added German and Italian translation files
-* Fixed HELO/AUTH bugs on keep-alive connects
-* Now provides an error message if language file does not load
-* Fixed attachment EOL bug
-* Updated some unclear documentation
-* Added additional tests and improved others
-
-## Version 1.70 (Mon, Jun 20 2003)
-* Added SMTP keep-alive support
-* Added IsError method for error detection
-* Added error message translation support (SetLanguage)
-* Refactored many methods to increase library performance
-* Hello now sends the newer EHLO message before HELO as per RFC 2821
-* Removed the boundary class and replaced it with GetBoundary
-* Removed queue support methods
-* New $Hostname variable
-* New Message-ID header
-* Received header reformat
-* Helo variable default changed to $Hostname
-* Removed extra spaces in Content-Type definition (#667182)
-* Return-Path should be set to Sender when set
-* Adds Q or B encoding to headers when necessary
-* quoted-encoding should now encode NULs \000
-* Fixed encoding of body/AltBody (#553370)
-* Adds "To: undisclosed-recipients:;" when all recipients are hidden (BCC)
-* Multiple bug fixes
-
-## Version 1.65 (Fri, Aug 09 2002)
-* Fixed non-visible attachment bug (#585097) for Outlook
-* SMTP connections are now closed after each transaction
-* Fixed SMTP::Expand return value
-* Converted SMTP class documentation to phpDocumentor format
-
-## Version 1.62 (Wed, Jun 26 2002)
-* Fixed multi-attach bug
-* Set proper word wrapping
-* Reduced memory use with attachments
-* Added more debugging
-* Changed documentation to phpDocumentor format
-
-## Version 1.60 (Sat, Mar 30 2002)
-* Sendmail pipe and address patch (Christian Holtje)
-* Added embedded image and read confirmation support (A. Ognio)
-* Added unit tests
-* Added SMTP timeout support (*nix only)
-* Added possibly temporary PluginDir variable for SMTP class
-* Added LE message line ending variable
-* Refactored boundary and attachment code
-* Eliminated SMTP class warnings
-* Added SendToQueue method for future queuing support
-
-## Version 1.54 (Wed, Dec 19 2001)
-* Add some queuing support code
-* Fixed a pesky multi/alt bug
-* Messages are no longer forced to have "To" addresses
-
-## Version 1.50 (Thu, Nov 08 2001)
-* Fix extra lines when not using SMTP mailer
-* Set WordWrap variable to int with a zero default
-
-## Version 1.47 (Tue, Oct 16 2001)
-* Fixed Received header code format
-* Fixed AltBody order error
-* Fixed alternate port warning
-
-## Version 1.45 (Tue, Sep 25 2001)
-* Added enhanced SMTP debug support
-* Added support for multiple ports on SMTP
-* Added Received header for tracing
-* Fixed AddStringAttachment encoding
-* Fixed possible header name quote bug
-* Fixed wordwrap() trim bug
-* Couple other small bug fixes
-
-## Version 1.41 (Wed, Aug 22 2001)
-* Fixed AltBody bug w/o attachments
-* Fixed rfc_date() for certain mail servers
-
-## Version 1.40 (Sun, Aug 12 2001)
-* Added multipart/alternative support (AltBody)
-* Documentation update
-* Fixed bug in Mercury MTA
-
-## Version 1.29 (Fri, Aug 03 2001)
-* Added AddStringAttachment() method
-* Added SMTP authentication support
-
-## Version 1.28 (Mon, Jul 30 2001)
-* Fixed a typo in SMTP class
-* Fixed header issue with Imail (win32) SMTP server
-* Made fopen() calls for attachments use "rb" to fix win32 error
-
-## Version 1.25 (Mon, Jul 02 2001)
-* Added RFC 822 date fix (Patrice)
-* Added improved error handling by adding a $ErrorInfo variable
-* Removed MailerDebug variable (obsolete with new error handler)
-
-## Version 1.20 (Mon, Jun 25 2001)
-* Added quoted-printable encoding (Patrice)
-* Set Version as public and removed PrintVersion()
-* Changed phpdoc to only display public variables and methods
-
-## Version 1.19 (Thu, Jun 21 2001)
-* Fixed MS Mail header bug
-* Added fix for Bcc problem with mail(). *Does not work on Win32*
- (See PHP bug report: http://www.php.net/bugs.php?id=11616)
-* mail() no longer passes a fifth parameter when not needed
-
-## Version 1.15 (Fri, Jun 15 2001)
-Note: these changes contributed by Patrice Fournier
-* Changed all remaining \n to \r\n
-* Bcc: header no longer written to message except
- when sent directly to sendmail
-* Added a small message to non-MIME compliant mail reader
-* Added Sender variable to change the Sender email
- used in -f for sendmail/mail and in 'MAIL FROM' for smtp mode
-* Changed boundary setting to a place it will be set only once
-* Removed transfer encoding for whole message when using multipart
-* Message body now uses Encoding in multipart messages
-* Can set encoding and type to attachments 7bit, 8bit
- and binary attachment are sent as is, base64 are encoded
-* Can set Encoding to base64 to send 8 bits body
- through 7 bits servers
-
-## Version 1.10 (Tue, Jun 12 2001)
-* Fixed win32 mail header bug (printed out headers in message body)
-
-## Version 1.09 (Fri, Jun 08 2001)
-* Changed date header to work with Netscape mail programs
-* Altered phpdoc documentation
-
-## Version 1.08 (Tue, Jun 05 2001)
-* Added enhanced error-checking
-* Added phpdoc documentation to source
-
-## Version 1.06 (Fri, Jun 01 2001)
-* Added optional name for file attachments
-
-## Version 1.05 (Tue, May 29 2001)
-* Code cleanup
-* Eliminated sendmail header warning message
-* Fixed possible SMTP error
-
-## Version 1.03 (Thu, May 24 2001)
-* Fixed problem where qmail sends out duplicate messages
-
-## Version 1.02 (Wed, May 23 2001)
-* Added multiple recipient and attachment Clear* methods
-* Added Sendmail public variable
-* Fixed problem with loading SMTP library multiple times
-
-## Version 0.98 (Tue, May 22 2001)
-* Fixed problem with redundant mail hosts sending out multiple messages
-* Added additional error handler code
-* Added AddCustomHeader() function
-* Added support for Microsoft mail client headers (affects priority)
-* Fixed small bug with Mailer variable
-* Added PrintVersion() function
-
-## Version 0.92 (Tue, May 15 2001)
-* Changed file names to class.phpmailer.php and class.smtp.php to match
- current PHP class trend.
-* Fixed problem where body not being printed when a message is attached
-* Several small bug fixes
-
-## Version 0.90 (Tue, April 17 2001)
-* Initial public release
+++ /dev/null
-<?php
-/**
- * PHPMailer - PHP email creation and transport class.
- * PHP Version 5.4
- * @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.
- */
-
-/**
- * PHPMailerOAuth - PHPMailer subclass adding OAuth support.
- * @package PHPMailer
- * @author @sherryl4george
- * @author Marcus Bointon (@Synchro) <phpmailer@synchromedia.co.uk>
- */
-class PHPMailerOAuth extends PHPMailer
-{
- /**
- * The OAuth user's email address
- * @var string
- */
- public $oauthUserEmail = '';
-
- /**
- * The OAuth refresh token
- * @var string
- */
- public $oauthRefreshToken = '';
-
- /**
- * The OAuth client ID
- * @var string
- */
- public $oauthClientId = '';
-
- /**
- * The OAuth client secret
- * @var string
- */
- public $oauthClientSecret = '';
-
- /**
- * An instance of the PHPMailerOAuthGoogle class.
- * @var PHPMailerOAuthGoogle
- * @access protected
- */
- protected $oauth = null;
-
- /**
- * Get a PHPMailerOAuthGoogle instance to use.
- * @return PHPMailerOAuthGoogle
- */
- public function getOAUTHInstance()
- {
- if (!is_object($this->oauth)) {
- $this->oauth = new PHPMailerOAuthGoogle(
- $this->oauthUserEmail,
- $this->oauthClientSecret,
- $this->oauthClientId,
- $this->oauthRefreshToken
- );
- }
- return $this->oauth;
- }
-
- /**
- * Initiate a connection to an SMTP server.
- * Overrides the original smtpConnect method to add support for OAuth.
- * @param array $options An array of options compatible with stream_context_create()
- * @uses SMTP
- * @access public
- * @return bool
- */
- public function smtpConnect($options = array())
- {
- if (is_null($this->smtp)) {
- $this->smtp = $this->getSMTPInstance();
- }
-
- if (is_null($this->oauth)) {
- $this->oauth = $this->getOAUTHInstance();
- }
-
- // Already connected?
- if ($this->smtp->connected()) {
- return true;
- }
-
- $this->smtp->setTimeout($this->Timeout);
- $this->smtp->setDebugLevel($this->SMTPDebug);
- $this->smtp->setDebugOutput($this->Debugoutput);
- $this->smtp->setVerp($this->do_verp);
- $hosts = explode(';', $this->Host);
- $lastexception = null;
-
- foreach ($hosts as $hostentry) {
- $hostinfo = array();
- if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) {
- // Not a valid host entry
- continue;
- }
- // $hostinfo[2]: optional ssl or tls prefix
- // $hostinfo[3]: the hostname
- // $hostinfo[4]: optional port number
- // The host string prefix can temporarily override the current setting for SMTPSecure
- // If it's not specified, the default value is used
- $prefix = '';
- $secure = $this->SMTPSecure;
- $tls = ($this->SMTPSecure == 'tls');
- if ('ssl' == $hostinfo[2] or ('' == $hostinfo[2] and 'ssl' == $this->SMTPSecure)) {
- $prefix = 'ssl://';
- $tls = false; // Can't have SSL and TLS at the same time
- $secure = 'ssl';
- } elseif ($hostinfo[2] == 'tls') {
- $tls = true;
- // tls doesn't use a prefix
- $secure = 'tls';
- }
- //Do we need the OpenSSL extension?
- $sslext = defined('OPENSSL_ALGO_SHA1');
- if ('tls' === $secure or 'ssl' === $secure) {
- //Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled
- if (!$sslext) {
- throw new phpmailerException($this->lang('extension_missing').'openssl', self::STOP_CRITICAL);
- }
- }
- $host = $hostinfo[3];
- $port = $this->Port;
- $tport = (integer)$hostinfo[4];
- if ($tport > 0 and $tport < 65536) {
- $port = $tport;
- }
- if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) {
- try {
- if ($this->Helo) {
- $hello = $this->Helo;
- } else {
- $hello = $this->serverHostname();
- }
- $this->smtp->hello($hello);
- //Automatically enable TLS encryption if:
- // * it's not disabled
- // * we have openssl extension
- // * we are not already using SSL
- // * the server offers STARTTLS
- if ($this->SMTPAutoTLS and $sslext and $secure != 'ssl' and $this->smtp->getServerExt('STARTTLS')) {
- $tls = true;
- }
- if ($tls) {
- if (!$this->smtp->startTLS()) {
- throw new phpmailerException($this->lang('connect_host'));
- }
- // We must resend HELO after tls negotiation
- $this->smtp->hello($hello);
- }
- if ($this->SMTPAuth) {
- if (!$this->smtp->authenticate(
- $this->Username,
- $this->Password,
- $this->AuthType,
- $this->Realm,
- $this->Workstation,
- $this->oauth
- )
- ) {
- throw new phpmailerException($this->lang('authenticate'));
- }
- }
- return true;
- } catch (phpmailerException $exc) {
- $lastexception = $exc;
- $this->edebug($exc->getMessage());
- // We must have connected, but then failed TLS or Auth, so close connection nicely
- $this->smtp->quit();
- }
- }
- }
- // If we get here, all connection attempts have failed, so close connection hard
- $this->smtp->close();
- // As we've caught all exceptions, just report whatever the last one was
- if ($this->exceptions and !is_null($lastexception)) {
- throw $lastexception;
- }
- return false;
- }
-}
+++ /dev/null
-<?php
-/**
- * PHPMailer - PHP email creation and transport class.
- * PHP Version 5.4
- * @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.
- */
-
-/**
- * PHPMailerOAuthGoogle - Wrapper for League OAuth2 Google provider.
- * @package PHPMailer
- * @author @sherryl4george
- * @author Marcus Bointon (@Synchro) <phpmailer@synchromedia.co.uk>
- * @link https://github.com/thephpleague/oauth2-client
- */
-class PHPMailerOAuthGoogle
-{
- private $oauthUserEmail = '';
- private $oauthRefreshToken = '';
- private $oauthClientId = '';
- private $oauthClientSecret = '';
-
- /**
- * @param string $UserEmail
- * @param string $ClientSecret
- * @param string $ClientId
- * @param string $RefreshToken
- */
- public function __construct(
- $UserEmail,
- $ClientSecret,
- $ClientId,
- $RefreshToken
- ) {
- $this->oauthClientId = $ClientId;
- $this->oauthClientSecret = $ClientSecret;
- $this->oauthRefreshToken = $RefreshToken;
- $this->oauthUserEmail = $UserEmail;
- }
-
- private function getProvider()
- {
- return new League\OAuth2\Client\Provider\Google([
- 'clientId' => $this->oauthClientId,
- 'clientSecret' => $this->oauthClientSecret
- ]);
- }
-
- private function getGrant()
- {
- return new \League\OAuth2\Client\Grant\RefreshToken();
- }
-
- private function getToken()
- {
- $provider = $this->getProvider();
- $grant = $this->getGrant();
- return $provider->getAccessToken($grant, ['refresh_token' => $this->oauthRefreshToken]);
- }
-
- public function getOauth64()
- {
- $token = $this->getToken();
- return base64_encode("user=" . $this->oauthUserEmail . "\001auth=Bearer " . $token . "\001\001");
- }
-}
}
],
"require": {
- "php": ">=5.0.0"
+ "php": ">=5.5.0",
+ "ext-ctype": "*",
+ "ext-filter": "*"
},
"require-dev": {
- "phpdocumentor/phpdocumentor": "*",
- "phpunit/phpunit": "4.7.*"
+ "friendsofphp/php-cs-fixer": "^2.2",
+ "phpunit/phpunit": "^4.8 || ^5.7",
+ "doctrine/annotations": "^1.2"
},
"suggest": {
- "league/oauth2-google": "Needed for Google XOAUTH2 authentication"
+ "psr/log": "For optional PSR-3 debug logging",
+ "league/oauth2-google": "Needed for Google XOAUTH2 authentication",
+ "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
+ "stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication",
+ "ext-mbstring": "Needed to send email in multibyte encoding charset",
+ "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)"
},
"autoload": {
- "classmap": [
- "class.phpmailer.php",
- "class.phpmaileroauth.php",
- "class.phpmaileroauthgoogle.php",
- "class.smtp.php",
- "class.pop3.php",
- "extras/EasyPeasyICS.php",
- "extras/ntlm_sasl_client.php"
- ]
+ "psr-4": {
+ "PHPMailer\\PHPMailer\\": "src/"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "PHPMailer\\Test\\": "test/"
+ }
},
- "license": "LGPL-2.1"
+ "license": "LGPL-2.1-only"
}
+++ /dev/null
-{
- "_readme": [
- "This file locks the dependencies of your project to a known state",
- "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
- "This file is @generated automatically"
- ],
- "hash": "ca5abc72444d9608a35c39f9064c139b",
- "content-hash": "8b66ed71ae9ca8cd0258c814615d624f",
- "packages": [],
- "packages-dev": [
- {
- "name": "cilex/cilex",
- "version": "1.1.0",
- "source": {
- "type": "git",
- "url": "https://github.com/Cilex/Cilex.git",
- "reference": "7acd965a609a56d0345e8b6071c261fbdb926cb5"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/Cilex/Cilex/zipball/7acd965a609a56d0345e8b6071c261fbdb926cb5",
- "reference": "7acd965a609a56d0345e8b6071c261fbdb926cb5",
- "shasum": ""
- },
- "require": {
- "cilex/console-service-provider": "1.*",
- "php": ">=5.3.3",
- "pimple/pimple": "~1.0",
- "symfony/finder": "~2.1",
- "symfony/process": "~2.1"
- },
- "require-dev": {
- "phpunit/phpunit": "3.7.*",
- "symfony/validator": "~2.1"
- },
- "suggest": {
- "monolog/monolog": ">=1.0.0",
- "symfony/validator": ">=1.0.0",
- "symfony/yaml": ">=1.0.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Cilex": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Mike van Riel",
- "email": "mike.vanriel@naenius.com"
- }
- ],
- "description": "The PHP micro-framework for Command line tools based on the Symfony2 Components",
- "homepage": "http://cilex.github.com",
- "keywords": [
- "cli",
- "microframework"
- ],
- "time": "2014-03-29 14:03:13"
- },
- {
- "name": "cilex/console-service-provider",
- "version": "1.0.0",
- "source": {
- "type": "git",
- "url": "https://github.com/Cilex/console-service-provider.git",
- "reference": "25ee3d1875243d38e1a3448ff94bdf944f70d24e"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/Cilex/console-service-provider/zipball/25ee3d1875243d38e1a3448ff94bdf944f70d24e",
- "reference": "25ee3d1875243d38e1a3448ff94bdf944f70d24e",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3",
- "pimple/pimple": "1.*@dev",
- "symfony/console": "~2.1"
- },
- "require-dev": {
- "cilex/cilex": "1.*@dev",
- "silex/silex": "1.*@dev"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Cilex\\Provider\\Console": "src"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Beau Simensen",
- "email": "beau@dflydev.com",
- "homepage": "http://beausimensen.com"
- },
- {
- "name": "Mike van Riel",
- "email": "mike.vanriel@naenius.com"
- }
- ],
- "description": "Console Service Provider",
- "keywords": [
- "cilex",
- "console",
- "pimple",
- "service-provider",
- "silex"
- ],
- "time": "2012-12-19 10:50:58"
- },
- {
- "name": "container-interop/container-interop",
- "version": "1.1.0",
- "source": {
- "type": "git",
- "url": "https://github.com/container-interop/container-interop.git",
- "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/container-interop/container-interop/zipball/fc08354828f8fd3245f77a66b9e23a6bca48297e",
- "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e",
- "shasum": ""
- },
- "type": "library",
- "autoload": {
- "psr-4": {
- "Interop\\Container\\": "src/Interop/Container/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "description": "Promoting the interoperability of container objects (DIC, SL, etc.)",
- "time": "2014-12-30 15:22:37"
- },
- {
- "name": "doctrine/annotations",
- "version": "v1.2.7",
- "source": {
- "type": "git",
- "url": "https://github.com/doctrine/annotations.git",
- "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/doctrine/annotations/zipball/f25c8aab83e0c3e976fd7d19875f198ccf2f7535",
- "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535",
- "shasum": ""
- },
- "require": {
- "doctrine/lexer": "1.*",
- "php": ">=5.3.2"
- },
- "require-dev": {
- "doctrine/cache": "1.*",
- "phpunit/phpunit": "4.*"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.3.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Doctrine\\Common\\Annotations\\": "lib/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Roman Borschel",
- "email": "roman@code-factory.org"
- },
- {
- "name": "Benjamin Eberlei",
- "email": "kontakt@beberlei.de"
- },
- {
- "name": "Guilherme Blanco",
- "email": "guilhermeblanco@gmail.com"
- },
- {
- "name": "Jonathan Wage",
- "email": "jonwage@gmail.com"
- },
- {
- "name": "Johannes Schmitt",
- "email": "schmittjoh@gmail.com"
- }
- ],
- "description": "Docblock Annotations Parser",
- "homepage": "http://www.doctrine-project.org",
- "keywords": [
- "annotations",
- "docblock",
- "parser"
- ],
- "time": "2015-08-31 12:32:49"
- },
- {
- "name": "doctrine/instantiator",
- "version": "1.0.5",
- "source": {
- "type": "git",
- "url": "https://github.com/doctrine/instantiator.git",
- "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
- "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3,<8.0-DEV"
- },
- "require-dev": {
- "athletic/athletic": "~0.1.8",
- "ext-pdo": "*",
- "ext-phar": "*",
- "phpunit/phpunit": "~4.0",
- "squizlabs/php_codesniffer": "~2.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Marco Pivetta",
- "email": "ocramius@gmail.com",
- "homepage": "http://ocramius.github.com/"
- }
- ],
- "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
- "homepage": "https://github.com/doctrine/instantiator",
- "keywords": [
- "constructor",
- "instantiate"
- ],
- "time": "2015-06-14 21:17:01"
- },
- {
- "name": "doctrine/lexer",
- "version": "v1.0.1",
- "source": {
- "type": "git",
- "url": "https://github.com/doctrine/lexer.git",
- "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c",
- "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.2"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Doctrine\\Common\\Lexer\\": "lib/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Roman Borschel",
- "email": "roman@code-factory.org"
- },
- {
- "name": "Guilherme Blanco",
- "email": "guilhermeblanco@gmail.com"
- },
- {
- "name": "Johannes Schmitt",
- "email": "schmittjoh@gmail.com"
- }
- ],
- "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.",
- "homepage": "http://www.doctrine-project.org",
- "keywords": [
- "lexer",
- "parser"
- ],
- "time": "2014-09-09 13:34:57"
- },
- {
- "name": "erusev/parsedown",
- "version": "1.6.0",
- "source": {
- "type": "git",
- "url": "https://github.com/erusev/parsedown.git",
- "reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/erusev/parsedown/zipball/3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7",
- "reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7",
- "shasum": ""
- },
- "type": "library",
- "autoload": {
- "psr-0": {
- "Parsedown": ""
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Emanuil Rusev",
- "email": "hello@erusev.com",
- "homepage": "http://erusev.com"
- }
- ],
- "description": "Parser for Markdown.",
- "homepage": "http://parsedown.org",
- "keywords": [
- "markdown",
- "parser"
- ],
- "time": "2015-10-04 16:44:32"
- },
- {
- "name": "herrera-io/json",
- "version": "1.0.3",
- "source": {
- "type": "git",
- "url": "https://github.com/kherge-abandoned/php-json.git",
- "reference": "60c696c9370a1e5136816ca557c17f82a6fa83f1"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/kherge-abandoned/php-json/zipball/60c696c9370a1e5136816ca557c17f82a6fa83f1",
- "reference": "60c696c9370a1e5136816ca557c17f82a6fa83f1",
- "shasum": ""
- },
- "require": {
- "ext-json": "*",
- "justinrainbow/json-schema": ">=1.0,<2.0-dev",
- "php": ">=5.3.3",
- "seld/jsonlint": ">=1.0,<2.0-dev"
- },
- "require-dev": {
- "herrera-io/phpunit-test-case": "1.*",
- "mikey179/vfsstream": "1.1.0",
- "phpunit/phpunit": "3.7.*"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0-dev"
- }
- },
- "autoload": {
- "files": [
- "src/lib/json_version.php"
- ],
- "psr-0": {
- "Herrera\\Json": "src/lib"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Kevin Herrera",
- "email": "kevin@herrera.io",
- "homepage": "http://kevin.herrera.io/",
- "role": "Developer"
- }
- ],
- "description": "A library for simplifying JSON linting and validation.",
- "homepage": "http://herrera-io.github.com/php-json",
- "keywords": [
- "json",
- "lint",
- "schema",
- "validate"
- ],
- "time": "2013-10-30 16:51:34"
- },
- {
- "name": "herrera-io/phar-update",
- "version": "1.0.3",
- "source": {
- "type": "git",
- "url": "https://github.com/kherge-abandoned/php-phar-update.git",
- "reference": "00a79e1d5b8cf3c080a2e3becf1ddf7a7fea025b"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/kherge-abandoned/php-phar-update/zipball/00a79e1d5b8cf3c080a2e3becf1ddf7a7fea025b",
- "reference": "00a79e1d5b8cf3c080a2e3becf1ddf7a7fea025b",
- "shasum": ""
- },
- "require": {
- "herrera-io/json": "1.*",
- "kherge/version": "1.*",
- "php": ">=5.3.3"
- },
- "require-dev": {
- "herrera-io/phpunit-test-case": "1.*",
- "mikey179/vfsstream": "1.1.0",
- "phpunit/phpunit": "3.7.*"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0-dev"
- }
- },
- "autoload": {
- "files": [
- "src/lib/constants.php"
- ],
- "psr-0": {
- "Herrera\\Phar\\Update": "src/lib"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Kevin Herrera",
- "email": "kevin@herrera.io",
- "homepage": "http://kevin.herrera.io/",
- "role": "Developer"
- }
- ],
- "description": "A library for self-updating Phars.",
- "homepage": "http://herrera-io.github.com/php-phar-update",
- "keywords": [
- "phar",
- "update"
- ],
- "time": "2013-10-30 17:23:01"
- },
- {
- "name": "jms/metadata",
- "version": "1.5.1",
- "source": {
- "type": "git",
- "url": "https://github.com/schmittjoh/metadata.git",
- "reference": "22b72455559a25777cfd28c4ffda81ff7639f353"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/22b72455559a25777cfd28c4ffda81ff7639f353",
- "reference": "22b72455559a25777cfd28c4ffda81ff7639f353",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0"
- },
- "require-dev": {
- "doctrine/cache": "~1.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.5.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Metadata\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "Apache"
- ],
- "authors": [
- {
- "name": "Johannes Schmitt",
- "email": "schmittjoh@gmail.com",
- "homepage": "https://github.com/schmittjoh",
- "role": "Developer of wrapped JMSSerializerBundle"
- }
- ],
- "description": "Class/method/property metadata management in PHP",
- "keywords": [
- "annotations",
- "metadata",
- "xml",
- "yaml"
- ],
- "time": "2014-07-12 07:13:19"
- },
- {
- "name": "jms/parser-lib",
- "version": "1.0.0",
- "source": {
- "type": "git",
- "url": "https://github.com/schmittjoh/parser-lib.git",
- "reference": "c509473bc1b4866415627af0e1c6cc8ac97fa51d"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/parser-lib/zipball/c509473bc1b4866415627af0e1c6cc8ac97fa51d",
- "reference": "c509473bc1b4866415627af0e1c6cc8ac97fa51d",
- "shasum": ""
- },
- "require": {
- "phpoption/phpoption": ">=0.9,<2.0-dev"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "JMS\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "Apache2"
- ],
- "description": "A library for easily creating recursive-descent parsers.",
- "time": "2012-11-18 18:08:43"
- },
- {
- "name": "jms/serializer",
- "version": "1.1.0",
- "source": {
- "type": "git",
- "url": "https://github.com/schmittjoh/serializer.git",
- "reference": "fe13a1f993ea3456e195b7820692f2eb2b6bbb48"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/fe13a1f993ea3456e195b7820692f2eb2b6bbb48",
- "reference": "fe13a1f993ea3456e195b7820692f2eb2b6bbb48",
- "shasum": ""
- },
- "require": {
- "doctrine/annotations": "1.*",
- "doctrine/instantiator": "~1.0.3",
- "jms/metadata": "~1.1",
- "jms/parser-lib": "1.*",
- "php": ">=5.4.0",
- "phpcollection/phpcollection": "~0.1"
- },
- "conflict": {
- "twig/twig": "<1.12"
- },
- "require-dev": {
- "doctrine/orm": "~2.1",
- "doctrine/phpcr-odm": "~1.0.1",
- "jackalope/jackalope-doctrine-dbal": "1.0.*",
- "phpunit/phpunit": "~4.0",
- "propel/propel1": "~1.7",
- "symfony/filesystem": "2.*",
- "symfony/form": "~2.1",
- "symfony/translation": "~2.0",
- "symfony/validator": "~2.0",
- "symfony/yaml": "2.*",
- "twig/twig": "~1.12|~2.0"
- },
- "suggest": {
- "symfony/yaml": "Required if you'd like to serialize data to YAML format."
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.1-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "JMS\\Serializer": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "Apache2"
- ],
- "authors": [
- {
- "name": "Johannes M. Schmitt",
- "email": "schmittjoh@gmail.com"
- }
- ],
- "description": "Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.",
- "homepage": "http://jmsyst.com/libs/serializer",
- "keywords": [
- "deserialization",
- "jaxb",
- "json",
- "serialization",
- "xml"
- ],
- "time": "2015-10-27 09:24:41"
- },
- {
- "name": "justinrainbow/json-schema",
- "version": "1.6.1",
- "source": {
- "type": "git",
- "url": "https://github.com/justinrainbow/json-schema.git",
- "reference": "cc84765fb7317f6b07bd8ac78364747f95b86341"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/cc84765fb7317f6b07bd8ac78364747f95b86341",
- "reference": "cc84765fb7317f6b07bd8ac78364747f95b86341",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.29"
- },
- "require-dev": {
- "json-schema/json-schema-test-suite": "1.1.0",
- "phpdocumentor/phpdocumentor": "~2",
- "phpunit/phpunit": "~3.7"
- },
- "bin": [
- "bin/validate-json"
- ],
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.6.x-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "JsonSchema\\": "src/JsonSchema/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Bruno Prieto Reis",
- "email": "bruno.p.reis@gmail.com"
- },
- {
- "name": "Justin Rainbow",
- "email": "justin.rainbow@gmail.com"
- },
- {
- "name": "Igor Wiedler",
- "email": "igor@wiedler.ch"
- },
- {
- "name": "Robert Schönthal",
- "email": "seroscho@googlemail.com"
- }
- ],
- "description": "A library to validate a json schema.",
- "homepage": "https://github.com/justinrainbow/json-schema",
- "keywords": [
- "json",
- "schema"
- ],
- "time": "2016-01-25 15:43:01"
- },
- {
- "name": "kherge/version",
- "version": "1.0.1",
- "source": {
- "type": "git",
- "url": "https://github.com/kherge-abandoned/Version.git",
- "reference": "f07cf83f8ce533be8f93d2893d96d674bbeb7e30"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/kherge-abandoned/Version/zipball/f07cf83f8ce533be8f93d2893d96d674bbeb7e30",
- "reference": "f07cf83f8ce533be8f93d2893d96d674bbeb7e30",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "KevinGH\\Version": "src/lib/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Kevin Herrera",
- "email": "me@kevingh.com",
- "homepage": "http://www.kevingh.com/"
- }
- ],
- "description": "A parsing and comparison library for semantic versioning.",
- "homepage": "http://github.com/kherge/Version",
- "time": "2012-08-16 17:13:03"
- },
- {
- "name": "monolog/monolog",
- "version": "1.19.0",
- "source": {
- "type": "git",
- "url": "https://github.com/Seldaek/monolog.git",
- "reference": "5f56ed5212dc509c8dc8caeba2715732abb32dbf"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/Seldaek/monolog/zipball/5f56ed5212dc509c8dc8caeba2715732abb32dbf",
- "reference": "5f56ed5212dc509c8dc8caeba2715732abb32dbf",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0",
- "psr/log": "~1.0"
- },
- "provide": {
- "psr/log-implementation": "1.0.0"
- },
- "require-dev": {
- "aws/aws-sdk-php": "^2.4.9",
- "doctrine/couchdb": "~1.0@dev",
- "graylog2/gelf-php": "~1.0",
- "jakub-onderka/php-parallel-lint": "0.9",
- "php-amqplib/php-amqplib": "~2.4",
- "php-console/php-console": "^3.1.3",
- "phpunit/phpunit": "~4.5",
- "phpunit/phpunit-mock-objects": "2.3.0",
- "raven/raven": "^0.13",
- "ruflin/elastica": ">=0.90 <3.0",
- "swiftmailer/swiftmailer": "~5.3"
- },
- "suggest": {
- "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
- "doctrine/couchdb": "Allow sending log messages to a CouchDB server",
- "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
- "ext-mongo": "Allow sending log messages to a MongoDB server",
- "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
- "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver",
- "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
- "php-console/php-console": "Allow sending log messages to Google Chrome",
- "raven/raven": "Allow sending log messages to a Sentry server",
- "rollbar/rollbar": "Allow sending log messages to Rollbar",
- "ruflin/elastica": "Allow sending log messages to an Elastic Search server"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.0.x-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Monolog\\": "src/Monolog"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Jordi Boggiano",
- "email": "j.boggiano@seld.be",
- "homepage": "http://seld.be"
- }
- ],
- "description": "Sends your logs to files, sockets, inboxes, databases and various web services",
- "homepage": "http://github.com/Seldaek/monolog",
- "keywords": [
- "log",
- "logging",
- "psr-3"
- ],
- "time": "2016-04-12 18:29:35"
- },
- {
- "name": "nikic/php-parser",
- "version": "v1.4.1",
- "source": {
- "type": "git",
- "url": "https://github.com/nikic/PHP-Parser.git",
- "reference": "f78af2c9c86107aa1a34cd1dbb5bbe9eeb0d9f51"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f78af2c9c86107aa1a34cd1dbb5bbe9eeb0d9f51",
- "reference": "f78af2c9c86107aa1a34cd1dbb5bbe9eeb0d9f51",
- "shasum": ""
- },
- "require": {
- "ext-tokenizer": "*",
- "php": ">=5.3"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.4-dev"
- }
- },
- "autoload": {
- "files": [
- "lib/bootstrap.php"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Nikita Popov"
- }
- ],
- "description": "A PHP parser written in PHP",
- "keywords": [
- "parser",
- "php"
- ],
- "time": "2015-09-19 14:15:08"
- },
- {
- "name": "phpcollection/phpcollection",
- "version": "0.4.0",
- "source": {
- "type": "git",
- "url": "https://github.com/schmittjoh/php-collection.git",
- "reference": "b8bf55a0a929ca43b01232b36719f176f86c7e83"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/php-collection/zipball/b8bf55a0a929ca43b01232b36719f176f86c7e83",
- "reference": "b8bf55a0a929ca43b01232b36719f176f86c7e83",
- "shasum": ""
- },
- "require": {
- "phpoption/phpoption": "1.*"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "0.3-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "PhpCollection": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "Apache2"
- ],
- "authors": [
- {
- "name": "Johannes M. Schmitt",
- "email": "schmittjoh@gmail.com",
- "homepage": "http://jmsyst.com",
- "role": "Developer of wrapped JMSSerializerBundle"
- }
- ],
- "description": "General-Purpose Collection Library for PHP",
- "keywords": [
- "collection",
- "list",
- "map",
- "sequence",
- "set"
- ],
- "time": "2014-03-11 13:46:42"
- },
- {
- "name": "phpdocumentor/fileset",
- "version": "1.0.0",
- "source": {
- "type": "git",
- "url": "https://github.com/phpDocumentor/Fileset.git",
- "reference": "bfa78d8fa9763dfce6d0e5d3730c1d8ab25d34b0"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/Fileset/zipball/bfa78d8fa9763dfce6d0e5d3730c1d8ab25d34b0",
- "reference": "bfa78d8fa9763dfce6d0e5d3730c1d8ab25d34b0",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3",
- "symfony/finder": "~2.1"
- },
- "require-dev": {
- "phpunit/phpunit": "~3.7"
- },
- "type": "library",
- "autoload": {
- "psr-0": {
- "phpDocumentor": [
- "src/",
- "tests/unit/"
- ]
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "description": "Fileset component for collecting a set of files given directories and file paths",
- "homepage": "http://www.phpdoc.org",
- "keywords": [
- "files",
- "fileset",
- "phpdoc"
- ],
- "time": "2013-08-06 21:07:42"
- },
- {
- "name": "phpdocumentor/graphviz",
- "version": "1.0.4",
- "source": {
- "type": "git",
- "url": "https://github.com/phpDocumentor/GraphViz.git",
- "reference": "a906a90a9f230535f25ea31caf81b2323956283f"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/GraphViz/zipball/a906a90a9f230535f25ea31caf81b2323956283f",
- "reference": "a906a90a9f230535f25ea31caf81b2323956283f",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.0"
- },
- "type": "library",
- "autoload": {
- "psr-0": {
- "phpDocumentor": [
- "src/",
- "tests/unit"
- ]
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Mike van Riel",
- "email": "mike.vanriel@naenius.com"
- }
- ],
- "time": "2016-02-02 13:00:08"
- },
- {
- "name": "phpdocumentor/phpdocumentor",
- "version": "v2.9.0",
- "source": {
- "type": "git",
- "url": "https://github.com/phpDocumentor/phpDocumentor2.git",
- "reference": "be607da0eef9b9249c43c5b4820d25d631c73667"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/phpDocumentor2/zipball/be607da0eef9b9249c43c5b4820d25d631c73667",
- "reference": "be607da0eef9b9249c43c5b4820d25d631c73667",
- "shasum": ""
- },
- "require": {
- "cilex/cilex": "~1.0",
- "erusev/parsedown": "~1.0",
- "herrera-io/phar-update": "1.0.3",
- "jms/serializer": ">=0.12",
- "monolog/monolog": "~1.6",
- "php": ">=5.3.3",
- "phpdocumentor/fileset": "~1.0",
- "phpdocumentor/graphviz": "~1.0",
- "phpdocumentor/reflection": "^3.0",
- "phpdocumentor/reflection-docblock": "~2.0",
- "symfony/config": "~2.3",
- "symfony/console": "~2.3",
- "symfony/event-dispatcher": "~2.1",
- "symfony/process": "~2.0",
- "symfony/stopwatch": "~2.3",
- "symfony/validator": "~2.2",
- "twig/twig": "~1.3",
- "zendframework/zend-cache": "~2.1",
- "zendframework/zend-config": "~2.1",
- "zendframework/zend-filter": "~2.1",
- "zendframework/zend-i18n": "~2.1",
- "zendframework/zend-serializer": "~2.1",
- "zendframework/zend-servicemanager": "~2.1",
- "zendframework/zend-stdlib": "~2.1",
- "zetacomponents/document": ">=1.3.1"
- },
- "require-dev": {
- "behat/behat": "~3.0",
- "mikey179/vfsstream": "~1.2",
- "mockery/mockery": "~0.9@dev",
- "phpunit/phpunit": "~4.0",
- "squizlabs/php_codesniffer": "~1.4",
- "symfony/expression-language": "~2.4"
- },
- "suggest": {
- "ext-twig": "Enabling the twig extension improves the generation of twig based templates.",
- "ext-xslcache": "Enabling the XSLCache extension improves the generation of xml based templates."
- },
- "bin": [
- "bin/phpdoc.php",
- "bin/phpdoc"
- ],
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-develop": "2.9-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "phpDocumentor": [
- "src/",
- "tests/unit/"
- ],
- "Cilex\\Provider": [
- "src/"
- ]
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "description": "Documentation Generator for PHP",
- "homepage": "http://www.phpdoc.org",
- "keywords": [
- "api",
- "application",
- "dga",
- "documentation",
- "phpdoc"
- ],
- "time": "2016-05-22 09:50:56"
- },
- {
- "name": "phpdocumentor/reflection",
- "version": "3.0.1",
- "source": {
- "type": "git",
- "url": "https://github.com/phpDocumentor/Reflection.git",
- "reference": "793bfd92d9a0fc96ae9608fb3e947c3f59fb3a0d"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/Reflection/zipball/793bfd92d9a0fc96ae9608fb3e947c3f59fb3a0d",
- "reference": "793bfd92d9a0fc96ae9608fb3e947c3f59fb3a0d",
- "shasum": ""
- },
- "require": {
- "nikic/php-parser": "^1.0",
- "php": ">=5.3.3",
- "phpdocumentor/reflection-docblock": "~2.0",
- "psr/log": "~1.0"
- },
- "require-dev": {
- "behat/behat": "~2.4",
- "mockery/mockery": "~0.8",
- "phpunit/phpunit": "~4.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "phpDocumentor": [
- "src/",
- "tests/unit/",
- "tests/mocks/"
- ]
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "description": "Reflection library to do Static Analysis for PHP Projects",
- "homepage": "http://www.phpdoc.org",
- "keywords": [
- "phpDocumentor",
- "phpdoc",
- "reflection",
- "static analysis"
- ],
- "time": "2016-05-21 08:42:32"
- },
- {
- "name": "phpdocumentor/reflection-docblock",
- "version": "2.0.4",
- "source": {
- "type": "git",
- "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
- "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8",
- "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.0"
- },
- "suggest": {
- "dflydev/markdown": "~1.0",
- "erusev/parsedown": "~1.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.0.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "phpDocumentor": [
- "src/"
- ]
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Mike van Riel",
- "email": "mike.vanriel@naenius.com"
- }
- ],
- "time": "2015-02-03 12:10:50"
- },
- {
- "name": "phpoption/phpoption",
- "version": "1.5.0",
- "source": {
- "type": "git",
- "url": "https://github.com/schmittjoh/php-option.git",
- "reference": "94e644f7d2051a5f0fcf77d81605f152eecff0ed"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/94e644f7d2051a5f0fcf77d81605f152eecff0ed",
- "reference": "94e644f7d2051a5f0fcf77d81605f152eecff0ed",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0"
- },
- "require-dev": {
- "phpunit/phpunit": "4.7.*"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.3-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "PhpOption\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "Apache2"
- ],
- "authors": [
- {
- "name": "Johannes M. Schmitt",
- "email": "schmittjoh@gmail.com"
- }
- ],
- "description": "Option Type for PHP",
- "keywords": [
- "language",
- "option",
- "php",
- "type"
- ],
- "time": "2015-07-25 16:39:46"
- },
- {
- "name": "phpspec/prophecy",
- "version": "v1.6.1",
- "source": {
- "type": "git",
- "url": "https://github.com/phpspec/prophecy.git",
- "reference": "58a8137754bc24b25740d4281399a4a3596058e0"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0",
- "reference": "58a8137754bc24b25740d4281399a4a3596058e0",
- "shasum": ""
- },
- "require": {
- "doctrine/instantiator": "^1.0.2",
- "php": "^5.3|^7.0",
- "phpdocumentor/reflection-docblock": "^2.0|^3.0.2",
- "sebastian/comparator": "^1.1",
- "sebastian/recursion-context": "^1.0"
- },
- "require-dev": {
- "phpspec/phpspec": "^2.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.6.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Prophecy\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Konstantin Kudryashov",
- "email": "ever.zet@gmail.com",
- "homepage": "http://everzet.com"
- },
- {
- "name": "Marcello Duarte",
- "email": "marcello.duarte@gmail.com"
- }
- ],
- "description": "Highly opinionated mocking framework for PHP 5.3+",
- "homepage": "https://github.com/phpspec/prophecy",
- "keywords": [
- "Double",
- "Dummy",
- "fake",
- "mock",
- "spy",
- "stub"
- ],
- "time": "2016-06-07 08:13:47"
- },
- {
- "name": "phpunit/php-code-coverage",
- "version": "2.2.4",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979",
- "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3",
- "phpunit/php-file-iterator": "~1.3",
- "phpunit/php-text-template": "~1.2",
- "phpunit/php-token-stream": "~1.3",
- "sebastian/environment": "^1.3.2",
- "sebastian/version": "~1.0"
- },
- "require-dev": {
- "ext-xdebug": ">=2.1.4",
- "phpunit/phpunit": "~4"
- },
- "suggest": {
- "ext-dom": "*",
- "ext-xdebug": ">=2.2.1",
- "ext-xmlwriter": "*"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.2.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sb@sebastian-bergmann.de",
- "role": "lead"
- }
- ],
- "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
- "homepage": "https://github.com/sebastianbergmann/php-code-coverage",
- "keywords": [
- "coverage",
- "testing",
- "xunit"
- ],
- "time": "2015-10-06 15:47:00"
- },
- {
- "name": "phpunit/php-file-iterator",
- "version": "1.4.1",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
- "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
- "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.4.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sb@sebastian-bergmann.de",
- "role": "lead"
- }
- ],
- "description": "FilterIterator implementation that filters files based on a list of suffixes.",
- "homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
- "keywords": [
- "filesystem",
- "iterator"
- ],
- "time": "2015-06-21 13:08:43"
- },
- {
- "name": "phpunit/php-text-template",
- "version": "1.2.1",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/php-text-template.git",
- "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
- "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "type": "library",
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de",
- "role": "lead"
- }
- ],
- "description": "Simple template engine.",
- "homepage": "https://github.com/sebastianbergmann/php-text-template/",
- "keywords": [
- "template"
- ],
- "time": "2015-06-21 13:50:34"
- },
- {
- "name": "phpunit/php-timer",
- "version": "1.0.8",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/php-timer.git",
- "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260",
- "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4|~5"
- },
- "type": "library",
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sb@sebastian-bergmann.de",
- "role": "lead"
- }
- ],
- "description": "Utility class for timing",
- "homepage": "https://github.com/sebastianbergmann/php-timer/",
- "keywords": [
- "timer"
- ],
- "time": "2016-05-12 18:03:57"
- },
- {
- "name": "phpunit/php-token-stream",
- "version": "1.4.8",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/php-token-stream.git",
- "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
- "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
- "shasum": ""
- },
- "require": {
- "ext-tokenizer": "*",
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.2"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.4-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- }
- ],
- "description": "Wrapper around PHP's tokenizer extension.",
- "homepage": "https://github.com/sebastianbergmann/php-token-stream/",
- "keywords": [
- "tokenizer"
- ],
- "time": "2015-09-15 10:49:45"
- },
- {
- "name": "phpunit/phpunit",
- "version": "4.7.7",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "9b97f9d807b862c2de2a36e86690000801c85724"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9b97f9d807b862c2de2a36e86690000801c85724",
- "reference": "9b97f9d807b862c2de2a36e86690000801c85724",
- "shasum": ""
- },
- "require": {
- "ext-dom": "*",
- "ext-json": "*",
- "ext-pcre": "*",
- "ext-reflection": "*",
- "ext-spl": "*",
- "php": ">=5.3.3",
- "phpspec/prophecy": "~1.3,>=1.3.1",
- "phpunit/php-code-coverage": "~2.1",
- "phpunit/php-file-iterator": "~1.4",
- "phpunit/php-text-template": "~1.2",
- "phpunit/php-timer": ">=1.0.6",
- "phpunit/phpunit-mock-objects": "~2.3",
- "sebastian/comparator": "~1.1",
- "sebastian/diff": "~1.2",
- "sebastian/environment": "~1.2",
- "sebastian/exporter": "~1.2",
- "sebastian/global-state": "~1.0",
- "sebastian/version": "~1.0",
- "symfony/yaml": "~2.1|~3.0"
- },
- "suggest": {
- "phpunit/php-invoker": "~1.1"
- },
- "bin": [
- "phpunit"
- ],
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "4.7.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de",
- "role": "lead"
- }
- ],
- "description": "The PHP Unit Testing framework.",
- "homepage": "https://phpunit.de/",
- "keywords": [
- "phpunit",
- "testing",
- "xunit"
- ],
- "time": "2015-07-13 11:28:34"
- },
- {
- "name": "phpunit/phpunit-mock-objects",
- "version": "2.3.8",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
- "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983",
- "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983",
- "shasum": ""
- },
- "require": {
- "doctrine/instantiator": "^1.0.2",
- "php": ">=5.3.3",
- "phpunit/php-text-template": "~1.2",
- "sebastian/exporter": "~1.2"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.4"
- },
- "suggest": {
- "ext-soap": "*"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.3.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sb@sebastian-bergmann.de",
- "role": "lead"
- }
- ],
- "description": "Mock Object library for PHPUnit",
- "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
- "keywords": [
- "mock",
- "xunit"
- ],
- "time": "2015-10-02 06:51:40"
- },
- {
- "name": "pimple/pimple",
- "version": "v1.1.1",
- "source": {
- "type": "git",
- "url": "https://github.com/silexphp/Pimple.git",
- "reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/silexphp/Pimple/zipball/2019c145fe393923f3441b23f29bbdfaa5c58c4d",
- "reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.1.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Pimple": "lib/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com",
- "homepage": "http://fabien.potencier.org",
- "role": "Lead Developer"
- }
- ],
- "description": "Pimple is a simple Dependency Injection Container for PHP 5.3",
- "homepage": "http://pimple.sensiolabs.org",
- "keywords": [
- "container",
- "dependency injection"
- ],
- "time": "2013-11-22 08:30:29"
- },
- {
- "name": "psr/log",
- "version": "1.0.0",
- "source": {
- "type": "git",
- "url": "https://github.com/php-fig/log.git",
- "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
- "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
- "shasum": ""
- },
- "type": "library",
- "autoload": {
- "psr-0": {
- "Psr\\Log\\": ""
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "PHP-FIG",
- "homepage": "http://www.php-fig.org/"
- }
- ],
- "description": "Common interface for logging libraries",
- "keywords": [
- "log",
- "psr",
- "psr-3"
- ],
- "time": "2012-12-21 11:40:51"
- },
- {
- "name": "sebastian/comparator",
- "version": "1.2.0",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/comparator.git",
- "reference": "937efb279bd37a375bcadf584dec0726f84dbf22"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22",
- "reference": "937efb279bd37a375bcadf584dec0726f84dbf22",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3",
- "sebastian/diff": "~1.2",
- "sebastian/exporter": "~1.2"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.4"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.2.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Jeff Welch",
- "email": "whatthejeff@gmail.com"
- },
- {
- "name": "Volker Dusch",
- "email": "github@wallbash.com"
- },
- {
- "name": "Bernhard Schussek",
- "email": "bschussek@2bepublished.at"
- },
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- }
- ],
- "description": "Provides the functionality to compare PHP values for equality",
- "homepage": "http://www.github.com/sebastianbergmann/comparator",
- "keywords": [
- "comparator",
- "compare",
- "equality"
- ],
- "time": "2015-07-26 15:48:44"
- },
- {
- "name": "sebastian/diff",
- "version": "1.4.1",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/diff.git",
- "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e",
- "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.8"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.4-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Kore Nordmann",
- "email": "mail@kore-nordmann.de"
- },
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- }
- ],
- "description": "Diff implementation",
- "homepage": "https://github.com/sebastianbergmann/diff",
- "keywords": [
- "diff"
- ],
- "time": "2015-12-08 07:14:41"
- },
- {
- "name": "sebastian/environment",
- "version": "1.3.7",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/environment.git",
- "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716",
- "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.4"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.3.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- }
- ],
- "description": "Provides functionality to handle HHVM/PHP environments",
- "homepage": "http://www.github.com/sebastianbergmann/environment",
- "keywords": [
- "Xdebug",
- "environment",
- "hhvm"
- ],
- "time": "2016-05-17 03:18:57"
- },
- {
- "name": "sebastian/exporter",
- "version": "1.2.2",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/exporter.git",
- "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4",
- "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3",
- "sebastian/recursion-context": "~1.0"
- },
- "require-dev": {
- "ext-mbstring": "*",
- "phpunit/phpunit": "~4.4"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.3.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Jeff Welch",
- "email": "whatthejeff@gmail.com"
- },
- {
- "name": "Volker Dusch",
- "email": "github@wallbash.com"
- },
- {
- "name": "Bernhard Schussek",
- "email": "bschussek@2bepublished.at"
- },
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- },
- {
- "name": "Adam Harvey",
- "email": "aharvey@php.net"
- }
- ],
- "description": "Provides the functionality to export PHP variables for visualization",
- "homepage": "http://www.github.com/sebastianbergmann/exporter",
- "keywords": [
- "export",
- "exporter"
- ],
- "time": "2016-06-17 09:04:28"
- },
- {
- "name": "sebastian/global-state",
- "version": "1.1.1",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/global-state.git",
- "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
- "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.2"
- },
- "suggest": {
- "ext-uopz": "*"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- }
- ],
- "description": "Snapshotting of global state",
- "homepage": "http://www.github.com/sebastianbergmann/global-state",
- "keywords": [
- "global state"
- ],
- "time": "2015-10-12 03:26:01"
- },
- {
- "name": "sebastian/recursion-context",
- "version": "1.0.2",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/recursion-context.git",
- "reference": "913401df809e99e4f47b27cdd781f4a258d58791"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791",
- "reference": "913401df809e99e4f47b27cdd781f4a258d58791",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.4"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Jeff Welch",
- "email": "whatthejeff@gmail.com"
- },
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- },
- {
- "name": "Adam Harvey",
- "email": "aharvey@php.net"
- }
- ],
- "description": "Provides functionality to recursively process PHP variables",
- "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
- "time": "2015-11-11 19:50:13"
- },
- {
- "name": "sebastian/version",
- "version": "1.0.6",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/version.git",
- "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
- "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
- "shasum": ""
- },
- "type": "library",
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de",
- "role": "lead"
- }
- ],
- "description": "Library that helps with managing the version number of Git-hosted PHP projects",
- "homepage": "https://github.com/sebastianbergmann/version",
- "time": "2015-06-21 13:59:46"
- },
- {
- "name": "seld/jsonlint",
- "version": "1.4.0",
- "source": {
- "type": "git",
- "url": "https://github.com/Seldaek/jsonlint.git",
- "reference": "66834d3e3566bb5798db7294619388786ae99394"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/66834d3e3566bb5798db7294619388786ae99394",
- "reference": "66834d3e3566bb5798db7294619388786ae99394",
- "shasum": ""
- },
- "require": {
- "php": "^5.3 || ^7.0"
- },
- "bin": [
- "bin/jsonlint"
- ],
- "type": "library",
- "autoload": {
- "psr-4": {
- "Seld\\JsonLint\\": "src/Seld/JsonLint/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Jordi Boggiano",
- "email": "j.boggiano@seld.be",
- "homepage": "http://seld.be"
- }
- ],
- "description": "JSON Linter",
- "keywords": [
- "json",
- "linter",
- "parser",
- "validator"
- ],
- "time": "2015-11-21 02:21:41"
- },
- {
- "name": "symfony/config",
- "version": "v2.8.7",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/config.git",
- "reference": "a2edd59c2163c65747fc3f35d132b5a39266bd05"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/config/zipball/a2edd59c2163c65747fc3f35d132b5a39266bd05",
- "reference": "a2edd59c2163c65747fc3f35d132b5a39266bd05",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.9",
- "symfony/filesystem": "~2.3|~3.0.0"
- },
- "suggest": {
- "symfony/yaml": "To use the yaml reference dumper"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.8-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\Config\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony Config Component",
- "homepage": "https://symfony.com",
- "time": "2016-06-06 11:11:27"
- },
- {
- "name": "symfony/console",
- "version": "v2.8.7",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/console.git",
- "reference": "5ac8bc9aa77bb2edf06af3a1bb6bc1020d23acd3"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/5ac8bc9aa77bb2edf06af3a1bb6bc1020d23acd3",
- "reference": "5ac8bc9aa77bb2edf06af3a1bb6bc1020d23acd3",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.9",
- "symfony/polyfill-mbstring": "~1.0"
- },
- "require-dev": {
- "psr/log": "~1.0",
- "symfony/event-dispatcher": "~2.1|~3.0.0",
- "symfony/process": "~2.1|~3.0.0"
- },
- "suggest": {
- "psr/log": "For using the console logger",
- "symfony/event-dispatcher": "",
- "symfony/process": ""
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.8-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\Console\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony Console Component",
- "homepage": "https://symfony.com",
- "time": "2016-06-06 15:06:25"
- },
- {
- "name": "symfony/event-dispatcher",
- "version": "v2.8.7",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/event-dispatcher.git",
- "reference": "2a6b8713f8bdb582058cfda463527f195b066110"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/2a6b8713f8bdb582058cfda463527f195b066110",
- "reference": "2a6b8713f8bdb582058cfda463527f195b066110",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.9"
- },
- "require-dev": {
- "psr/log": "~1.0",
- "symfony/config": "~2.0,>=2.0.5|~3.0.0",
- "symfony/dependency-injection": "~2.6|~3.0.0",
- "symfony/expression-language": "~2.6|~3.0.0",
- "symfony/stopwatch": "~2.3|~3.0.0"
- },
- "suggest": {
- "symfony/dependency-injection": "",
- "symfony/http-kernel": ""
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.8-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\EventDispatcher\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony EventDispatcher Component",
- "homepage": "https://symfony.com",
- "time": "2016-06-06 11:11:27"
- },
- {
- "name": "symfony/filesystem",
- "version": "v3.0.7",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/filesystem.git",
- "reference": "74fec3511b62cb934b64bce1d96f06fffa4beafd"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/filesystem/zipball/74fec3511b62cb934b64bce1d96f06fffa4beafd",
- "reference": "74fec3511b62cb934b64bce1d96f06fffa4beafd",
- "shasum": ""
- },
- "require": {
- "php": ">=5.5.9"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "3.0-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\Filesystem\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony Filesystem Component",
- "homepage": "https://symfony.com",
- "time": "2016-04-12 18:09:53"
- },
- {
- "name": "symfony/finder",
- "version": "v2.8.7",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/finder.git",
- "reference": "3ec095fab1800222732ca522a95dce8fa124007b"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/finder/zipball/3ec095fab1800222732ca522a95dce8fa124007b",
- "reference": "3ec095fab1800222732ca522a95dce8fa124007b",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.9"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.8-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\Finder\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony Finder Component",
- "homepage": "https://symfony.com",
- "time": "2016-06-06 11:11:27"
- },
- {
- "name": "symfony/polyfill-mbstring",
- "version": "v1.2.0",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/polyfill-mbstring.git",
- "reference": "dff51f72b0706335131b00a7f49606168c582594"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594",
- "reference": "dff51f72b0706335131b00a7f49606168c582594",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "suggest": {
- "ext-mbstring": "For best performance"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.2-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Polyfill\\Mbstring\\": ""
- },
- "files": [
- "bootstrap.php"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Nicolas Grekas",
- "email": "p@tchwork.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony polyfill for the Mbstring extension",
- "homepage": "https://symfony.com",
- "keywords": [
- "compatibility",
- "mbstring",
- "polyfill",
- "portable",
- "shim"
- ],
- "time": "2016-05-18 14:26:46"
- },
- {
- "name": "symfony/process",
- "version": "v2.8.7",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/process.git",
- "reference": "115347d00c342198cdc52a7bd8bc15b5ab43500c"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/process/zipball/115347d00c342198cdc52a7bd8bc15b5ab43500c",
- "reference": "115347d00c342198cdc52a7bd8bc15b5ab43500c",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.9"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.8-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\Process\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony Process Component",
- "homepage": "https://symfony.com",
- "time": "2016-06-06 11:11:27"
- },
- {
- "name": "symfony/stopwatch",
- "version": "v2.8.7",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/stopwatch.git",
- "reference": "5e628055488bcc42dbace3af65be435d094e37e4"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5e628055488bcc42dbace3af65be435d094e37e4",
- "reference": "5e628055488bcc42dbace3af65be435d094e37e4",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.9"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.8-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\Stopwatch\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony Stopwatch Component",
- "homepage": "https://symfony.com",
- "time": "2016-06-06 11:11:27"
- },
- {
- "name": "symfony/translation",
- "version": "v3.0.7",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/translation.git",
- "reference": "2b0aacaa613c0ec1ad8046f972d8abdcb19c1db7"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/translation/zipball/2b0aacaa613c0ec1ad8046f972d8abdcb19c1db7",
- "reference": "2b0aacaa613c0ec1ad8046f972d8abdcb19c1db7",
- "shasum": ""
- },
- "require": {
- "php": ">=5.5.9",
- "symfony/polyfill-mbstring": "~1.0"
- },
- "conflict": {
- "symfony/config": "<2.8"
- },
- "require-dev": {
- "psr/log": "~1.0",
- "symfony/config": "~2.8|~3.0",
- "symfony/intl": "~2.8|~3.0",
- "symfony/yaml": "~2.8|~3.0"
- },
- "suggest": {
- "psr/log": "To use logging capability in translator",
- "symfony/config": "",
- "symfony/yaml": ""
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "3.0-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\Translation\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony Translation Component",
- "homepage": "https://symfony.com",
- "time": "2016-06-06 11:33:26"
- },
- {
- "name": "symfony/validator",
- "version": "v2.8.7",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/validator.git",
- "reference": "4c8f9fd8e2150dbc4745ef13378e690588365df0"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/validator/zipball/4c8f9fd8e2150dbc4745ef13378e690588365df0",
- "reference": "4c8f9fd8e2150dbc4745ef13378e690588365df0",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.9",
- "symfony/polyfill-mbstring": "~1.0",
- "symfony/translation": "~2.4|~3.0.0"
- },
- "require-dev": {
- "doctrine/annotations": "~1.0",
- "doctrine/cache": "~1.0",
- "egulias/email-validator": "~1.2,>=1.2.1",
- "symfony/config": "~2.2|~3.0.0",
- "symfony/expression-language": "~2.4|~3.0.0",
- "symfony/http-foundation": "~2.1|~3.0.0",
- "symfony/intl": "~2.7.4|~2.8|~3.0.0",
- "symfony/property-access": "~2.3|~3.0.0",
- "symfony/yaml": "~2.0,>=2.0.5|~3.0.0"
- },
- "suggest": {
- "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.",
- "doctrine/cache": "For using the default cached annotation reader and metadata cache.",
- "egulias/email-validator": "Strict (RFC compliant) email validation",
- "symfony/config": "",
- "symfony/expression-language": "For using the 2.4 Expression validator",
- "symfony/http-foundation": "",
- "symfony/intl": "",
- "symfony/property-access": "For using the 2.4 Validator API",
- "symfony/yaml": ""
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.8-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\Validator\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony Validator Component",
- "homepage": "https://symfony.com",
- "time": "2016-04-14 08:48:44"
- },
- {
- "name": "symfony/yaml",
- "version": "v3.1.1",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/yaml.git",
- "reference": "c5a7e7fc273c758b92b85dcb9c46149ccda89623"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/c5a7e7fc273c758b92b85dcb9c46149ccda89623",
- "reference": "c5a7e7fc273c758b92b85dcb9c46149ccda89623",
- "shasum": ""
- },
- "require": {
- "php": ">=5.5.9"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "3.1-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\Yaml\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony Yaml Component",
- "homepage": "https://symfony.com",
- "time": "2016-06-14 11:18:07"
- },
- {
- "name": "twig/twig",
- "version": "v1.24.1",
- "source": {
- "type": "git",
- "url": "https://github.com/twigphp/Twig.git",
- "reference": "3566d311a92aae4deec6e48682dc5a4528c4a512"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/twigphp/Twig/zipball/3566d311a92aae4deec6e48682dc5a4528c4a512",
- "reference": "3566d311a92aae4deec6e48682dc5a4528c4a512",
- "shasum": ""
- },
- "require": {
- "php": ">=5.2.7"
- },
- "require-dev": {
- "symfony/debug": "~2.7",
- "symfony/phpunit-bridge": "~2.7"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.24-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Twig_": "lib/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com",
- "homepage": "http://fabien.potencier.org",
- "role": "Lead Developer"
- },
- {
- "name": "Armin Ronacher",
- "email": "armin.ronacher@active-4.com",
- "role": "Project Founder"
- },
- {
- "name": "Twig Team",
- "homepage": "http://twig.sensiolabs.org/contributors",
- "role": "Contributors"
- }
- ],
- "description": "Twig, the flexible, fast, and secure template language for PHP",
- "homepage": "http://twig.sensiolabs.org",
- "keywords": [
- "templating"
- ],
- "time": "2016-05-30 09:11:59"
- },
- {
- "name": "zendframework/zend-cache",
- "version": "2.7.1",
- "source": {
- "type": "git",
- "url": "https://github.com/zendframework/zend-cache.git",
- "reference": "2c68def8f96ce842d2f2a9a69e2f3508c2f5312d"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/zendframework/zend-cache/zipball/2c68def8f96ce842d2f2a9a69e2f3508c2f5312d",
- "reference": "2c68def8f96ce842d2f2a9a69e2f3508c2f5312d",
- "shasum": ""
- },
- "require": {
- "php": "^5.5 || ^7.0",
- "zendframework/zend-eventmanager": "^2.6.2 || ^3.0",
- "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3",
- "zendframework/zend-stdlib": "^2.7 || ^3.0"
- },
- "require-dev": {
- "fabpot/php-cs-fixer": "1.7.*",
- "phpbench/phpbench": "^0.10.0",
- "phpunit/phpunit": "^4.5",
- "zendframework/zend-serializer": "^2.6",
- "zendframework/zend-session": "^2.6.2"
- },
- "suggest": {
- "ext-apc": "APC or compatible extension, to use the APC storage adapter",
- "ext-apcu": "APCU >= 5.1.0, to use the APCu storage adapter",
- "ext-dba": "DBA, to use the DBA storage adapter",
- "ext-memcache": "Memcache >= 2.0.0 to use the Memcache storage adapter",
- "ext-memcached": "Memcached >= 1.0.0 to use the Memcached storage adapter",
- "ext-mongo": "Mongo, to use MongoDb storage adapter",
- "ext-redis": "Redis, to use Redis storage adapter",
- "ext-wincache": "WinCache, to use the WinCache storage adapter",
- "ext-xcache": "XCache, to use the XCache storage adapter",
- "mongofill/mongofill": "Alternative to ext-mongo - a pure PHP implementation designed as a drop in replacement",
- "zendframework/zend-serializer": "Zend\\Serializer component",
- "zendframework/zend-session": "Zend\\Session component"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.7-dev",
- "dev-develop": "2.8-dev"
- },
- "zf": {
- "component": "Zend\\Cache",
- "config-provider": "Zend\\Cache\\ConfigProvider"
- }
- },
- "autoload": {
- "psr-4": {
- "Zend\\Cache\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "description": "provides a generic way to cache any data",
- "homepage": "https://github.com/zendframework/zend-cache",
- "keywords": [
- "cache",
- "zf2"
- ],
- "time": "2016-05-12 21:47:55"
- },
- {
- "name": "zendframework/zend-config",
- "version": "2.6.0",
- "source": {
- "type": "git",
- "url": "https://github.com/zendframework/zend-config.git",
- "reference": "2920e877a9f6dca9fa8f6bd3b1ffc2e19bb1e30d"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/zendframework/zend-config/zipball/2920e877a9f6dca9fa8f6bd3b1ffc2e19bb1e30d",
- "reference": "2920e877a9f6dca9fa8f6bd3b1ffc2e19bb1e30d",
- "shasum": ""
- },
- "require": {
- "php": "^5.5 || ^7.0",
- "zendframework/zend-stdlib": "^2.7 || ^3.0"
- },
- "require-dev": {
- "fabpot/php-cs-fixer": "1.7.*",
- "phpunit/phpunit": "~4.0",
- "zendframework/zend-filter": "^2.6",
- "zendframework/zend-i18n": "^2.5",
- "zendframework/zend-json": "^2.6.1",
- "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3"
- },
- "suggest": {
- "zendframework/zend-filter": "Zend\\Filter component",
- "zendframework/zend-i18n": "Zend\\I18n component",
- "zendframework/zend-json": "Zend\\Json to use the Json reader or writer classes",
- "zendframework/zend-servicemanager": "Zend\\ServiceManager for use with the Config Factory to retrieve reader and writer instances"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.6-dev",
- "dev-develop": "2.7-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Zend\\Config\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "description": "provides a nested object property based user interface for accessing this configuration data within application code",
- "homepage": "https://github.com/zendframework/zend-config",
- "keywords": [
- "config",
- "zf2"
- ],
- "time": "2016-02-04 23:01:10"
- },
- {
- "name": "zendframework/zend-eventmanager",
- "version": "3.0.1",
- "source": {
- "type": "git",
- "url": "https://github.com/zendframework/zend-eventmanager.git",
- "reference": "5c80bdee0e952be112dcec0968bad770082c3a6e"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/5c80bdee0e952be112dcec0968bad770082c3a6e",
- "reference": "5c80bdee0e952be112dcec0968bad770082c3a6e",
- "shasum": ""
- },
- "require": {
- "php": "^5.5 || ^7.0"
- },
- "require-dev": {
- "athletic/athletic": "^0.1",
- "container-interop/container-interop": "^1.1.0",
- "phpunit/phpunit": "~4.0",
- "squizlabs/php_codesniffer": "^2.0",
- "zendframework/zend-stdlib": "^2.7.3 || ^3.0"
- },
- "suggest": {
- "container-interop/container-interop": "^1.1.0, to use the lazy listeners feature",
- "zendframework/zend-stdlib": "^2.7.3 || ^3.0, to use the FilterChain feature"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "3.0-dev",
- "dev-develop": "3.1-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Zend\\EventManager\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "description": "Trigger and listen to events within a PHP application",
- "homepage": "https://github.com/zendframework/zend-eventmanager",
- "keywords": [
- "event",
- "eventmanager",
- "events",
- "zf2"
- ],
- "time": "2016-02-18 20:53:00"
- },
- {
- "name": "zendframework/zend-filter",
- "version": "2.7.1",
- "source": {
- "type": "git",
- "url": "https://github.com/zendframework/zend-filter.git",
- "reference": "84c50246428efb0a1e52868e162dab3e149d5b80"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/zendframework/zend-filter/zipball/84c50246428efb0a1e52868e162dab3e149d5b80",
- "reference": "84c50246428efb0a1e52868e162dab3e149d5b80",
- "shasum": ""
- },
- "require": {
- "php": "^5.5 || ^7.0",
- "zendframework/zend-stdlib": "^2.7 || ^3.0"
- },
- "require-dev": {
- "fabpot/php-cs-fixer": "1.7.*",
- "pear/archive_tar": "^1.4",
- "phpunit/phpunit": "~4.0",
- "zendframework/zend-crypt": "^2.6",
- "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3",
- "zendframework/zend-uri": "^2.5"
- },
- "suggest": {
- "zendframework/zend-crypt": "Zend\\Crypt component, for encryption filters",
- "zendframework/zend-i18n": "Zend\\I18n component for filters depending on i18n functionality",
- "zendframework/zend-servicemanager": "Zend\\ServiceManager component, for using the filter chain functionality",
- "zendframework/zend-uri": "Zend\\Uri component, for the UriNormalize filter"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.7-dev",
- "dev-develop": "2.8-dev"
- },
- "zf": {
- "component": "Zend\\Filter",
- "config-provider": "Zend\\Filter\\ConfigProvider"
- }
- },
- "autoload": {
- "psr-4": {
- "Zend\\Filter\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "description": "provides a set of commonly needed data filters",
- "homepage": "https://github.com/zendframework/zend-filter",
- "keywords": [
- "filter",
- "zf2"
- ],
- "time": "2016-04-18 18:32:43"
- },
- {
- "name": "zendframework/zend-hydrator",
- "version": "1.1.0",
- "source": {
- "type": "git",
- "url": "https://github.com/zendframework/zend-hydrator.git",
- "reference": "22652e1661a5a10b3f564cf7824a2206cf5a4a65"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/zendframework/zend-hydrator/zipball/22652e1661a5a10b3f564cf7824a2206cf5a4a65",
- "reference": "22652e1661a5a10b3f564cf7824a2206cf5a4a65",
- "shasum": ""
- },
- "require": {
- "php": "^5.5 || ^7.0",
- "zendframework/zend-stdlib": "^2.7 || ^3.0"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.0",
- "squizlabs/php_codesniffer": "^2.0@dev",
- "zendframework/zend-eventmanager": "^2.6.2 || ^3.0",
- "zendframework/zend-filter": "^2.6",
- "zendframework/zend-inputfilter": "^2.6",
- "zendframework/zend-serializer": "^2.6.1",
- "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3"
- },
- "suggest": {
- "zendframework/zend-eventmanager": "^2.6.2 || ^3.0, to support aggregate hydrator usage",
- "zendframework/zend-filter": "^2.6, to support naming strategy hydrator usage",
- "zendframework/zend-serializer": "^2.6.1, to use the SerializableStrategy",
- "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3, to support hydrator plugin manager usage"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-release-1.0": "1.0-dev",
- "dev-release-1.1": "1.1-dev",
- "dev-master": "2.0-dev",
- "dev-develop": "2.1-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Zend\\Hydrator\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "homepage": "https://github.com/zendframework/zend-hydrator",
- "keywords": [
- "hydrator",
- "zf2"
- ],
- "time": "2016-02-18 22:38:26"
- },
- {
- "name": "zendframework/zend-i18n",
- "version": "2.7.3",
- "source": {
- "type": "git",
- "url": "https://github.com/zendframework/zend-i18n.git",
- "reference": "b2db0d8246a865c659f93199f90f5fc2cd2f3cd8"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/b2db0d8246a865c659f93199f90f5fc2cd2f3cd8",
- "reference": "b2db0d8246a865c659f93199f90f5fc2cd2f3cd8",
- "shasum": ""
- },
- "require": {
- "php": "^5.5 || ^7.0",
- "zendframework/zend-stdlib": "^2.7 || ^3.0"
- },
- "require-dev": {
- "fabpot/php-cs-fixer": "1.7.*",
- "phpunit/phpunit": "~4.0",
- "zendframework/zend-cache": "^2.6.1",
- "zendframework/zend-config": "^2.6",
- "zendframework/zend-eventmanager": "^2.6.2 || ^3.0",
- "zendframework/zend-filter": "^2.6.1",
- "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3",
- "zendframework/zend-validator": "^2.6",
- "zendframework/zend-view": "^2.6.3"
- },
- "suggest": {
- "ext-intl": "Required for most features of Zend\\I18n; included in default builds of PHP",
- "zendframework/zend-cache": "Zend\\Cache component",
- "zendframework/zend-config": "Zend\\Config component",
- "zendframework/zend-eventmanager": "You should install this package to use the events in the translator",
- "zendframework/zend-filter": "You should install this package to use the provided filters",
- "zendframework/zend-i18n-resources": "Translation resources",
- "zendframework/zend-servicemanager": "Zend\\ServiceManager component",
- "zendframework/zend-validator": "You should install this package to use the provided validators",
- "zendframework/zend-view": "You should install this package to use the provided view helpers"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.7-dev",
- "dev-develop": "2.8-dev"
- },
- "zf": {
- "component": "Zend\\I18n",
- "config-provider": "Zend\\I18n\\ConfigProvider"
- }
- },
- "autoload": {
- "psr-4": {
- "Zend\\I18n\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "homepage": "https://github.com/zendframework/zend-i18n",
- "keywords": [
- "i18n",
- "zf2"
- ],
- "time": "2016-06-07 21:08:30"
- },
- {
- "name": "zendframework/zend-json",
- "version": "3.0.0",
- "source": {
- "type": "git",
- "url": "https://github.com/zendframework/zend-json.git",
- "reference": "f42a1588e75c2a3e338cd94c37906231e616daab"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/zendframework/zend-json/zipball/f42a1588e75c2a3e338cd94c37906231e616daab",
- "reference": "f42a1588e75c2a3e338cd94c37906231e616daab",
- "shasum": ""
- },
- "require": {
- "php": "^5.5 || ^7.0"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.0",
- "squizlabs/php_codesniffer": "^2.3",
- "zendframework/zend-stdlib": "^2.7 || ^3.0"
- },
- "suggest": {
- "zendframework/zend-json-server": "For implementing JSON-RPC servers",
- "zendframework/zend-xml2json": "For converting XML documents to JSON"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "3.0-dev",
- "dev-develop": "3.1-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Zend\\Json\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "description": "provides convenience methods for serializing native PHP to JSON and decoding JSON to native PHP",
- "homepage": "https://github.com/zendframework/zend-json",
- "keywords": [
- "json",
- "zf2"
- ],
- "time": "2016-04-01 02:34:00"
- },
- {
- "name": "zendframework/zend-serializer",
- "version": "2.8.0",
- "source": {
- "type": "git",
- "url": "https://github.com/zendframework/zend-serializer.git",
- "reference": "ff74ea020f5f90866eb28365327e9bc765a61a6e"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/zendframework/zend-serializer/zipball/ff74ea020f5f90866eb28365327e9bc765a61a6e",
- "reference": "ff74ea020f5f90866eb28365327e9bc765a61a6e",
- "shasum": ""
- },
- "require": {
- "php": "^5.6 || ^7.0",
- "zendframework/zend-json": "^2.5 || ^3.0",
- "zendframework/zend-stdlib": "^2.7 || ^3.0"
- },
- "require-dev": {
- "phpunit/phpunit": "^4.5",
- "squizlabs/php_codesniffer": "^2.3.1",
- "zendframework/zend-math": "^2.6",
- "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3"
- },
- "suggest": {
- "zendframework/zend-math": "(^2.6 || ^3.0) To support Python Pickle serialization",
- "zendframework/zend-servicemanager": "(^2.7.5 || ^3.0.3) To support plugin manager support"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.8-dev",
- "dev-develop": "2.9-dev"
- },
- "zf": {
- "component": "Zend\\Serializer",
- "config-provider": "Zend\\Serializer\\ConfigProvider"
- }
- },
- "autoload": {
- "psr-4": {
- "Zend\\Serializer\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "description": "provides an adapter based interface to simply generate storable representation of PHP types by different facilities, and recover",
- "homepage": "https://github.com/zendframework/zend-serializer",
- "keywords": [
- "serializer",
- "zf2"
- ],
- "time": "2016-06-21 17:01:55"
- },
- {
- "name": "zendframework/zend-servicemanager",
- "version": "2.7.6",
- "source": {
- "type": "git",
- "url": "https://github.com/zendframework/zend-servicemanager.git",
- "reference": "a6db4d13b9141fccce5dcb553df0295d6ad7d477"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/zendframework/zend-servicemanager/zipball/a6db4d13b9141fccce5dcb553df0295d6ad7d477",
- "reference": "a6db4d13b9141fccce5dcb553df0295d6ad7d477",
- "shasum": ""
- },
- "require": {
- "container-interop/container-interop": "~1.0",
- "php": "^5.5 || ^7.0"
- },
- "require-dev": {
- "athletic/athletic": "dev-master",
- "fabpot/php-cs-fixer": "1.7.*",
- "phpunit/phpunit": "~4.0",
- "zendframework/zend-di": "~2.5",
- "zendframework/zend-mvc": "~2.5"
- },
- "suggest": {
- "ocramius/proxy-manager": "ProxyManager 0.5.* to handle lazy initialization of services",
- "zendframework/zend-di": "Zend\\Di component"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.7-dev",
- "dev-develop": "3.0-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Zend\\ServiceManager\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "homepage": "https://github.com/zendframework/zend-servicemanager",
- "keywords": [
- "servicemanager",
- "zf2"
- ],
- "time": "2016-04-27 19:07:40"
- },
- {
- "name": "zendframework/zend-stdlib",
- "version": "2.7.7",
- "source": {
- "type": "git",
- "url": "https://github.com/zendframework/zend-stdlib.git",
- "reference": "0e44eb46788f65e09e077eb7f44d2659143bcc1f"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/0e44eb46788f65e09e077eb7f44d2659143bcc1f",
- "reference": "0e44eb46788f65e09e077eb7f44d2659143bcc1f",
- "shasum": ""
- },
- "require": {
- "php": "^5.5 || ^7.0",
- "zendframework/zend-hydrator": "~1.1"
- },
- "require-dev": {
- "athletic/athletic": "~0.1",
- "fabpot/php-cs-fixer": "1.7.*",
- "phpunit/phpunit": "~4.0",
- "zendframework/zend-config": "~2.5",
- "zendframework/zend-eventmanager": "~2.5",
- "zendframework/zend-filter": "~2.5",
- "zendframework/zend-inputfilter": "~2.5",
- "zendframework/zend-serializer": "~2.5",
- "zendframework/zend-servicemanager": "~2.5"
- },
- "suggest": {
- "zendframework/zend-eventmanager": "To support aggregate hydrator usage",
- "zendframework/zend-filter": "To support naming strategy hydrator usage",
- "zendframework/zend-serializer": "Zend\\Serializer component",
- "zendframework/zend-servicemanager": "To support hydrator plugin manager usage"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-release-2.7": "2.7-dev",
- "dev-master": "3.0-dev",
- "dev-develop": "3.1-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Zend\\Stdlib\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "homepage": "https://github.com/zendframework/zend-stdlib",
- "keywords": [
- "stdlib",
- "zf2"
- ],
- "time": "2016-04-12 21:17:31"
- },
- {
- "name": "zetacomponents/base",
- "version": "1.9",
- "source": {
- "type": "git",
- "url": "https://github.com/zetacomponents/Base.git",
- "reference": "f20df24e8de3e48b6b69b2503f917e457281e687"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/zetacomponents/Base/zipball/f20df24e8de3e48b6b69b2503f917e457281e687",
- "reference": "f20df24e8de3e48b6b69b2503f917e457281e687",
- "shasum": ""
- },
- "require-dev": {
- "zetacomponents/unit-test": "*"
- },
- "type": "library",
- "autoload": {
- "classmap": [
- "src"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "Apache-2.0"
- ],
- "authors": [
- {
- "name": "Sergey Alexeev"
- },
- {
- "name": "Sebastian Bergmann"
- },
- {
- "name": "Jan Borsodi"
- },
- {
- "name": "Raymond Bosman"
- },
- {
- "name": "Frederik Holljen"
- },
- {
- "name": "Kore Nordmann"
- },
- {
- "name": "Derick Rethans"
- },
- {
- "name": "Vadym Savchuk"
- },
- {
- "name": "Tobias Schlitt"
- },
- {
- "name": "Alexandru Stanoi"
- }
- ],
- "description": "The Base package provides the basic infrastructure that all packages rely on. Therefore every component relies on this package.",
- "homepage": "https://github.com/zetacomponents",
- "time": "2014-09-19 03:28:34"
- },
- {
- "name": "zetacomponents/document",
- "version": "1.3.1",
- "source": {
- "type": "git",
- "url": "https://github.com/zetacomponents/Document.git",
- "reference": "688abfde573cf3fe0730f82538fbd7aa9fc95bc8"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/zetacomponents/Document/zipball/688abfde573cf3fe0730f82538fbd7aa9fc95bc8",
- "reference": "688abfde573cf3fe0730f82538fbd7aa9fc95bc8",
- "shasum": ""
- },
- "require": {
- "zetacomponents/base": "*"
- },
- "require-dev": {
- "zetacomponents/unit-test": "dev-master"
- },
- "type": "library",
- "autoload": {
- "classmap": [
- "src"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "Apache-2.0"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann"
- },
- {
- "name": "Kore Nordmann"
- },
- {
- "name": "Derick Rethans"
- },
- {
- "name": "Tobias Schlitt"
- },
- {
- "name": "Alexandru Stanoi"
- }
- ],
- "description": "The Document components provides a general conversion framework for different semantic document markup languages like XHTML, Docbook, RST and similar.",
- "homepage": "https://github.com/zetacomponents",
- "time": "2013-12-19 11:40:00"
- }
- ],
- "aliases": [],
- "minimum-stability": "stable",
- "stability-flags": [],
- "prefer-stable": false,
- "prefer-lowest": false,
- "platform": {
- "php": ">=5.0.0"
- },
- "platform-dev": []
-}
+++ /dev/null
-NEW CALLBACK FUNCTION:
-======================
-
-We have had requests for a method to process the results of sending emails
-through PHPMailer. In this new release, we have implemented a callback
-function that passes the results of each email sent (to, cc, and/or bcc).
-We have provided an example that echos the results back to the screen. The
-callback function can be used for any purpose. With minor modifications, the
-callback function can be used to create CSV logs, post results to databases,
-etc.
-
-Please review the test.php script for the example.
-
-It's pretty straight forward.
-
-Enjoy!
-Andy
+++ /dev/null
-CREATE DKIM KEYS and DNS Resource Record:
-=========================================
-
-To create DomainKeys Identified Mail keys, visit:
-http://dkim.worxware.com/
-... read the information, fill in the form, and download the ZIP file
-containing the public key, private key, DNS Resource Record and instructions
-to add to your DNS Zone Record, and the PHPMailer code to enable DKIM
-digital signing.
-
-/*** PROTECT YOUR PRIVATE & PUBLIC KEYS ***/
-
-You need to protect your DKIM private and public keys from being viewed or
-accessed. Add protection to your .htaccess file as in this example:
-
-# secure htkeyprivate file
-<Files .htkeyprivate>
- order allow,deny
- deny from all
-</Files>
-
-# secure htkeypublic file
-<Files .htkeypublic>
- order allow,deny
- deny from all
-</Files>
-
-(the actual .htaccess additions are in the ZIP file sent back to you from
-http://dkim.worxware.com/
-
-A few notes on using DomainKey Identified Mail (DKIM):
-
-You do not need to use PHPMailer to DKIM sign emails IF:
-- you enable DomainKey support and add the DNS resource record
-- you use your outbound mail server
-
-If you are a third-party emailer that works on behalf of domain owners to
-send their emails from your own server:
-- you absolutely have to DKIM sign outbound emails
-- the domain owner has to add the DNS resource record to match the
- private key, public key, selector, identity, and domain that you create
-- use caution with the "selector" ... at least one "selector" will already
- exist in the DNS Zone Record of the domain at the domain owner's server
- you need to ensure that the "selector" you use is unique
-Note: since the IP address will not match the domain owner's DNS Zone record
-you can be certain that email providers that validate based on DomainKey will
-check the domain owner's DNS Zone record for your DNS resource record. Before
-sending out emails on behalf of domain owners, ensure they have entered the
-DNS resource record you provided them.
-
-Enjoy!
-Andy
-
-PS. if you need additional information about DKIM, please see:
-http://www.dkim.org/info/dkim-faq.html
+++ /dev/null
-If you are having problems connecting or sending emails through your SMTP server, the SMTP class can provide more information about the processing/errors taking place.
-Use the debug functionality of the class to see what's going on in your connections. To do that, set the debug level in your script. For example:
-
-$mail->SMTPDebug = 1;
-$mail->isSMTP(); // telling the class to use SMTP
-$mail->SMTPAuth = true; // enable SMTP authentication
-$mail->Port = 26; // set the SMTP port
-$mail->Host = "mail.yourhost.com"; // SMTP server
-$mail->Username = "name@yourhost.com"; // SMTP account username
-$mail->Password = "your password"; // SMTP account password
-
-Notes on this:
-$mail->SMTPDebug = 0; ... will disable debugging (you can also leave this out completely, 0 is the default)
-$mail->SMTPDebug = 1; ... will echo errors and server responses
-$mail->SMTPDebug = 2; ... will echo errors, server responses and client messages
-
-And finally, don't forget to disable debugging before going into production.
+++ /dev/null
-<html>
-<head>
-<title>Examples using phpmailer</title>
-</head>
-
-<body>
-
-<h2>Examples using PHPMailer</h2>
-
-<h3>1. Advanced Example</h3>
-<p>
-
-This demonstrates sending multiple email messages with binary attachments
-from a MySQL database using multipart/alternative messages.<p>
-
-<pre>
-require 'PHPMailerAutoload.php';
-
-$mail = new PHPMailer();
-
-$mail->setFrom('list@example.com', 'List manager');
-$mail->Host = 'smtp1.example.com;smtp2.example.com';
-$mail->Mailer = 'smtp';
-
-@mysqli_connect('localhost','root','password');
-@mysqli_select_db("my_company");
-$query = "SELECT full_name, email, photo FROM employee";
-$result = @mysqli_query($query);
-
-while ($row = mysqli_fetch_assoc($result))
-{
- // HTML body
- $body = "Hello <font size=\"4\">" . $row['full_name'] . "</font>, <p>";
- $body .= "<i>Your</i> personal photograph to this message.<p>";
- $body .= "Sincerely, <br>";
- $body .= "phpmailer List manager";
-
- // Plain text body (for mail clients that cannot read HTML)
- $text_body = 'Hello ' . $row['full_name'] . ", \n\n";
- $text_body .= "Your personal photograph to this message.\n\n";
- $text_body .= "Sincerely, \n";
- $text_body .= 'phpmailer List manager';
-
- $mail->Body = $body;
- $mail->AltBody = $text_body;
- $mail->addAddress($row['email'], $row['full_name']);
- $mail->addStringAttachment($row['photo'], 'YourPhoto.jpg');
-
- if(!$mail->send())
- echo "There has been a mail error sending to " . $row['email'] . "<br>";
-
- // Clear all addresses and attachments for next loop
- $mail->clearAddresses();
- $mail->clearAttachments();
-}
-</pre>
-<p>
-
-<h3>2. Extending PHPMailer</h3>
-<p>
-
-Extending classes with inheritance is one of the most
-powerful features of object-oriented programming. It allows you to make changes to the
-original class for your own personal use without hacking the original
-classes, and it's very easy to do:
-
-<p>
-Here's a class that extends the phpmailer class and sets the defaults
-for the particular site:<br>
-PHP include file: my_phpmailer.php
-<p>
-
-<pre>
-require 'PHPMailerAutoload.php';
-
-class my_phpmailer extends PHPMailer {
- // Set default variables for all new objects
- public $From = 'from@example.com';
- public $FromName = 'Mailer';
- public $Host = 'smtp1.example.com;smtp2.example.com';
- public $Mailer = 'smtp'; // Alternative to isSMTP()
- public $WordWrap = 75;
-
- // Replace the default debug output function
- protected function edebug($msg) {
- print('My Site Error');
- print('Description:');
- printf('%s', $msg);
- exit;
- }
-
- //Extend the send function
- public function send() {
- $this->Subject = '[Yay for me!] '.$this->Subject;
- return parent::send()
- }
-
- // Create an additional function
- public function do_something($something) {
- // Place your new code here
- }
-}
-</pre>
-<br>
-Now here's a normal PHP page in the site, which will have all the defaults set above:<br>
-
-<pre>
-require 'my_phpmailer.php';
-
-// Instantiate your new class
-$mail = new my_phpmailer;
-
-// Now you only need to add the necessary stuff
-$mail->addAddress('josh@example.com', 'Josh Adams');
-$mail->Subject = 'Here is the subject';
-$mail->Body = 'This is the message body';
-$mail->addAttachment('c:/temp/11-10-00.zip', 'new_name.zip'); // optional name
-
-if(!$mail->send())
-{
- echo 'There was an error sending the message';
- exit;
-}
-
-echo 'Message was sent successfully';
-</pre>
-</body>
-</html>
+++ /dev/null
-<html>
-<head>
-<title>PHPMailer FAQ</title>
-</head>
-<body>
-<h2>PHPMailer FAQ</h2>
-<ul>
- <li><strong>Q: I am concerned that using include files will take up too much
- processing time on my computer. How can I make it run faster?</strong><br>
- <strong>A:</strong> PHP by itself is fairly fast, but it recompiles scripts every time they are run, which takes up valuable
- computer resources. You can bypass this by using an opcode cache which compiles
- PHP code and store it in memory to reduce overhead immensely. <a href="http://www.php.net/apc/">APC
- (Alternative PHP Cache)</a> is a free opcode cache extension in the PECL library.</li>
- <li><strong>Q: Which mailer gives me the best performance?</strong><br>
- <strong>A:</strong> On a single machine the <strong>sendmail (or Qmail)</strong> is fastest overall.
- Next fastest is mail() to give you the best performance. Both do not have the overhead of SMTP.
- If you do not have a local mail server (as is typical on Windows), SMTP is your only option.</li>
- <li><strong>Q: When I try to attach a file with on my server I get a
- "Could not find {file} on filesystem error". Why is this?</strong><br>
- <strong>A:</strong> If you are using a Unix machine this is probably because the user
- running your web server does not have read access to the directory in question. If you are using Windows,
- then the problem is probably that you have used single backslashes to denote directories (\).
- A single backslash has a special meaning to PHP so these are not
- valid. Instead use double backslashes ("\\") or a single forward
- slash ("/").</li>
-</ul>
-</body>
-</html>
+++ /dev/null
-#!/bin/sh
-# Regenerate PHPMailer documentation
-# Run from within the docs folder
-rm -rf phpdoc/*
-phpdoc --directory .. --target ./phpdoc --ignore test/,examples/,extras/,test_script/,vendor/,language/ --sourcecode --force --title PHPMailer --template="clean"
-# You can merge regenerated docs into a separate docs working copy without messing up the git status like so:
-# rsync -a --delete --exclude ".git" --exclude "phpdoc-cache-*/" --exclude "README.md" phpdoc/ ../../phpmailer-docs
-# After updating docs, push/PR them to the phpmailer gh-pages branch: https://github.com/PHPMailer/PHPMailer/tree/gh-pages
+++ /dev/null
-This is built for PHP Mailer 1.72 and was not tested with any previous version. It was developed under PHP 4.3.11 (E_ALL). It works under PHP 5 and 5.1 with E_ALL, but not in Strict mode due to var deprecation (but then neither does PHP Mailer either!). It follows the RFC 1939 standard explicitly and is fully commented.
-
-With that noted, here is how to implement it:
-
-I didn't want to modify the PHP Mailer classes at all, so you will have to include/require this class along with the base one. It can sit quite happily in the phpmailer directory.
-
-When you need it, create your POP3 object
-
-Right before I invoke PHP Mailer I activate the POP3 authorisation. POP3 before SMTP is a process whereby you login to your web hosts POP3 mail server BEFORE sending out any emails via SMTP. The POP3 logon 'verifies' your ability to send email by SMTP, which typically otherwise blocks you. On my web host (Pair Networks) a single POP3 logon is enough to 'verify' you for 90 minutes. Here is some sample PHP code that activates the POP3 logon and then sends an email via PHP Mailer:
-
-<?php
-$pop->authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1);
-$mail = new PHPMailer(); $mail->SMTPDebug = 2; $mail->isSMTP();
-$mail->isHTML(false); $mail->Host = 'relay.example.com';
-$mail->From = 'mailer@example.com';
-$mail->FromName = 'Example Mailer';
-$mail->Subject = 'My subject';
-$mail->Body = 'Hello world';
-$mail->addAddress('rich@corephp.co.uk', 'Richard Davey');
-if (!$mail->send()) {
- echo $mail->ErrorInfo;
-}
-?>
-
-The PHP Mailer parts of this code should be obvious to anyone who has used PHP Mailer before. One thing to note - you almost certainly will not need to use SMTP Authentication *and* POP3 before SMTP together. The Authorisation method is a proxy method to all of the others within that class. There are connect, Logon and disconnect methods available, but I wrapped them in the single Authorisation one to make things easier.
-The Parameters
-
-The authorise parameters are as follows:
-
-$pop->authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1);
-
- 1. pop3.example.com - The POP3 Mail Server Name (hostname or IP address)
- 2. 110 - The POP3 Port on which to connect (default is usually 110, but check with your host)
- 3. 30 - A connection time-out value (in seconds)
- 4. mailer - The POP3 Username required to logon
- 5. password - The POP3 Password required to logon
- 6. 1 - The class debug level (0 = off, 1+ = debug output is echoed to the browser)
-
-Final Comments + the Download
-
-1) This class does not support APOP connections. This is only because I did not have an APOP server to test with, but if you'd like to see that added just contact me.
-
-2) Opening and closing lots of POP3 connections can be quite a resource/network drain. If you need to send a whole batch of emails then just perform the authentication once at the start, and then loop through your mail sending script. Providing this process doesn't take longer than the verification period lasts on your POP3 server, you should be fine. With my host that period is 90 minutes, i.e. plenty of time.
-
-3) If you have heavy requirements for this script (i.e. send a LOT of email on a frequent basis) then I would advise seeking out an alternative sending method (direct SMTP ideally). If this isn't possible then you could modify this class so the 'last authorised' date is recorded somewhere (MySQL, Flat file, etc) meaning you only open a new connection if the old one has expired, saving you precious overhead.
-
-4) There are lots of other POP3 classes for PHP available. However most of them implement the full POP3 command set, where-as this one is purely for authentication, and much lighter as a result. However using any of the other POP3 classes to just logon to your server would have the same net result. At the end of the day, use whatever method you feel most comfortable with.
-Download
-
-My thanks to Chris Ryan for the inspiration (even if indirectly, via his SMTP class)
+++ /dev/null
-<?php
-/**
- * This example shows how to use DKIM message authentication with PHPMailer.
- * There's more to using DKIM than just this code - check out this article:
- * @link https://yomotherboard.com/how-to-setup-email-server-dkim-keys/
- * See also the DKIM code in the PHPMailer unit tests,
- * which shows how to make a key pair from PHP.
- */
-
-require '../PHPMailerAutoload.php';
-
-//Create a new PHPMailer instance
-$mail = new PHPMailer;
-//Set who the message is to be sent from
-$mail->setFrom('from@example.com', 'First Last');
-//Set an alternative reply-to address
-$mail->addReplyTo('replyto@example.com', 'First Last');
-//Set who the message is to be sent to
-$mail->addAddress('whoto@example.com', 'John Doe');
-//Set the subject line
-$mail->Subject = 'PHPMailer DKIM test';
-//This should be the same as the domain of your From address
-$mail->DKIM_domain = 'example.com';
-//Path to your private key file
-$mail->DKIM_private = 'dkim_private.pem';
-//Set this to your own selector
-$mail->DKIM_selector = 'phpmailer';
-//If your private key has a passphrase, set it here
-$mail->DKIM_passphrase = '';
-//The identity you're signing as - usually your From address
-$mail->DKIM_identity = $mail->From;
-
-//send the message, check for errors
-if (!$mail->send()) {
- echo "Mailer Error: " . $mail->ErrorInfo;
-} else {
- echo "Message sent!";
-}
+++ /dev/null
-<?php
-/*
- * A web form that both generates and uses PHPMailer code.
- * revised, updated and corrected 27/02/2013
- * by matt.sturdy@gmail.com
- */
-require '../PHPMailerAutoload.php';
-
-$CFG['smtp_debug'] = 2; //0 == off, 1 for client output, 2 for client and server
-$CFG['smtp_debugoutput'] = 'html';
-$CFG['smtp_server'] = 'localhost';
-$CFG['smtp_port'] = '25';
-$CFG['smtp_authenticate'] = false;
-$CFG['smtp_username'] = 'name@example.com';
-$CFG['smtp_password'] = 'yourpassword';
-$CFG['smtp_secure'] = 'None';
-
-$from_name = (isset($_POST['From_Name'])) ? $_POST['From_Name'] : '';
-$from_email = (isset($_POST['From_Email'])) ? $_POST['From_Email'] : '';
-$to_name = (isset($_POST['To_Name'])) ? $_POST['To_Name'] : '';
-$to_email = (isset($_POST['To_Email'])) ? $_POST['To_Email'] : '';
-$cc_email = (isset($_POST['cc_Email'])) ? $_POST['cc_Email'] : '';
-$bcc_email = (isset($_POST['bcc_Email'])) ? $_POST['bcc_Email'] : '';
-$subject = (isset($_POST['Subject'])) ? $_POST['Subject'] : '';
-$message = (isset($_POST['Message'])) ? $_POST['Message'] : '';
-$test_type = (isset($_POST['test_type'])) ? $_POST['test_type'] : 'smtp';
-$smtp_debug = (isset($_POST['smtp_debug'])) ? $_POST['smtp_debug'] : $CFG['smtp_debug'];
-$smtp_server = (isset($_POST['smtp_server'])) ? $_POST['smtp_server'] : $CFG['smtp_server'];
-$smtp_port = (isset($_POST['smtp_port'])) ? $_POST['smtp_port'] : $CFG['smtp_port'];
-$smtp_secure = strtolower((isset($_POST['smtp_secure'])) ? $_POST['smtp_secure'] : $CFG['smtp_secure']);
-$smtp_authenticate = (isset($_POST['smtp_authenticate'])) ?
- $_POST['smtp_authenticate'] : $CFG['smtp_authenticate'];
-$authenticate_password = (isset($_POST['authenticate_password'])) ?
- $_POST['authenticate_password'] : $CFG['smtp_password'];
-$authenticate_username = (isset($_POST['authenticate_username'])) ?
- $_POST['authenticate_username'] : $CFG['smtp_username'];
-
-// storing all status output from the script to be shown to the user later
-$results_messages = array();
-
-// $example_code represents the "final code" that we're using, and will
-// be shown to the user at the end.
-$example_code = "\nrequire_once '../PHPMailerAutoload.php';";
-$example_code .= "\n\n\$results_messages = array();";
-
-$mail = new PHPMailer(true); //PHPMailer instance with exceptions enabled
-$mail->CharSet = 'utf-8';
-ini_set('default_charset', 'UTF-8');
-$mail->Debugoutput = $CFG['smtp_debugoutput'];
-$example_code .= "\n\n\$mail = new PHPMailer(true);";
-$example_code .= "\n\$mail->CharSet = 'utf-8';";
-$example_code .= "\nini_set('default_charset', 'UTF-8');";
-
-class phpmailerAppException extends phpmailerException
-{
-}
-
-$example_code .= "\n\nclass phpmailerAppException extends phpmailerException {}";
-$example_code .= "\n\ntry {";
-
-try {
- if (isset($_POST["submit"]) && $_POST['submit'] == "Submit") {
- $to = $_POST['To_Email'];
- if (!PHPMailer::validateAddress($to)) {
- throw new phpmailerAppException("Email address " . $to . " is invalid -- aborting!");
- }
-
- $example_code .= "\n\$to = '{$_POST['To_Email']}';";
- $example_code .= "\nif(!PHPMailer::validateAddress(\$to)) {";
- $example_code .= "\n throw new phpmailerAppException(\"Email address \" . " .
- "\$to . \" is invalid -- aborting!\");";
- $example_code .= "\n}";
-
- switch ($_POST['test_type']) {
- case 'smtp':
- $mail->isSMTP(); // telling the class to use SMTP
- $mail->SMTPDebug = (integer)$_POST['smtp_debug'];
- $mail->Host = $_POST['smtp_server']; // SMTP server
- $mail->Port = (integer)$_POST['smtp_port']; // set the SMTP port
- if ($_POST['smtp_secure']) {
- $mail->SMTPSecure = strtolower($_POST['smtp_secure']);
- }
- $mail->SMTPAuth = array_key_exists('smtp_authenticate', $_POST); // enable SMTP authentication?
- if (array_key_exists('smtp_authenticate', $_POST)) {
- $mail->Username = $_POST['authenticate_username']; // SMTP account username
- $mail->Password = $_POST['authenticate_password']; // SMTP account password
- }
-
- $example_code .= "\n\$mail->isSMTP();";
- $example_code .= "\n\$mail->SMTPDebug = " . $_POST['smtp_debug'] . ";";
- $example_code .= "\n\$mail->Host = \"" . $_POST['smtp_server'] . "\";";
- $example_code .= "\n\$mail->Port = \"" . $_POST['smtp_port'] . "\";";
- $example_code .= "\n\$mail->SMTPSecure = \"" . strtolower($_POST['smtp_secure']) . "\";";
- $example_code .= "\n\$mail->SMTPAuth = " . (array_key_exists(
- 'smtp_authenticate',
- $_POST
- ) ? 'true' : 'false') . ";";
- if (array_key_exists('smtp_authenticate', $_POST)) {
- $example_code .= "\n\$mail->Username = \"" . $_POST['authenticate_username'] . "\";";
- $example_code .= "\n\$mail->Password = \"" . $_POST['authenticate_password'] . "\";";
- }
- break;
- case 'mail':
- $mail->isMail(); // telling the class to use PHP's mail()
- $example_code .= "\n\$mail->isMail();";
- break;
- case 'sendmail':
- $mail->isSendmail(); // telling the class to use Sendmail
- $example_code .= "\n\$mail->isSendmail();";
- break;
- case 'qmail':
- $mail->isQmail(); // telling the class to use Qmail
- $example_code .= "\n\$mail->isQmail();";
- break;
- default:
- throw new phpmailerAppException('Invalid test_type provided');
- }
-
- try {
- if ($_POST['From_Name'] != '') {
- $mail->addReplyTo($_POST['From_Email'], $_POST['From_Name']);
- $mail->setFrom($_POST['From_Email'], $_POST['From_Name']);
-
- $example_code .= "\n\$mail->addReplyTo(\"" .
- $_POST['From_Email'] . "\", \"" . $_POST['From_Name'] . "\");";
- $example_code .= "\n\$mail->setFrom(\"" .
- $_POST['From_Email'] . "\", \"" . $_POST['From_Name'] . "\");";
- } else {
- $mail->addReplyTo($_POST['From_Email']);
- $mail->setFrom($_POST['From_Email'], $_POST['From_Email']);
-
- $example_code .= "\n\$mail->addReplyTo(\"" . $_POST['From_Email'] . "\");";
- $example_code .= "\n\$mail->setFrom(\"" .
- $_POST['From_Email'] . "\", \"" . $_POST['From_Email'] . "\");";
- }
-
- if ($_POST['To_Name'] != '') {
- $mail->addAddress($to, $_POST['To_Name']);
- $example_code .= "\n\$mail->addAddress(\"$to\", \"" . $_POST['To_Name'] . "\");";
- } else {
- $mail->addAddress($to);
- $example_code .= "\n\$mail->addAddress(\"$to\");";
- }
-
- if ($_POST['bcc_Email'] != '') {
- $indiBCC = explode(" ", $_POST['bcc_Email']);
- foreach ($indiBCC as $key => $value) {
- $mail->addBCC($value);
- $example_code .= "\n\$mail->addBCC(\"$value\");";
- }
- }
-
- if ($_POST['cc_Email'] != '') {
- $indiCC = explode(" ", $_POST['cc_Email']);
- foreach ($indiCC as $key => $value) {
- $mail->addCC($value);
- $example_code .= "\n\$mail->addCC(\"$value\");";
- }
- }
- } catch (phpmailerException $e) { //Catch all kinds of bad addressing
- throw new phpmailerAppException($e->getMessage());
- }
- $mail->Subject = $_POST['Subject'] . ' (PHPMailer test using ' . strtoupper($_POST['test_type']) . ')';
- $example_code .= "\n\$mail->Subject = \"" . $_POST['Subject'] .
- ' (PHPMailer test using ' . strtoupper($_POST['test_type']) . ')";';
-
- if ($_POST['Message'] == '') {
- $body = file_get_contents('contents.html');
- } else {
- $body = $_POST['Message'];
- }
-
- $example_code .= "\n\$body = <<<'EOT'\n" . htmlentities($body) . "\nEOT;";
-
- $mail->WordWrap = 78; // set word wrap to the RFC2822 limit
- $mail->msgHTML($body, dirname(__FILE__), true); //Create message bodies and embed images
-
- $example_code .= "\n\$mail->WordWrap = 78;";
- $example_code .= "\n\$mail->msgHTML(\$body, dirname(__FILE__), true); //Create message bodies and embed images";
-
- $mail->addAttachment('images/phpmailer_mini.png', 'phpmailer_mini.png'); // optional name
- $mail->addAttachment('images/phpmailer.png', 'phpmailer.png'); // optional name
- $example_code .= "\n\$mail->addAttachment('images/phpmailer_mini.png'," .
- "'phpmailer_mini.png'); // optional name";
- $example_code .= "\n\$mail->addAttachment('images/phpmailer.png', 'phpmailer.png'); // optional name";
-
- $example_code .= "\n\ntry {";
- $example_code .= "\n \$mail->send();";
- $example_code .= "\n \$results_messages[] = \"Message has been sent using " .
- strtoupper($_POST['test_type']) . "\";";
- $example_code .= "\n}";
- $example_code .= "\ncatch (phpmailerException \$e) {";
- $example_code .= "\n throw new phpmailerAppException('Unable to send to: ' . \$to. ': '.\$e->getMessage());";
- $example_code .= "\n}";
-
- try {
- $mail->send();
- $results_messages[] = "Message has been sent using " . strtoupper($_POST["test_type"]);
- } catch (phpmailerException $e) {
- throw new phpmailerAppException("Unable to send to: " . $to . ': ' . $e->getMessage());
- }
- }
-} catch (phpmailerAppException $e) {
- $results_messages[] = $e->errorMessage();
-}
-$example_code .= "\n}";
-$example_code .= "\ncatch (phpmailerAppException \$e) {";
-$example_code .= "\n \$results_messages[] = \$e->errorMessage();";
-$example_code .= "\n}";
-$example_code .= "\n\nif (count(\$results_messages) > 0) {";
-$example_code .= "\n echo \"<h2>Run results</h2>\\n\";";
-$example_code .= "\n echo \"<ul>\\n\";";
-$example_code .= "\nforeach (\$results_messages as \$result) {";
-$example_code .= "\n echo \"<li>\$result</li>\\n\";";
-$example_code .= "\n}";
-$example_code .= "\necho \"</ul>\\n\";";
-$example_code .= "\n}";
-?><!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>PHPMailer Test Page</title>
- <script type="text/javascript" src="scripts/shCore.js"></script>
- <script type="text/javascript" src="scripts/shBrushPhp.js"></script>
- <link type="text/css" rel="stylesheet" href="styles/shCore.css">
- <link type="text/css" rel="stylesheet" href="styles/shThemeDefault.css">
- <style>
- body {
- font-family: Arial, Helvetica, sans-serif;
- font-size: 1em;
- padding: 1em;
- }
-
- table {
- margin: 0 auto;
- border-spacing: 0;
- border-collapse: collapse;
- }
-
- table.column {
- border-collapse: collapse;
- background-color: #FFFFFF;
- padding: 0.5em;
- width: 35em;
- }
-
- td {
- font-size: 1em;
- padding: 0.1em 0.25em;
- -moz-border-radius: 1em;
- -webkit-border-radius: 1em;
- border-radius: 1em;
- }
-
- td.colleft {
- text-align: right;
- width: 35%;
- }
-
- td.colrite {
- text-align: left;
- width: 65%;
- }
-
- fieldset {
- padding: 1em 1em 1em 1em;
- margin: 0 2em;
- border-radius: 1.5em;
- -webkit-border-radius: 1em;
- -moz-border-radius: 1em;
- }
-
- fieldset.inner {
- width: 40%;
- }
-
- fieldset:hover, tr:hover {
- background-color: #fafafa;
- }
-
- legend {
- font-weight: bold;
- font-size: 1.1em;
- }
-
- div.column-left {
- float: left;
- width: 45em;
- height: 31em;
- }
-
- div.column-right {
- display: inline;
- width: 45em;
- max-height: 31em;
- }
-
- input.radio {
- float: left;
- }
-
- div.radio {
- padding: 0.2em;
- }
- </style>
- <script>
- SyntaxHighlighter.config.clipboardSwf = 'scripts/clipboard.swf';
- SyntaxHighlighter.all();
-
- function startAgain() {
- var post_params = {
- "From_Name": "<?php echo $from_name; ?>",
- "From_Email": "<?php echo $from_email; ?>",
- "To_Name": "<?php echo $to_name; ?>",
- "To_Email": "<?php echo $to_email; ?>",
- "cc_Email": "<?php echo $cc_email; ?>",
- "bcc_Email": "<?php echo $bcc_email; ?>",
- "Subject": "<?php echo $subject; ?>",
- "Message": "<?php echo $message; ?>",
- "test_type": "<?php echo $test_type; ?>",
- "smtp_debug": "<?php echo $smtp_debug; ?>",
- "smtp_server": "<?php echo $smtp_server; ?>",
- "smtp_port": "<?php echo $smtp_port; ?>",
- "smtp_secure": "<?php echo $smtp_secure; ?>",
- "smtp_authenticate": "<?php echo $smtp_authenticate; ?>",
- "authenticate_username": "<?php echo $authenticate_username; ?>",
- "authenticate_password": "<?php echo $authenticate_password; ?>"
- };
-
- var resetForm = document.createElement("form");
- resetForm.setAttribute("method", "POST");
- resetForm.setAttribute("path", "index.php");
-
- for (var k in post_params) {
- var h = document.createElement("input");
- h.setAttribute("type", "hidden");
- h.setAttribute("name", k);
- h.setAttribute("value", post_params[k]);
- resetForm.appendChild(h);
- }
-
- document.body.appendChild(resetForm);
- resetForm.submit();
- }
-
- function showHideDiv(test, element_id) {
- var ops = {"smtp-options-table": "smtp"};
-
- if (test == ops[element_id]) {
- document.getElementById(element_id).style.display = "block";
- } else {
- document.getElementById(element_id).style.display = "none";
- }
- }
- </script>
-</head>
-<body>
-<?php
-if (version_compare(PHP_VERSION, '5.0.0', '<')) {
- echo 'Current PHP version: ' . phpversion() . "<br>";
- echo exit("ERROR: Wrong PHP version. Must be PHP 5 or above.");
-}
-
-if (count($results_messages) > 0) {
- echo '<h2>Run results</h2>';
- echo '<ul>';
- foreach ($results_messages as $result) {
- echo "<li>$result</li>";
- }
- echo '</ul>';
-}
-
-if (isset($_POST["submit"]) && $_POST["submit"] == "Submit") {
- echo "<button type=\"submit\" onclick=\"startAgain();\">Start Over</button><br>\n";
- echo "<br><span>Script:</span>\n";
- echo "<pre class=\"brush: php;\">\n";
- echo $example_code;
- echo "\n</pre>\n";
- echo "\n<hr style=\"margin: 3em;\">\n";
-}
-?>
-<form method="POST" enctype="multipart/form-data">
- <div>
- <div class="column-left">
- <fieldset>
- <legend>Mail Details</legend>
- <table border="1" class="column">
- <tr>
- <td class="colleft">
- <label for="From_Name"><strong>From</strong> Name</label>
- </td>
- <td class="colrite">
- <input type="text" id="From_Name" name="From_Name" value="<?php echo $from_name; ?>"
- style="width:95%;" autofocus placeholder="Your Name">
- </td>
- </tr>
- <tr>
- <td class="colleft">
- <label for="From_Email"><strong>From</strong> Email Address</label>
- </td>
- <td class="colrite">
- <input type="text" id="From_Email" name="From_Email" value="<?php echo $from_email; ?>"
- style="width:95%;" required placeholder="Your.Email@example.com">
- </td>
- </tr>
- <tr>
- <td class="colleft">
- <label for="To_Name"><strong>To</strong> Name</label>
- </td>
- <td class="colrite">
- <input type="text" id="To_Name" name="To_Name" value="<?php echo $to_name; ?>"
- style="width:95%;" placeholder="Recipient's Name">
- </td>
- </tr>
- <tr>
- <td class="colleft">
- <label for="To_Email"><strong>To</strong> Email Address</label>
- </td>
- <td class="colrite">
- <input type="text" id="To_Email" name="To_Email" value="<?php echo $to_email; ?>"
- style="width:95%;" required placeholder="Recipients.Email@example.com">
- </td>
- </tr>
- <tr>
- <td class="colleft">
- <label for="cc_Email"><strong>CC Recipients</strong><br>
- <small>(separate with commas)</small>
- </label>
- </td>
- <td class="colrite">
- <input type="text" id="cc_Email" name="cc_Email" value="<?php echo $cc_email; ?>"
- style="width:95%;" placeholder="cc1@example.com, cc2@example.com">
- </td>
- </tr>
- <tr>
- <td class="colleft">
- <label for="bcc_Email"><strong>BCC Recipients</strong><br>
- <small>(separate with commas)</small>
- </label>
- </td>
- <td class="colrite">
- <input type="text" id="bcc_Email" name="bcc_Email" value="<?php echo $bcc_email; ?>"
- style="width:95%;" placeholder="bcc1@example.com, bcc2@example.com">
- </td>
- </tr>
- <tr>
- <td class="colleft">
- <label for="Subject"><strong>Subject</strong></label>
- </td>
- <td class="colrite">
- <input type="text" name="Subject" id="Subject" value="<?php echo $subject; ?>"
- style="width:95%;" placeholder="Email Subject">
- </td>
- </tr>
- <tr>
- <td class="colleft">
- <label for="Message"><strong>Message</strong><br>
- <small>If blank, will use content.html</small>
- </label>
- </td>
- <td class="colrite">
- <textarea name="Message" id="Message" style="width:95%;height:5em;"
- placeholder="Body of your email"><?php echo $message; ?></textarea>
- </td>
- </tr>
- </table>
- <div style="margin:1em 0;">Test will include two attachments.</div>
- </fieldset>
- </div>
- <div class="column-right">
- <fieldset class="inner"> <!-- SELECT TYPE OF MAIL -->
- <legend>Mail Test Specs</legend>
- <table border="1" class="column">
- <tr>
- <td class="colleft">Test Type</td>
- <td class="colrite">
- <div class="radio">
- <label for="radio-mail">Mail()</label>
- <input class="radio" type="radio" name="test_type" value="mail" id="radio-mail"
- onclick="showHideDiv(this.value, 'smtp-options-table');"
- <?php echo ($test_type == 'mail') ? 'checked' : ''; ?>
- required>
- </div>
- <div class="radio">
- <label for="radio-sendmail">Sendmail</label>
- <input class="radio" type="radio" name="test_type" value="sendmail" id="radio-sendmail"
- onclick="showHideDiv(this.value, 'smtp-options-table');"
- <?php echo ($test_type == 'sendmail') ? 'checked' : ''; ?>
- required>
- </div>
- <div class="radio">
- <label for="radio-qmail">Qmail</label>
- <input class="radio" type="radio" name="test_type" value="qmail" id="radio-qmail"
- onclick="showHideDiv(this.value, 'smtp-options-table');"
- <?php echo ($test_type == 'qmail') ? 'checked' : ''; ?>
- required>
- </div>
- <div class="radio">
- <label for="radio-smtp">SMTP</label>
- <input class="radio" type="radio" name="test_type" value="smtp" id="radio-smtp"
- onclick="showHideDiv(this.value, 'smtp-options-table');"
- <?php echo ($test_type == 'smtp') ? 'checked' : ''; ?>
- required>
- </div>
- </td>
- </tr>
- </table>
- <div id="smtp-options-table" style="margin:1em 0 0 0;
-<?php if ($test_type != 'smtp') {
- echo "display: none;";
-} ?>">
- <span style="margin:1.25em 0; display:block;"><strong>SMTP Specific Options:</strong></span>
- <table border="1" class="column">
- <tr>
- <td class="colleft"><label for="smtp_debug">SMTP Debug ?</label></td>
- <td class="colrite">
- <select size="1" id="smtp_debug" name="smtp_debug">
- <option <?php echo ($smtp_debug == '0') ? 'selected' : ''; ?> value="0">
- 0 - Disabled
- </option>
- <option <?php echo ($smtp_debug == '1') ? 'selected' : ''; ?> value="1">
- 1 - Client messages
- </option>
- <option <?php echo ($smtp_debug == '2') ? 'selected' : ''; ?> value="2">
- 2 - Client and server messages
- </option>
- </select>
- </td>
- </tr>
- <tr>
- <td class="colleft"><label for="smtp_server">SMTP Server</label></td>
- <td class="colrite">
- <input type="text" id="smtp_server" name="smtp_server"
- value="<?php echo $smtp_server; ?>" style="width:95%;"
- placeholder="smtp.server.com">
- </td>
- </tr>
- <tr>
- <td class="colleft" style="width: 5em;"><label for="smtp_port">SMTP Port</label></td>
- <td class="colrite">
- <input type="text" name="smtp_port" id="smtp_port" size="3"
- value="<?php echo $smtp_port; ?>" placeholder="Port">
- </td>
- </tr>
- <tr>
- <td class="colleft"><label for="smtp_secure">SMTP Security</label></td>
- <td>
- <select size="1" name="smtp_secure" id="smtp_secure">
- <option <?php echo ($smtp_secure == 'none') ? 'selected' : '' ?>>None</option>
- <option <?php echo ($smtp_secure == 'tls') ? 'selected' : '' ?>>TLS</option>
- <option <?php echo ($smtp_secure == 'ssl') ? 'selected' : '' ?>>SSL</option>
- </select>
- </td>
- </tr>
- <tr>
- <td class="colleft"><label for="smtp-authenticate">SMTP Authenticate?</label></td>
- <td class="colrite">
- <input type="checkbox" id="smtp-authenticate"
- name="smtp_authenticate"
-<?php if ($smtp_authenticate != '') {
- echo "checked";
-} ?>
- value="<?php echo $smtp_authenticate; ?>">
- </td>
- </tr>
- <tr>
- <td class="colleft"><label for="authenticate_username">Authenticate Username</label></td>
- <td class="colrite">
- <input type="text" id="authenticate_username" name="authenticate_username"
- value="<?php echo $authenticate_username; ?>" style="width:95%;"
- placeholder="SMTP Server Username">
- </td>
- </tr>
- <tr>
- <td class="colleft"><label for="authenticate_password">Authenticate Password</label></td>
- <td class="colrite">
- <input type="password" name="authenticate_password" id="authenticate_password"
- value="<?php echo $authenticate_password; ?>" style="width:95%;"
- placeholder="SMTP Server Password">
- </td>
- </tr>
- </table>
- </div>
- </fieldset>
- </div>
- <br style="clear:both;">
-
- <div style="margin-left:2em; margin-bottom:5em; float:left;">
- <div style="margin-bottom: 1em; ">
- <input type="submit" value="Submit" name="submit">
- </div>
- <?php echo 'Current PHP version: ' . phpversion(); ?>
- </div>
- </div>
-</form>
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>PHPMailer Test</title>
-</head>
-<body>
-<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
- <h1>This is a test of PHPMailer.</h1>
- <div align="center">
- <a href="https://github.com/PHPMailer/PHPMailer/"><img src="images/phpmailer.png" height="90" width="340" alt="PHPMailer rocks"></a>
- </div>
- <p>This example uses <strong>HTML</strong>.</p>
- <p>ISO-8859-1 text: éèîüçÅñæß</p>
-</div>
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>PHPMailer Test</title>
-</head>
-<body>
-<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
- <h1>This is a test of PHPMailer.</h1>
- <div align="center">
- <a href="https://github.com/PHPMailer/PHPMailer/"><img src="images/phpmailer.png" height="90" width="340" alt="PHPMailer rocks"></a>
- </div>
- <p>This example uses <strong>HTML</strong>.</p>
- <p>Chinese text: 郵件內容為空</p>
- <p>Russian text: Пустое тело сообщения</p>
- <p>Armenian text: Հաղորդագրությունը դատարկ է</p>
- <p>Czech text: Prázdné tělo zprávy</p>
-</div>
-</body>
-</html>
+++ /dev/null
-<?php
-/**
- * This example shows how to make use of PHPMailer's exceptions for error handling.
- */
-
-require '../PHPMailerAutoload.php';
-
-//Create a new PHPMailer instance
-//Passing true to the constructor enables the use of exceptions for error handling
-$mail = new PHPMailer(true);
-try {
- //Set who the message is to be sent from
- $mail->setFrom('from@example.com', 'First Last');
- //Set an alternative reply-to address
- $mail->addReplyTo('replyto@example.com', 'First Last');
- //Set who the message is to be sent to
- $mail->addAddress('whoto@example.com', 'John Doe');
- //Set the subject line
- $mail->Subject = 'PHPMailer Exceptions test';
- //Read an HTML message body from an external file, convert referenced images to embedded,
- //and convert the HTML into a basic plain-text alternative body
- $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
- //Replace the plain text body with one created manually
- $mail->AltBody = 'This is a plain-text message body';
- //Attach an image file
- $mail->addAttachment('images/phpmailer_mini.png');
- //send the message
- //Note that we don't need check the response from this because it will throw an exception if it has trouble
- $mail->send();
- echo "Message sent!";
-} catch (phpmailerException $e) {
- echo $e->errorMessage(); //Pretty error messages from PHPMailer
-} catch (Exception $e) {
- echo $e->getMessage(); //Boring error messages from anything else!
-}
+++ /dev/null
-<?php
-/**
- * This example shows settings to use when sending via Google's Gmail servers.
- */
-
-//SMTP needs accurate times, and the PHP time zone MUST be set
-//This should be done in your php.ini, but this is how to do it if you don't have access to that
-date_default_timezone_set('Etc/UTC');
-
-require '../PHPMailerAutoload.php';
-
-//Create a new PHPMailer instance
-$mail = new PHPMailer;
-
-//Tell PHPMailer to use SMTP
-$mail->isSMTP();
-
-//Enable SMTP debugging
-// 0 = off (for production use)
-// 1 = client messages
-// 2 = client and server messages
-$mail->SMTPDebug = 2;
-
-//Ask for HTML-friendly debug output
-$mail->Debugoutput = 'html';
-
-//Set the hostname of the mail server
-$mail->Host = 'smtp.gmail.com';
-// use
-// $mail->Host = gethostbyname('smtp.gmail.com');
-// if your network does not support SMTP over IPv6
-
-//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
-$mail->Port = 587;
-
-//Set the encryption system to use - ssl (deprecated) or tls
-$mail->SMTPSecure = 'tls';
-
-//Whether to use SMTP authentication
-$mail->SMTPAuth = true;
-
-//Username to use for SMTP authentication - use full email address for gmail
-$mail->Username = "username@gmail.com";
-
-//Password to use for SMTP authentication
-$mail->Password = "yourpassword";
-
-//Set who the message is to be sent from
-$mail->setFrom('from@example.com', 'First Last');
-
-//Set an alternative reply-to address
-$mail->addReplyTo('replyto@example.com', 'First Last');
-
-//Set who the message is to be sent to
-$mail->addAddress('whoto@example.com', 'John Doe');
-
-//Set the subject line
-$mail->Subject = 'PHPMailer GMail SMTP test';
-
-//Read an HTML message body from an external file, convert referenced images to embedded,
-//convert HTML into a basic plain-text alternative body
-$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
-
-//Replace the plain text body with one created manually
-$mail->AltBody = 'This is a plain-text message body';
-
-//Attach an image file
-$mail->addAttachment('images/phpmailer_mini.png');
-
-//send the message, check for errors
-if (!$mail->send()) {
- echo "Mailer Error: " . $mail->ErrorInfo;
-} else {
- echo "Message sent!";
-}
+++ /dev/null
-<?php
-/**
- * This example shows settings to use when sending via Google's Gmail servers.
- */
-
-//SMTP needs accurate times, and the PHP time zone MUST be set
-//This should be done in your php.ini, but this is how to do it if you don't have access to that
-date_default_timezone_set('Etc/UTC');
-
-require '../PHPMailerAutoload.php';
-
-//Load dependencies from composer
-//If this causes an error, run 'composer install'
-require '../vendor/autoload.php';
-
-//Create a new PHPMailer instance
-$mail = new PHPMailerOAuth;
-
-//Tell PHPMailer to use SMTP
-$mail->isSMTP();
-
-//Enable SMTP debugging
-// 0 = off (for production use)
-// 1 = client messages
-// 2 = client and server messages
-$mail->SMTPDebug = 0;
-
-//Ask for HTML-friendly debug output
-$mail->Debugoutput = 'html';
-
-//Set the hostname of the mail server
-$mail->Host = 'smtp.gmail.com';
-
-//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
-$mail->Port = 587;
-
-//Set the encryption system to use - ssl (deprecated) or tls
-$mail->SMTPSecure = 'tls';
-
-//Whether to use SMTP authentication
-$mail->SMTPAuth = true;
-
-//Set AuthType
-$mail->AuthType = 'XOAUTH2';
-
-//User Email to use for SMTP authentication - Use the same Email used in Google Developer Console
-$mail->oauthUserEmail = "someone@gmail.com";
-
-//Obtained From Google Developer Console
-$mail->oauthClientId = "RANDOMCHARS-----duv1n2.apps.googleusercontent.com";
-
-//Obtained From Google Developer Console
-$mail->oauthClientSecret = "RANDOMCHARS-----lGyjPcRtvP";
-
-//Obtained By running get_oauth_token.php after setting up APP in Google Developer Console.
-//Set Redirect URI in Developer Console as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
-// eg: http://localhost/phpmail/get_oauth_token.php
-$mail->oauthRefreshToken = "RANDOMCHARS-----DWxgOvPT003r-yFUV49TQYag7_Aod7y0";
-
-//Set who the message is to be sent from
-//For gmail, this generally needs to be the same as the user you logged in as
-$mail->setFrom('from@example.com', 'First Last');
-
-//Set who the message is to be sent to
-$mail->addAddress('whoto@example.com', 'John Doe');
-
-//Set the subject line
-$mail->Subject = 'PHPMailer GMail SMTP test';
-
-//Read an HTML message body from an external file, convert referenced images to embedded,
-//convert HTML into a basic plain-text alternative body
-$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
-
-//Replace the plain text body with one created manually
-$mail->AltBody = 'This is a plain-text message body';
-
-//Attach an image file
-$mail->addAttachment('images/phpmailer_mini.png');
-
-//send the message, check for errors
-if (!$mail->send()) {
- echo "Mailer Error: " . $mail->ErrorInfo;
-} else {
- echo "Message sent!";
-}
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="UTF-8">
- <title>PHPMailer Examples</title>
-</head>
-<body>
-<h1>PHPMailer code examples<a href="https://github.com/PHPMailer/PHPMailer"><img src="images/phpmailer.png" style="float:right; border:0;" alt="PHPMailer logo"></a></h1>
-<p>This folder contains a collection of examples of using <a href="https://github.com/PHPMailer/PHPMailer">PHPMailer</a>.</p>
-<h2>About testing email sending</h2>
-<p>When working on email sending code you'll find yourself worrying about what might happen if all these test emails got sent to your mailing list. The solution is to use a fake mail server, one that acts just like the real thing, but just doesn't actually send anything out. Some offer web interfaces, feedback, logging, the ability to return specific error codes, all things that are useful for testing error handling, authentication etc. Here's a selection of mail testing tools you might like to try:</p>
-<ul>
- <li><a href="https://github.com/Nilhcem/FakeSMTP">FakeSMTP</a>, a Java desktop app with the ability to show an SMTP log and save messages to a folder. </li>
- <li><a href="https://github.com/isotoma/FakeEmail">FakeEmail</a>, a Python-based fake mail server with a web interface.</li>
- <li><a href="http://www.postfix.org/smtp-sink.1.html">smtp-sink</a>, part of the Postfix mail server, so you probably already have this installed. This is used in the Travis-CI configuration to run PHPMailer's unit tests.</li>
- <li><a href="http://smtp4dev.codeplex.com">smtp4dev</a>, a dummy SMTP server for Windows.</li>
- <li><a href="https://github.com/PHPMailer/PHPMailer/blob/master/test/fakesendmail.sh">fakesendmail.sh</a>, part of PHPMailer's test setup, this is a shell script that emulates sendmail for testing 'mail' or 'sendmail' methods in PHPMailer.</li>
- <li><a href="http://tools.ietf.org/tools/msglint/">msglint</a>, not a mail server, the IETF's MIME structure analyser checks the formatting of your messages.</li>
-</ul>
-<div style="padding: 8px; color: #333333; background-color: #dc8b92">
-<h2>Security note</h2>
-<p>Before running these examples you'll need to rename them with '.php' extensions. They are supplied as '.phps' files which will usually be displayed with syntax highlighting by PHP instead of running them. This prevents potential security issues with running potential spam-gateway code if you happen to deploy these code examples on a live site - <em>please don't do that!</em> Similarly, don't leave your passwords in these files as they will be visible to the world!</p>
-</div>
-<h2><a href="code_generator.phps">code_generator.phps</a></h2>
-<p>This script is a simple code generator - fill in the form and hit submit, and it will use when you entered to email you a message, and will also generate PHP code using your settings that you can copy and paste to use in your own apps. If you need to get going quickly, this is probably the best place to start.</p>
-<h2><a href="mail.phps">mail.phps</a></h2>
-<p>This script is a basic example which creates an email message from an external HTML file, creates a plain text body, sets various addresses, adds an attachment and sends the message. It uses PHP's built-in mail() function which is the simplest to use, but relies on the presence of a local mail server, something which is not usually available on Windows. If you find yourself in that situation, either install a local mail server, or use a remote one and send using SMTP instead.</p>
-<h2><a href="exceptions.phps">exceptions.phps</a></h2>
-<p>The same as the mail example, but shows how to use PHPMailer's optional exceptions for error handling.</p>
-<h2><a href="smtp.phps">smtp.phps</a></h2>
-<p>A simple example sending using SMTP with authentication.</p>
-<h2><a href="smtp_no_auth.phps">smtp_no_auth.phps</a></h2>
-<p>A simple example sending using SMTP without authentication.</p>
-<h2><a href="sendmail.phps">sendmail.phps</a></h2>
-<p>A simple example using sendmail. Sendmail is a program (usually found on Linux/BSD, OS X and other UNIX-alikes) that can be used to submit messages to a local mail server without a lengthy SMTP conversation. It's probably the fastest sending mechanism, but lacks some error reporting features. There are sendmail emulators for most popular mail servers including postfix, qmail, exim etc.</p>
-<h2><a href="gmail.phps">gmail.phps</a></h2>
-<p>Submitting email via Google's Gmail service is a popular use of PHPMailer. It's much the same as normal SMTP sending, just with some specific settings, namely using TLS encryption, authentication is enabled, and it connects to the SMTP submission port 587 on the smtp.gmail.com host. This example does all that.</p>
-<h2><a href="pop_before_smtp.phps">pop_before_smtp.phps</a></h2>
-<p>Before effective SMTP authentication mechanisms were available, it was common for ISPs to use POP-before-SMTP authentication. As it implies, you authenticate using the POP3 protocol (an older protocol now mostly replaced by the far superior IMAP), and then the SMTP server will allow send access from your IP address for a short while, usually 5-15 minutes. PHPMailer includes a POP3 protocol client, so it can carry out this sequence - it's just like a normal SMTP conversation (without authentication), but connects via POP first.</p>
-<h2><a href="mailing_list.phps">mailing_list.phps</a></h2>
-<p>This is a somewhat naïve example of sending similar emails to a list of different addresses. It sets up a PHPMailer instance using SMTP, then connects to a MySQL database to retrieve a list of recipients. The code loops over this list, sending email to each person using their info and marks them as sent in the database. It makes use of SMTP keepalive which saves reconnecting and re-authenticating between each message.</p>
-<hr>
-<h2><a href="smtp_check.phps">smtp_check.phps</a></h2>
-<p>This is an example showing how to use the SMTP class by itself (without PHPMailer) to check an SMTP connection.</p>
-<hr>
-<p>Most of these examples use the 'example.com' domain. This domain is reserved by IANA for illustrative purposes, as documented in <a href="http://tools.ietf.org/html/rfc2606">RFC 2606</a>. Don't use made-up domains like 'mydomain.com' or 'somedomain.com' in examples as someone, somewhere, probably owns them!</p>
-</body>
-</html>
+++ /dev/null
-<?php
-/**
- * This example shows sending a message using PHP's mail() function.
- */
-
-require '../PHPMailerAutoload.php';
-
-//Create a new PHPMailer instance
-$mail = new PHPMailer;
-//Set who the message is to be sent from
-$mail->setFrom('from@example.com', 'First Last');
-//Set an alternative reply-to address
-$mail->addReplyTo('replyto@example.com', 'First Last');
-//Set who the message is to be sent to
-$mail->addAddress('whoto@example.com', 'John Doe');
-//Set the subject line
-$mail->Subject = 'PHPMailer mail() test';
-//Read an HTML message body from an external file, convert referenced images to embedded,
-//convert HTML into a basic plain-text alternative body
-$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
-//Replace the plain text body with one created manually
-$mail->AltBody = 'This is a plain-text message body';
-//Attach an image file
-$mail->addAttachment('images/phpmailer_mini.png');
-
-//send the message, check for errors
-if (!$mail->send()) {
- echo "Mailer Error: " . $mail->ErrorInfo;
-} else {
- echo "Message sent!";
-}
+++ /dev/null
-<?php
-
-error_reporting(E_STRICT | E_ALL);
-
-date_default_timezone_set('Etc/UTC');
-
-require '../PHPMailerAutoload.php';
-
-$mail = new PHPMailer;
-
-$body = file_get_contents('contents.html');
-
-$mail->isSMTP();
-$mail->Host = 'smtp.example.com';
-$mail->SMTPAuth = true;
-$mail->SMTPKeepAlive = true; // SMTP connection will not close after each email sent, reduces SMTP overhead
-$mail->Port = 25;
-$mail->Username = 'yourname@example.com';
-$mail->Password = 'yourpassword';
-$mail->setFrom('list@example.com', 'List manager');
-$mail->addReplyTo('list@example.com', 'List manager');
-
-$mail->Subject = "PHPMailer Simple database mailing list test";
-
-//Same body for all messages, so set this before the sending loop
-//If you generate a different body for each recipient (e.g. you're using a templating system),
-//set it inside the loop
-$mail->msgHTML($body);
-//msgHTML also sets AltBody, but if you want a custom one, set it afterwards
-$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
-
-//Connect to the database and select the recipients from your mailing list that have not yet been sent to
-//You'll need to alter this to match your database
-$mysql = mysqli_connect('localhost', 'username', 'password');
-mysqli_select_db($mysql, 'mydb');
-$result = mysqli_query($mysql, 'SELECT full_name, email, photo FROM mailinglist WHERE sent = false');
-
-foreach ($result as $row) { //This iterator syntax only works in PHP 5.4+
- $mail->addAddress($row['email'], $row['full_name']);
- if (!empty($row['photo'])) {
- $mail->addStringAttachment($row['photo'], 'YourPhoto.jpg'); //Assumes the image data is stored in the DB
- }
-
- if (!$mail->send()) {
- echo "Mailer Error (" . str_replace("@", "@", $row["email"]) . ') ' . $mail->ErrorInfo . '<br />';
- break; //Abandon sending
- } else {
- echo "Message sent to :" . $row['full_name'] . ' (' . str_replace("@", "@", $row['email']) . ')<br />';
- //Mark it as sent in the DB
- mysqli_query(
- $mysql,
- "UPDATE mailinglist SET sent = true WHERE email = '" .
- mysqli_real_escape_string($mysql, $row['email']) . "'"
- );
- }
- // Clear all addresses and attachments for next loop
- $mail->clearAddresses();
- $mail->clearAttachments();
-}
+++ /dev/null
-<?php
-/**
- * This example shows how to use POP-before-SMTP for authentication.
- */
-
-require '../PHPMailerAutoload.php';
-
-//Authenticate via POP3.
-//After this you should be allowed to submit messages over SMTP for a while.
-//Only applies if your host supports POP-before-SMTP.
-$pop = POP3::popBeforeSmtp('pop3.example.com', 110, 30, 'username', 'password', 1);
-
-//Create a new PHPMailer instance
-//Passing true to the constructor enables the use of exceptions for error handling
-$mail = new PHPMailer(true);
-try {
- $mail->isSMTP();
- //Enable SMTP debugging
- // 0 = off (for production use)
- // 1 = client messages
- // 2 = client and server messages
- $mail->SMTPDebug = 2;
- //Ask for HTML-friendly debug output
- $mail->Debugoutput = 'html';
- //Set the hostname of the mail server
- $mail->Host = "mail.example.com";
- //Set the SMTP port number - likely to be 25, 465 or 587
- $mail->Port = 25;
- //Whether to use SMTP authentication
- $mail->SMTPAuth = false;
- //Set who the message is to be sent from
- $mail->setFrom('from@example.com', 'First Last');
- //Set an alternative reply-to address
- $mail->addReplyTo('replyto@example.com', 'First Last');
- //Set who the message is to be sent to
- $mail->addAddress('whoto@example.com', 'John Doe');
- //Set the subject line
- $mail->Subject = 'PHPMailer POP-before-SMTP test';
- //Read an HTML message body from an external file, convert referenced images to embedded,
- //and convert the HTML into a basic plain-text alternative body
- $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
- //Replace the plain text body with one created manually
- $mail->AltBody = 'This is a plain-text message body';
- //Attach an image file
- $mail->addAttachment('images/phpmailer_mini.png');
- //send the message
- //Note that we don't need check the response from this because it will throw an exception if it has trouble
- $mail->send();
- echo "Message sent!";
-} catch (phpmailerException $e) {
- echo $e->errorMessage(); //Pretty error messages from PHPMailer
-} catch (Exception $e) {
- echo $e->getMessage(); //Boring error messages from anything else!
-}
+++ /dev/null
-// XRegExp 1.5.1
-// (c) 2007-2012 Steven Levithan
-// MIT License
-// <http://xregexp.com>
-// Provides an augmented, extensible, cross-browser implementation of regular expressions,
-// including support for additional syntax, flags, and methods
-
-var XRegExp;
-
-if (XRegExp) {
- // Avoid running twice, since that would break references to native globals
- throw Error("can't load XRegExp twice in the same frame");
-}
-
-// Run within an anonymous function to protect variables and avoid new globals
-(function (undefined) {
-
- //---------------------------------
- // Constructor
- //---------------------------------
-
- // Accepts a pattern and flags; returns a new, extended `RegExp` object. Differs from a native
- // regular expression in that additional syntax and flags are supported and cross-browser
- // syntax inconsistencies are ameliorated. `XRegExp(/regex/)` clones an existing regex and
- // converts to type XRegExp
- XRegExp = function (pattern, flags) {
- var output = [],
- currScope = XRegExp.OUTSIDE_CLASS,
- pos = 0,
- context, tokenResult, match, chr, regex;
-
- if (XRegExp.isRegExp(pattern)) {
- if (flags !== undefined)
- throw TypeError("can't supply flags when constructing one RegExp from another");
- return clone(pattern);
- }
- // Tokens become part of the regex construction process, so protect against infinite
- // recursion when an XRegExp is constructed within a token handler or trigger
- if (isInsideConstructor)
- throw Error("can't call the XRegExp constructor within token definition functions");
-
- flags = flags || "";
- context = { // `this` object for custom tokens
- hasNamedCapture: false,
- captureNames: [],
- hasFlag: function (flag) {return flags.indexOf(flag) > -1;},
- setFlag: function (flag) {flags += flag;}
- };
-
- while (pos < pattern.length) {
- // Check for custom tokens at the current position
- tokenResult = runTokens(pattern, pos, currScope, context);
-
- if (tokenResult) {
- output.push(tokenResult.output);
- pos += (tokenResult.match[0].length || 1);
- } else {
- // Check for native multicharacter metasequences (excluding character classes) at
- // the current position
- if (match = nativ.exec.call(nativeTokens[currScope], pattern.slice(pos))) {
- output.push(match[0]);
- pos += match[0].length;
- } else {
- chr = pattern.charAt(pos);
- if (chr === "[")
- currScope = XRegExp.INSIDE_CLASS;
- else if (chr === "]")
- currScope = XRegExp.OUTSIDE_CLASS;
- // Advance position one character
- output.push(chr);
- pos++;
- }
- }
- }
-
- regex = RegExp(output.join(""), nativ.replace.call(flags, flagClip, ""));
- regex._xregexp = {
- source: pattern,
- captureNames: context.hasNamedCapture ? context.captureNames : null
- };
- return regex;
- };
-
-
- //---------------------------------
- // Public properties
- //---------------------------------
-
- XRegExp.version = "1.5.1";
-
- // Token scope bitflags
- XRegExp.INSIDE_CLASS = 1;
- XRegExp.OUTSIDE_CLASS = 2;
-
-
- //---------------------------------
- // Private variables
- //---------------------------------
-
- var replacementToken = /\$(?:(\d\d?|[$&`'])|{([$\w]+)})/g,
- flagClip = /[^gimy]+|([\s\S])(?=[\s\S]*\1)/g, // Nonnative and duplicate flags
- quantifier = /^(?:[?*+]|{\d+(?:,\d*)?})\??/,
- isInsideConstructor = false,
- tokens = [],
- // Copy native globals for reference ("native" is an ES3 reserved keyword)
- nativ = {
- exec: RegExp.prototype.exec,
- test: RegExp.prototype.test,
- match: String.prototype.match,
- replace: String.prototype.replace,
- split: String.prototype.split
- },
- compliantExecNpcg = nativ.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups
- compliantLastIndexIncrement = function () {
- var x = /^/g;
- nativ.test.call(x, "");
- return !x.lastIndex;
- }(),
- hasNativeY = RegExp.prototype.sticky !== undefined,
- nativeTokens = {};
-
- // `nativeTokens` match native multicharacter metasequences only (including deprecated octals,
- // excluding character classes)
- nativeTokens[XRegExp.INSIDE_CLASS] = /^(?:\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S]))/;
- nativeTokens[XRegExp.OUTSIDE_CLASS] = /^(?:\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??)/;
-
-
- //---------------------------------
- // Public methods
- //---------------------------------
-
- // Lets you extend or change XRegExp syntax and create custom flags. This is used internally by
- // the XRegExp library and can be used to create XRegExp plugins. This function is intended for
- // users with advanced knowledge of JavaScript's regular expression syntax and behavior. It can
- // be disabled by `XRegExp.freezeTokens`
- XRegExp.addToken = function (regex, handler, scope, trigger) {
- tokens.push({
- pattern: clone(regex, "g" + (hasNativeY ? "y" : "")),
- handler: handler,
- scope: scope || XRegExp.OUTSIDE_CLASS,
- trigger: trigger || null
- });
- };
-
- // Accepts a pattern and flags; returns an extended `RegExp` object. If the pattern and flag
- // combination has previously been cached, the cached copy is returned; otherwise the newly
- // created regex is cached
- XRegExp.cache = function (pattern, flags) {
- var key = pattern + "/" + (flags || "");
- return XRegExp.cache[key] || (XRegExp.cache[key] = XRegExp(pattern, flags));
- };
-
- // Accepts a `RegExp` instance; returns a copy with the `/g` flag set. The copy has a fresh
- // `lastIndex` (set to zero). If you want to copy a regex without forcing the `global`
- // property, use `XRegExp(regex)`. Do not use `RegExp(regex)` because it will not preserve
- // special properties required for named capture
- XRegExp.copyAsGlobal = function (regex) {
- return clone(regex, "g");
- };
-
- // Accepts a string; returns the string with regex metacharacters escaped. The returned string
- // can safely be used at any point within a regex to match the provided literal string. Escaped
- // characters are [ ] { } ( ) * + ? - . , \ ^ $ | # and whitespace
- XRegExp.escape = function (str) {
- return str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
- };
-
- // Accepts a string to search, regex to search with, position to start the search within the
- // string (default: 0), and an optional Boolean indicating whether matches must start at-or-
- // after the position or at the specified position only. This function ignores the `lastIndex`
- // of the provided regex in its own handling, but updates the property for compatibility
- XRegExp.execAt = function (str, regex, pos, anchored) {
- var r2 = clone(regex, "g" + ((anchored && hasNativeY) ? "y" : "")),
- match;
- r2.lastIndex = pos = pos || 0;
- match = r2.exec(str); // Run the altered `exec` (required for `lastIndex` fix, etc.)
- if (anchored && match && match.index !== pos)
- match = null;
- if (regex.global)
- regex.lastIndex = match ? r2.lastIndex : 0;
- return match;
- };
-
- // Breaks the unrestorable link to XRegExp's private list of tokens, thereby preventing
- // syntax and flag changes. Should be run after XRegExp and any plugins are loaded
- XRegExp.freezeTokens = function () {
- XRegExp.addToken = function () {
- throw Error("can't run addToken after freezeTokens");
- };
- };
-
- // Accepts any value; returns a Boolean indicating whether the argument is a `RegExp` object.
- // Note that this is also `true` for regex literals and regexes created by the `XRegExp`
- // constructor. This works correctly for variables created in another frame, when `instanceof`
- // and `constructor` checks would fail to work as intended
- XRegExp.isRegExp = function (o) {
- return Object.prototype.toString.call(o) === "[object RegExp]";
- };
-
- // Executes `callback` once per match within `str`. Provides a simpler and cleaner way to
- // iterate over regex matches compared to the traditional approaches of subverting
- // `String.prototype.replace` or repeatedly calling `exec` within a `while` loop
- XRegExp.iterate = function (str, regex, callback, context) {
- var r2 = clone(regex, "g"),
- i = -1, match;
- while (match = r2.exec(str)) { // Run the altered `exec` (required for `lastIndex` fix, etc.)
- if (regex.global)
- regex.lastIndex = r2.lastIndex; // Doing this to follow expectations if `lastIndex` is checked within `callback`
- callback.call(context, match, ++i, str, regex);
- if (r2.lastIndex === match.index)
- r2.lastIndex++;
- }
- if (regex.global)
- regex.lastIndex = 0;
- };
-
- // Accepts a string and an array of regexes; returns the result of using each successive regex
- // to search within the matches of the previous regex. The array of regexes can also contain
- // objects with `regex` and `backref` properties, in which case the named or numbered back-
- // references specified are passed forward to the next regex or returned. E.g.:
- // var xregexpImgFileNames = XRegExp.matchChain(html, [
- // {regex: /<img\b([^>]+)>/i, backref: 1}, // <img> tag attributes
- // {regex: XRegExp('(?ix) \\s src=" (?<src> [^"]+ )'), backref: "src"}, // src attribute values
- // {regex: XRegExp("^http://xregexp\\.com(/[^#?]+)", "i"), backref: 1}, // xregexp.com paths
- // /[^\/]+$/ // filenames (strip directory paths)
- // ]);
- XRegExp.matchChain = function (str, chain) {
- return function recurseChain (values, level) {
- var item = chain[level].regex ? chain[level] : {regex: chain[level]},
- regex = clone(item.regex, "g"),
- matches = [], i;
- for (i = 0; i < values.length; i++) {
- XRegExp.iterate(values[i], regex, function (match) {
- matches.push(item.backref ? (match[item.backref] || "") : match[0]);
- });
- }
- return ((level === chain.length - 1) || !matches.length) ?
- matches : recurseChain(matches, level + 1);
- }([str], 0);
- };
-
-
- //---------------------------------
- // New RegExp prototype methods
- //---------------------------------
-
- // Accepts a context object and arguments array; returns the result of calling `exec` with the
- // first value in the arguments array. the context is ignored but is accepted for congruity
- // with `Function.prototype.apply`
- RegExp.prototype.apply = function (context, args) {
- return this.exec(args[0]);
- };
-
- // Accepts a context object and string; returns the result of calling `exec` with the provided
- // string. the context is ignored but is accepted for congruity with `Function.prototype.call`
- RegExp.prototype.call = function (context, str) {
- return this.exec(str);
- };
-
-
- //---------------------------------
- // Overriden native methods
- //---------------------------------
-
- // Adds named capture support (with backreferences returned as `result.name`), and fixes two
- // cross-browser issues per ES3:
- // - Captured values for nonparticipating capturing groups should be returned as `undefined`,
- // rather than the empty string.
- // - `lastIndex` should not be incremented after zero-length matches.
- RegExp.prototype.exec = function (str) {
- var match, name, r2, origLastIndex;
- if (!this.global)
- origLastIndex = this.lastIndex;
- match = nativ.exec.apply(this, arguments);
- if (match) {
- // Fix browsers whose `exec` methods don't consistently return `undefined` for
- // nonparticipating capturing groups
- if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) {
- r2 = RegExp(this.source, nativ.replace.call(getNativeFlags(this), "g", ""));
- // Using `str.slice(match.index)` rather than `match[0]` in case lookahead allowed
- // matching due to characters outside the match
- nativ.replace.call((str + "").slice(match.index), r2, function () {
- for (var i = 1; i < arguments.length - 2; i++) {
- if (arguments[i] === undefined)
- match[i] = undefined;
- }
- });
- }
- // Attach named capture properties
- if (this._xregexp && this._xregexp.captureNames) {
- for (var i = 1; i < match.length; i++) {
- name = this._xregexp.captureNames[i - 1];
- if (name)
- match[name] = match[i];
- }
- }
- // Fix browsers that increment `lastIndex` after zero-length matches
- if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index))
- this.lastIndex--;
- }
- if (!this.global)
- this.lastIndex = origLastIndex; // Fix IE, Opera bug (last tested IE 9.0.5, Opera 11.61 on Windows)
- return match;
- };
-
- // Fix browser bugs in native method
- RegExp.prototype.test = function (str) {
- // Use the native `exec` to skip some processing overhead, even though the altered
- // `exec` would take care of the `lastIndex` fixes
- var match, origLastIndex;
- if (!this.global)
- origLastIndex = this.lastIndex;
- match = nativ.exec.call(this, str);
- // Fix browsers that increment `lastIndex` after zero-length matches
- if (match && !compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index))
- this.lastIndex--;
- if (!this.global)
- this.lastIndex = origLastIndex; // Fix IE, Opera bug (last tested IE 9.0.5, Opera 11.61 on Windows)
- return !!match;
- };
-
- // Adds named capture support and fixes browser bugs in native method
- String.prototype.match = function (regex) {
- if (!XRegExp.isRegExp(regex))
- regex = RegExp(regex); // Native `RegExp`
- if (regex.global) {
- var result = nativ.match.apply(this, arguments);
- regex.lastIndex = 0; // Fix IE bug
- return result;
- }
- return regex.exec(this); // Run the altered `exec`
- };
-
- // Adds support for `${n}` tokens for named and numbered backreferences in replacement text,
- // and provides named backreferences to replacement functions as `arguments[0].name`. Also
- // fixes cross-browser differences in replacement text syntax when performing a replacement
- // using a nonregex search value, and the value of replacement regexes' `lastIndex` property
- // during replacement iterations. Note that this doesn't support SpiderMonkey's proprietary
- // third (`flags`) parameter
- String.prototype.replace = function (search, replacement) {
- var isRegex = XRegExp.isRegExp(search),
- captureNames, result, str, origLastIndex;
-
- // There are too many combinations of search/replacement types/values and browser bugs that
- // preclude passing to native `replace`, so don't try
- //if (...)
- // return nativ.replace.apply(this, arguments);
-
- if (isRegex) {
- if (search._xregexp)
- captureNames = search._xregexp.captureNames; // Array or `null`
- if (!search.global)
- origLastIndex = search.lastIndex;
- } else {
- search = search + ""; // Type conversion
- }
-
- if (Object.prototype.toString.call(replacement) === "[object Function]") {
- result = nativ.replace.call(this + "", search, function () {
- if (captureNames) {
- // Change the `arguments[0]` string primitive to a String object which can store properties
- arguments[0] = new String(arguments[0]);
- // Store named backreferences on `arguments[0]`
- for (var i = 0; i < captureNames.length; i++) {
- if (captureNames[i])
- arguments[0][captureNames[i]] = arguments[i + 1];
- }
- }
- // Update `lastIndex` before calling `replacement` (fix browsers)
- if (isRegex && search.global)
- search.lastIndex = arguments[arguments.length - 2] + arguments[0].length;
- return replacement.apply(null, arguments);
- });
- } else {
- str = this + ""; // Type conversion, so `args[args.length - 1]` will be a string (given nonstring `this`)
- result = nativ.replace.call(str, search, function () {
- var args = arguments; // Keep this function's `arguments` available through closure
- return nativ.replace.call(replacement + "", replacementToken, function ($0, $1, $2) {
- // Numbered backreference (without delimiters) or special variable
- if ($1) {
- switch ($1) {
- case "$": return "$";
- case "&": return args[0];
- case "`": return args[args.length - 1].slice(0, args[args.length - 2]);
- case "'": return args[args.length - 1].slice(args[args.length - 2] + args[0].length);
- // Numbered backreference
- default:
- // What does "$10" mean?
- // - Backreference 10, if 10 or more capturing groups exist
- // - Backreference 1 followed by "0", if 1-9 capturing groups exist
- // - Otherwise, it's the string "$10"
- // Also note:
- // - Backreferences cannot be more than two digits (enforced by `replacementToken`)
- // - "$01" is equivalent to "$1" if a capturing group exists, otherwise it's the string "$01"
- // - There is no "$0" token ("$&" is the entire match)
- var literalNumbers = "";
- $1 = +$1; // Type conversion; drop leading zero
- if (!$1) // `$1` was "0" or "00"
- return $0;
- while ($1 > args.length - 3) {
- literalNumbers = String.prototype.slice.call($1, -1) + literalNumbers;
- $1 = Math.floor($1 / 10); // Drop the last digit
- }
- return ($1 ? args[$1] || "" : "$") + literalNumbers;
- }
- // Named backreference or delimited numbered backreference
- } else {
- // What does "${n}" mean?
- // - Backreference to numbered capture n. Two differences from "$n":
- // - n can be more than two digits
- // - Backreference 0 is allowed, and is the entire match
- // - Backreference to named capture n, if it exists and is not a number overridden by numbered capture
- // - Otherwise, it's the string "${n}"
- var n = +$2; // Type conversion; drop leading zeros
- if (n <= args.length - 3)
- return args[n];
- n = captureNames ? indexOf(captureNames, $2) : -1;
- return n > -1 ? args[n + 1] : $0;
- }
- });
- });
- }
-
- if (isRegex) {
- if (search.global)
- search.lastIndex = 0; // Fix IE, Safari bug (last tested IE 9.0.5, Safari 5.1.2 on Windows)
- else
- search.lastIndex = origLastIndex; // Fix IE, Opera bug (last tested IE 9.0.5, Opera 11.61 on Windows)
- }
-
- return result;
- };
-
- // A consistent cross-browser, ES3 compliant `split`
- String.prototype.split = function (s /* separator */, limit) {
- // If separator `s` is not a regex, use the native `split`
- if (!XRegExp.isRegExp(s))
- return nativ.split.apply(this, arguments);
-
- var str = this + "", // Type conversion
- output = [],
- lastLastIndex = 0,
- match, lastLength;
-
- // Behavior for `limit`: if it's...
- // - `undefined`: No limit
- // - `NaN` or zero: Return an empty array
- // - A positive number: Use `Math.floor(limit)`
- // - A negative number: No limit
- // - Other: Type-convert, then use the above rules
- if (limit === undefined || +limit < 0) {
- limit = Infinity;
- } else {
- limit = Math.floor(+limit);
- if (!limit)
- return [];
- }
-
- // This is required if not `s.global`, and it avoids needing to set `s.lastIndex` to zero
- // and restore it to its original value when we're done using the regex
- s = XRegExp.copyAsGlobal(s);
-
- while (match = s.exec(str)) { // Run the altered `exec` (required for `lastIndex` fix, etc.)
- if (s.lastIndex > lastLastIndex) {
- output.push(str.slice(lastLastIndex, match.index));
-
- if (match.length > 1 && match.index < str.length)
- Array.prototype.push.apply(output, match.slice(1));
-
- lastLength = match[0].length;
- lastLastIndex = s.lastIndex;
-
- if (output.length >= limit)
- break;
- }
-
- if (s.lastIndex === match.index)
- s.lastIndex++;
- }
-
- if (lastLastIndex === str.length) {
- if (!nativ.test.call(s, "") || lastLength)
- output.push("");
- } else {
- output.push(str.slice(lastLastIndex));
- }
-
- return output.length > limit ? output.slice(0, limit) : output;
- };
-
-
- //---------------------------------
- // Private helper functions
- //---------------------------------
-
- // Supporting function for `XRegExp`, `XRegExp.copyAsGlobal`, etc. Returns a copy of a `RegExp`
- // instance with a fresh `lastIndex` (set to zero), preserving properties required for named
- // capture. Also allows adding new flags in the process of copying the regex
- function clone (regex, additionalFlags) {
- if (!XRegExp.isRegExp(regex))
- throw TypeError("type RegExp expected");
- var x = regex._xregexp;
- regex = XRegExp(regex.source, getNativeFlags(regex) + (additionalFlags || ""));
- if (x) {
- regex._xregexp = {
- source: x.source,
- captureNames: x.captureNames ? x.captureNames.slice(0) : null
- };
- }
- return regex;
- }
-
- function getNativeFlags (regex) {
- return (regex.global ? "g" : "") +
- (regex.ignoreCase ? "i" : "") +
- (regex.multiline ? "m" : "") +
- (regex.extended ? "x" : "") + // Proposed for ES4; included in AS3
- (regex.sticky ? "y" : "");
- }
-
- function runTokens (pattern, index, scope, context) {
- var i = tokens.length,
- result, match, t;
- // Protect against constructing XRegExps within token handler and trigger functions
- isInsideConstructor = true;
- // Must reset `isInsideConstructor`, even if a `trigger` or `handler` throws
- try {
- while (i--) { // Run in reverse order
- t = tokens[i];
- if ((scope & t.scope) && (!t.trigger || t.trigger.call(context))) {
- t.pattern.lastIndex = index;
- match = t.pattern.exec(pattern); // Running the altered `exec` here allows use of named backreferences, etc.
- if (match && match.index === index) {
- result = {
- output: t.handler.call(context, match, scope),
- match: match
- };
- break;
- }
- }
- }
- } catch (err) {
- throw err;
- } finally {
- isInsideConstructor = false;
- }
- return result;
- }
-
- function indexOf (array, item, from) {
- if (Array.prototype.indexOf) // Use the native array method if available
- return array.indexOf(item, from);
- for (var i = from || 0; i < array.length; i++) {
- if (array[i] === item)
- return i;
- }
- return -1;
- }
-
-
- //---------------------------------
- // Built-in tokens
- //---------------------------------
-
- // Augment XRegExp's regular expression syntax and flags. Note that when adding tokens, the
- // third (`scope`) argument defaults to `XRegExp.OUTSIDE_CLASS`
-
- // Comment pattern: (?# )
- XRegExp.addToken(
- /\(\?#[^)]*\)/,
- function (match) {
- // Keep tokens separated unless the following token is a quantifier
- return nativ.test.call(quantifier, match.input.slice(match.index + match[0].length)) ? "" : "(?:)";
- }
- );
-
- // Capturing group (match the opening parenthesis only).
- // Required for support of named capturing groups
- XRegExp.addToken(
- /\((?!\?)/,
- function () {
- this.captureNames.push(null);
- return "(";
- }
- );
-
- // Named capturing group (match the opening delimiter only): (?<name>
- XRegExp.addToken(
- /\(\?<([$\w]+)>/,
- function (match) {
- this.captureNames.push(match[1]);
- this.hasNamedCapture = true;
- return "(";
- }
- );
-
- // Named backreference: \k<name>
- XRegExp.addToken(
- /\\k<([\w$]+)>/,
- function (match) {
- var index = indexOf(this.captureNames, match[1]);
- // Keep backreferences separate from subsequent literal numbers. Preserve back-
- // references to named groups that are undefined at this point as literal strings
- return index > -1 ?
- "\\" + (index + 1) + (isNaN(match.input.charAt(match.index + match[0].length)) ? "" : "(?:)") :
- match[0];
- }
- );
-
- // Empty character class: [] or [^]
- XRegExp.addToken(
- /\[\^?]/,
- function (match) {
- // For cross-browser compatibility with ES3, convert [] to \b\B and [^] to [\s\S].
- // (?!) should work like \b\B, but is unreliable in Firefox
- return match[0] === "[]" ? "\\b\\B" : "[\\s\\S]";
- }
- );
-
- // Mode modifier at the start of the pattern only, with any combination of flags imsx: (?imsx)
- // Does not support x(?i), (?-i), (?i-m), (?i: ), (?i)(?m), etc.
- XRegExp.addToken(
- /^\(\?([imsx]+)\)/,
- function (match) {
- this.setFlag(match[1]);
- return "";
- }
- );
-
- // Whitespace and comments, in free-spacing (aka extended) mode only
- XRegExp.addToken(
- /(?:\s+|#.*)+/,
- function (match) {
- // Keep tokens separated unless the following token is a quantifier
- return nativ.test.call(quantifier, match.input.slice(match.index + match[0].length)) ? "" : "(?:)";
- },
- XRegExp.OUTSIDE_CLASS,
- function () {return this.hasFlag("x");}
- );
-
- // Dot, in dotall (aka singleline) mode only
- XRegExp.addToken(
- /\./,
- function () {return "[\\s\\S]";},
- XRegExp.OUTSIDE_CLASS,
- function () {return this.hasFlag("s");}
- );
-
-
- //---------------------------------
- // Backward compatibility
- //---------------------------------
-
- // Uncomment the following block for compatibility with XRegExp 1.0-1.2:
- /*
- XRegExp.matchWithinChain = XRegExp.matchChain;
- RegExp.prototype.addFlags = function (s) {return clone(this, s);};
- RegExp.prototype.execAll = function (s) {var r = []; XRegExp.iterate(s, this, function (m) {r.push(m);}); return r;};
- RegExp.prototype.forEachExec = function (s, f, c) {return XRegExp.iterate(s, this, f, c);};
- RegExp.prototype.validate = function (s) {var r = RegExp("^(?:" + this.source + ")$(?!\\s)", getNativeFlags(this)); if (this.global) this.lastIndex = 0; return s.search(r) === 0;};
- */
-
-})();
-
+++ /dev/null
-(function() {
-
-var sh = SyntaxHighlighter;
-
-/**
- * Provides functionality to dynamically load only the brushes that a needed to render the current page.
- *
- * There are two syntaxes that autoload understands. For example:
- *
- * SyntaxHighlighter.autoloader(
- * [ 'applescript', 'Scripts/shBrushAppleScript.js' ],
- * [ 'actionscript3', 'as3', 'Scripts/shBrushAS3.js' ]
- * );
- *
- * or a more easily comprehendable one:
- *
- * SyntaxHighlighter.autoloader(
- * 'applescript Scripts/shBrushAppleScript.js',
- * 'actionscript3 as3 Scripts/shBrushAS3.js'
- * );
- */
-sh.autoloader = function()
-{
- var list = arguments,
- elements = sh.findElements(),
- brushes = {},
- scripts = {},
- all = SyntaxHighlighter.all,
- allCalled = false,
- allParams = null,
- i
- ;
-
- SyntaxHighlighter.all = function(params)
- {
- allParams = params;
- allCalled = true;
- };
-
- function addBrush(aliases, url)
- {
- for (var i = 0; i < aliases.length; i++)
- brushes[aliases[i]] = url;
- };
-
- function getAliases(item)
- {
- return item.pop
- ? item
- : item.split(/\s+/)
- ;
- }
-
- // create table of aliases and script urls
- for (i = 0; i < list.length; i++)
- {
- var aliases = getAliases(list[i]),
- url = aliases.pop()
- ;
-
- addBrush(aliases, url);
- }
-
- // dynamically add <script /> tags to the document body
- for (i = 0; i < elements.length; i++)
- {
- var url = brushes[elements[i].params.brush];
-
- if(url && scripts[url] === undefined)
- {
- if(elements[i].params['html-script'] === 'true')
- {
- if(scripts[brushes['xml']] === undefined) {
- loadScript(brushes['xml']);
- scripts[url] = false;
- }
- }
-
- scripts[url] = false;
- loadScript(url);
- }
- }
-
- function loadScript(url)
- {
- var script = document.createElement('script'),
- done = false
- ;
-
- script.src = url;
- script.type = 'text/javascript';
- script.language = 'javascript';
- script.onload = script.onreadystatechange = function()
- {
- if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete'))
- {
- done = true;
- scripts[url] = true;
- checkAll();
-
- // Handle memory leak in IE
- script.onload = script.onreadystatechange = null;
- script.parentNode.removeChild(script);
- }
- };
-
- // sync way of adding script tags to the page
- document.body.appendChild(script);
- };
-
- function checkAll()
- {
- for(var url in scripts)
- if (scripts[url] == false)
- return;
-
- if (allCalled)
- SyntaxHighlighter.highlight(allParams);
- };
-};
-
-})();
+++ /dev/null
-;(function()
-{
- // CommonJS
- SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
-
- function Brush()
- {
- var funcs = 'abs acos acosh addcslashes addslashes ' +
- 'array_change_key_case array_chunk array_combine array_count_values array_diff '+
- 'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+
- 'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key '+
- 'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map '+
- 'array_merge array_merge_recursive array_multisort array_pad array_pop array_product '+
- 'array_push array_rand array_reduce array_reverse array_search array_shift '+
- 'array_slice array_splice array_sum array_udiff array_udiff_assoc '+
- 'array_udiff_uassoc array_uintersect array_uintersect_assoc '+
- 'array_uintersect_uassoc array_unique array_unshift array_values array_walk '+
- 'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert '+
- 'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress '+
- 'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir '+
- 'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists '+
- 'closedir closelog copy cos cosh count count_chars date decbin dechex decoct '+
- 'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log '+
- 'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded '+
- 'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents '+
- 'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype '+
- 'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf '+
- 'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname '+
- 'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt '+
- 'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext '+
- 'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set '+
- 'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double '+
- 'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long '+
- 'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault '+
- 'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br '+
- 'parse_ini_file parse_str parse_url passthru pathinfo print readlink realpath rewind rewinddir rmdir '+
- 'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split '+
- 'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes '+
- 'stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk '+
- 'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime '+
- 'strtoupper strtr strval substr substr_compare';
-
- var keywords = 'abstract and array as break case catch cfunction class clone const continue declare default die do ' +
- 'else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach ' +
- 'function global goto if implements include include_once interface instanceof insteadof namespace new ' +
- 'old_function or private protected public return require require_once static switch ' +
- 'trait throw try use var while xor ';
-
- var constants = '__FILE__ __LINE__ __METHOD__ __FUNCTION__ __CLASS__';
-
- this.regexList = [
- { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
- { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
- { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
- { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
- { regex: /\$\w+/g, css: 'variable' }, // variables
- { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // common functions
- { regex: new RegExp(this.getKeywords(constants), 'gmi'), css: 'constants' }, // constants
- { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keyword
- ];
-
- this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags);
- };
-
- Brush.prototype = new SyntaxHighlighter.Highlighter();
- Brush.aliases = ['php'];
-
- SyntaxHighlighter.brushes.Php = Brush;
-
- // CommonJS
- typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
-})();
+++ /dev/null
-var XRegExp;if(XRegExp)throw Error("can't load XRegExp twice in the same frame");(function(e){function c(e,t){if(!XRegExp.isRegExp(e))throw TypeError("type RegExp expected");var n=e._xregexp;return e=XRegExp(e.source,h(e)+(t||"")),n&&(e._xregexp={source:n.source,captureNames:n.captureNames?n.captureNames.slice(0):null}),e}function h(e){return(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":"")}function p(e,t,n,r){var o=s.length,u,a,f;i=!0;try{while(o--){f=s[o];if(n&f.scope&&(!f.trigger||f.trigger.call(r))){f.pattern.lastIndex=t,a=f.pattern.exec(e);if(a&&a.index===t){u={output:f.handler.call(r,a,n),match:a};break}}}}catch(l){throw l}finally{i=!1}return u}function d(e,t,n){if(Array.prototype.indexOf)return e.indexOf(t,n);for(var r=n||0;r<e.length;r++)if(e[r]===t)return r;return-1}XRegExp=function(t,r){var s=[],u=XRegExp.OUTSIDE_CLASS,a=0,f,h,d,v,m;if(XRegExp.isRegExp(t)){if(r!==e)throw TypeError("can't supply flags when constructing one RegExp from another");return c(t)}if(i)throw Error("can't call the XRegExp constructor within token definition functions");r=r||"",f={hasNamedCapture:!1,captureNames:[],hasFlag:function(e){return r.indexOf(e)>-1},setFlag:function(e){r+=e}};while(a<t.length)h=p(t,a,u,f),h?(s.push(h.output),a+=h.match[0].length||1):(d=o.exec.call(l[u],t.slice(a)))?(s.push(d[0]),a+=d[0].length):(v=t.charAt(a),v==="["?u=XRegExp.INSIDE_CLASS:v==="]"&&(u=XRegExp.OUTSIDE_CLASS),s.push(v),a++);return m=RegExp(s.join(""),o.replace.call(r,n,"")),m._xregexp={source:t,captureNames:f.hasNamedCapture?f.captureNames:null},m},XRegExp.version="1.5.1",XRegExp.INSIDE_CLASS=1,XRegExp.OUTSIDE_CLASS=2;var t=/\$(?:(\d\d?|[$&`'])|{([$\w]+)})/g,n=/[^gimy]+|([\s\S])(?=[\s\S]*\1)/g,r=/^(?:[?*+]|{\d+(?:,\d*)?})\??/,i=!1,s=[],o={exec:RegExp.prototype.exec,test:RegExp.prototype.test,match:String.prototype.match,replace:String.prototype.replace,split:String.prototype.split},u=o.exec.call(/()??/,"")[1]===e,a=function(){var e=/^/g;return o.test.call(e,""),!e.lastIndex}(),f=RegExp.prototype.sticky!==e,l={};l[XRegExp.INSIDE_CLASS]=/^(?:\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S]))/,l[XRegExp.OUTSIDE_CLASS]=/^(?:\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??)/,XRegExp.addToken=function(e,t,n,r){s.push({pattern:c(e,"g"+(f?"y":"")),handler:t,scope:n||XRegExp.OUTSIDE_CLASS,trigger:r||null})},XRegExp.cache=function(e,t){var n=e+"/"+(t||"");return XRegExp.cache[n]||(XRegExp.cache[n]=XRegExp(e,t))},XRegExp.copyAsGlobal=function(e){return c(e,"g")},XRegExp.escape=function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},XRegExp.execAt=function(e,t,n,r){var i=c(t,"g"+(r&&f?"y":"")),s;return i.lastIndex=n=n||0,s=i.exec(e),r&&s&&s.index!==n&&(s=null),t.global&&(t.lastIndex=s?i.lastIndex:0),s},XRegExp.freezeTokens=function(){XRegExp.addToken=function(){throw Error("can't run addToken after freezeTokens")}},XRegExp.isRegExp=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},XRegExp.iterate=function(e,t,n,r){var i=c(t,"g"),s=-1,o;while(o=i.exec(e))t.global&&(t.lastIndex=i.lastIndex),n.call(r,o,++s,e,t),i.lastIndex===o.index&&i.lastIndex++;t.global&&(t.lastIndex=0)},XRegExp.matchChain=function(e,t){return function n(e,r){var i=t[r].regex?t[r]:{regex:t[r]},s=c(i.regex,"g"),o=[],u;for(u=0;u<e.length;u++)XRegExp.iterate(e[u],s,function(e){o.push(i.backref?e[i.backref]||"":e[0])});return r===t.length-1||!o.length?o:n(o,r+1)}([e],0)},RegExp.prototype.apply=function(e,t){return this.exec(t[0])},RegExp.prototype.call=function(e,t){return this.exec(t)},RegExp.prototype.exec=function(t){var n,r,i,s;this.global||(s=this.lastIndex),n=o.exec.apply(this,arguments);if(n){!u&&n.length>1&&d(n,"")>-1&&(i=RegExp(this.source,o.replace.call(h(this),"g","")),o.replace.call((t+"").slice(n.index),i,function(){for(var t=1;t<arguments.length-2;t++)arguments[t]===e&&(n[t]=e)}));if(this._xregexp&&this._xregexp.captureNames)for(var f=1;f<n.length;f++)r=this._xregexp.captureNames[f-1],r&&(n[r]=n[f]);!a&&this.global&&!n[0].length&&this.lastIndex>n.index&&this.lastIndex--}return this.global||(this.lastIndex=s),n},RegExp.prototype.test=function(e){var t,n;return this.global||(n=this.lastIndex),t=o.exec.call(this,e),t&&!a&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--,this.global||(this.lastIndex=n),!!t},String.prototype.match=function(e){XRegExp.isRegExp(e)||(e=RegExp(e));if(e.global){var t=o.match.apply(this,arguments);return e.lastIndex=0,t}return e.exec(this)},String.prototype.replace=function(e,n){var r=XRegExp.isRegExp(e),i,s,u,a;return r?(e._xregexp&&(i=e._xregexp.captureNames),e.global||(a=e.lastIndex)):e+="",Object.prototype.toString.call(n)==="[object Function]"?s=o.replace.call(this+"",e,function(){if(i){arguments[0]=new String(arguments[0]);for(var t=0;t<i.length;t++)i[t]&&(arguments[0][i[t]]=arguments[t+1])}return r&&e.global&&(e.lastIndex=arguments[arguments.length-2]+arguments[0].length),n.apply(null,arguments)}):(u=this+"",s=o.replace.call(u,e,function(){var e=arguments;return o.replace.call(n+"",t,function(t,n,r){if(!n){var o=+r;return o<=e.length-3?e[o]:(o=i?d(i,r):-1,o>-1?e[o+1]:t)}switch(n){case"$":return"$";case"&":return e[0];case"`":return e[e.length-1].slice(0,e[e.length-2]);case"'":return e[e.length-1].slice(e[e.length-2]+e[0].length);default:var s="";n=+n;if(!n)return t;while(n>e.length-3)s=String.prototype.slice.call(n,-1)+s,n=Math.floor(n/10);return(n?e[n]||"":"$")+s}})})),r&&(e.global?e.lastIndex=0:e.lastIndex=a),s},String.prototype.split=function(t,n){if(!XRegExp.isRegExp(t))return o.split.apply(this,arguments);var r=this+"",i=[],s=0,u,a;if(n===e||+n<0)n=Infinity;else{n=Math.floor(+n);if(!n)return[]}t=XRegExp.copyAsGlobal(t);while(u=t.exec(r)){if(t.lastIndex>s){i.push(r.slice(s,u.index)),u.length>1&&u.index<r.length&&Array.prototype.push.apply(i,u.slice(1)),a=u[0].length,s=t.lastIndex;if(i.length>=n)break}t.lastIndex===u.index&&t.lastIndex++}return s===r.length?(!o.test.call(t,"")||a)&&i.push(""):i.push(r.slice(s)),i.length>n?i.slice(0,n):i},XRegExp.addToken(/\(\?#[^)]*\)/,function(e){return o.test.call(r,e.input.slice(e.index+e[0].length))?"":"(?:)"}),XRegExp.addToken(/\((?!\?)/,function(){return this.captureNames.push(null),"("}),XRegExp.addToken(/\(\?<([$\w]+)>/,function(e){return this.captureNames.push(e[1]),this.hasNamedCapture=!0,"("}),XRegExp.addToken(/\\k<([\w$]+)>/,function(e){var t=d(this.captureNames,e[1]);return t>-1?"\\"+(t+1)+(isNaN(e.input.charAt(e.index+e[0].length))?"":"(?:)"):e[0]}),XRegExp.addToken(/\[\^?]/,function(e){return e[0]==="[]"?"\\b\\B":"[\\s\\S]"}),XRegExp.addToken(/^\(\?([imsx]+)\)/,function(e){return this.setFlag(e[1]),""}),XRegExp.addToken(/(?:\s+|#.*)+/,function(e){return o.test.call(r,e.input.slice(e.index+e[0].length))?"":"(?:)"},XRegExp.OUTSIDE_CLASS,function(){return this.hasFlag("x")}),XRegExp.addToken(/\./,function(){return"[\\s\\S]"},XRegExp.OUTSIDE_CLASS,function(){return this.hasFlag("s")})})();if(typeof SyntaxHighlighter=="undefined")var SyntaxHighlighter=function(){function t(e,t){return e.className.indexOf(t)!=-1}function n(e,n){t(e,n)||(e.className+=" "+n)}function r(e,t){e.className=e.className.replace(t,"")}function i(e){var t=[];for(var n=0;n<e.length;n++)t.push(e[n]);return t}function s(e){return e.split(/\r?\n/)}function o(e){var t="highlighter_";return e.indexOf(t)==0?e:t+e}function u(t){return e.vars.highlighters[o(t)]}function a(e){return document.getElementById(o(e))}function f(t){e.vars.highlighters[o(t.id)]=t}function l(e,t,n){if(e==null)return null;var r=n!=1?e.childNodes:[e.parentNode],i={"#":"id",".":"className"}[t.substr(0,1)]||"nodeName",s,o;s=i!="nodeName"?t.substr(1):t.toUpperCase();if((e[i]||"").indexOf(s)!=-1)return e;for(var u=0;r&&u<r.length&&o==null;u++)o=l(r[u],t,n);return o}function c(e,t){return l(e,t,!0)}function h(e,t,n){n=Math.max(n||0,0);for(var r=n;r<e.length;r++)if(e[r]==t)return r;return-1}function p(e){return(e||"")+Math.round(Math.random()*1e6).toString()}function d(e,t){var n={},r;for(r in e)n[r]=e[r];for(r in t)n[r]=t[r];return n}function v(e){var t={"true":!0,"false":!1}[e];return t==null?e:t}function m(e,t,n,r,i){var s=(screen.width-n)/2,o=(screen.height-r)/2;i+=", left="+s+", top="+o+", width="+n+", height="+r,i=i.replace(/^,/,"");var u=window.open(e,t,i);return u.focus(),u}function g(e,t,n,r){function i(e){e=e||window.event,e.target||(e.target=e.srcElement,e.preventDefault=function(){this.returnValue=!1}),n.call(r||window,e)}e.attachEvent?e.attachEvent("on"+t,i):e.addEventListener(t,i,!1)}function y(t){window.alert(e.config.strings.alert+t)}function b(t,n){var r=e.vars.discoveredBrushes,i=null;if(r==null){r={};for(var s in e.brushes){var o=e.brushes[s],u=o.aliases;if(u==null)continue;o.brushName=s.toLowerCase();for(var a=0;a<u.length;a++)r[u[a]]=s}e.vars.discoveredBrushes=r}return i=e.brushes[r[t]],i==null&&n&&y(e.config.strings.noBrush+t),i}function w(e,t){var n=s(e);for(var r=0;r<n.length;r++)n[r]=t(n[r],r);return n.join("\r\n")}function E(e){return e.replace(/^[ ]*[\n]+|[\n]*[ ]*$/g,"")}function S(e){var t,n={},r=new XRegExp("^\\[(?<values>(.*?))\\]$"),i=new XRegExp("(?<name>[\\w-]+)\\s*:\\s*(?<value>[\\w-%#]+|\\[.*?\\]|\".*?\"|'.*?')\\s*;?","g");while((t=i.exec(e))!=null){var s=t.value.replace(/^['"]|['"]$/g,"");if(s!=null&&r.test(s)){var o=r.exec(s);s=o.values.length>0?o.values.split(/\s*,\s*/):[]}n[t.name]=s}return n}function x(t,n){return t==null||t.length==0||t=="\n"?t:(t=t.replace(/</g,"<"),t=t.replace(/ {2,}/g,function(t){var n="";for(var r=0;r<t.length-1;r++)n+=e.config.space;return n+" "}),n!=null&&(t=w(t,function(e){if(e.length==0)return"";var t="";return e=e.replace(/^( | )+/,function(e){return t=e,""}),e.length==0?t:t+'<code class="'+n+'">'+e+"</code>"})),t)}function T(e,t){var n=e.toString();while(n.length<t)n="0"+n;return n}function N(e,t){var n="";for(var r=0;r<t;r++)n+=" ";return e.replace(/\t/g,n)}function C(e,t){function u(e,t,n){return e.substr(0,t)+i.substr(0,n)+e.substr(t+1,e.length)}var n=s(e),r=" ",i="";for(var o=0;o<50;o++)i+=" ";return e=w(e,function(e){if(e.indexOf(r)==-1)return e;var n=0;while((n=e.indexOf(r))!=-1){var i=t-n%t;e=u(e,n,i)}return e}),e}function k(t){var n=/<br\s*\/?>|<br\s*\/?>/gi;return e.config.bloggerMode==1&&(t=t.replace(n,"\n")),e.config.stripBrs==1&&(t=t.replace(n,"")),t}function L(e){return e.replace(/^\s+|\s+$/g,"")}function A(e){var t=s(k(e)),n=new Array,r=/^\s*/,i=1e3;for(var o=0;o<t.length&&i>0;o++){var u=t[o];if(L(u).length==0)continue;var a=r.exec(u);if(a==null)return e;i=Math.min(a[0].length,i)}if(i>0)for(var o=0;o<t.length;o++)t[o]=t[o].substr(i);return t.join("\n")}function O(e,t){return e.index<t.index?-1:e.index>t.index?1:e.length<t.length?-1:e.length>t.length?1:0}function M(t,n){function r(e,t){return e[0]}var i=0,s=null,o=[],u=n.func?n.func:r;while((s=n.regex.exec(t))!=null){var a=u(s,n);typeof a=="string"&&(a=[new e.Match(a,s.index,n.css)]),o=o.concat(a)}return o}function _(t){var n=/(.*)((>|<).*)/;return t.replace(e.regexLib.url,function(e){var t="",r=null;if(r=n.exec(e))e=r[1],t=r[2];return'<a href="'+e+'">'+e+"</a>"+t})}function D(){var e=document.getElementsByTagName("script"),t=[];for(var n=0;n<e.length;n++)e[n].type=="syntaxhighlighter"&&t.push(e[n]);return t}function P(e){var t="<![CDATA[",n="]]>",r=L(e),i=!1,s=t.length,o=n.length;r.indexOf(t)==0&&(r=r.substring(s),i=!0);var u=r.length;return r.indexOf(n)==u-o&&(r=r.substring(0,u-o),i=!0),i?r:e}function H(e){var t=e.target,i=c(t,".syntaxhighlighter"),s=c(t,".container"),o=document.createElement("textarea"),a;if(!s||!i||l(s,"textarea"))return;a=u(i.id),n(i,"source");var f=s.childNodes,h=[];for(var p=0;p<f.length;p++)h.push(f[p].innerText||f[p].textContent);h=h.join("\r"),h=h.replace(/\u00a0/g," "),o.appendChild(document.createTextNode(h)),s.appendChild(o),o.focus(),o.select(),g(o,"blur",function(e){o.parentNode.removeChild(o),r(i,"source")})}typeof require!="undefined"&&typeof XRegExp=="undefined"&&(XRegExp=require("XRegExp").XRegExp);var e={defaults:{"class-name":"","first-line":1,"pad-line-numbers":!1,highlight:null,title:null,"smart-tabs":!0,"tab-size":4,gutter:!0,toolbar:!0,"quick-code":!0,collapse:!1,"auto-links":!0,light:!1,unindent:!0,"html-script":!1},config:{space:" ",useScriptTags:!0,bloggerMode:!1,stripBrs:!1,tagName:"pre",strings:{expandSource:"expand source",help:"?",alert:"SyntaxHighlighter\n\n",noBrush:"Can't find brush for: ",brushNotHtmlScript:"Brush wasn't configured for html-script option: ",aboutDialog:"@ABOUT@"}},vars:{discoveredBrushes:null,highlighters:{}},brushes:{},regexLib:{multiLineCComments:/\/\*[\s\S]*?\*\//gm,singleLineCComments:/\/\/.*$/gm,singleLinePerlComments:/#.*$/gm,doubleQuotedString:/"([^\\"\n]|\\.)*"/g,singleQuotedString:/'([^\\'\n]|\\.)*'/g,multiLineDoubleQuotedString:new XRegExp('"([^\\\\"]|\\\\.)*"',"gs"),multiLineSingleQuotedString:new XRegExp("'([^\\\\']|\\\\.)*'","gs"),xmlComments:/(<|<)!--[\s\S]*?--(>|>)/gm,url:/\w+:\/\/[\w-.\/?%&=:@;#]*/g,phpScriptTags:{left:/(<|<)\?(?:=|php)?/g,right:/\?(>|>)/g,eof:!0},aspScriptTags:{left:/(<|<)%=?/g,right:/%(>|>)/g},scriptScriptTags:{left:/(<|<)\s*script.*?(>|>)/gi,right:/(<|<)\/\s*script\s*(>|>)/gi}},toolbar:{getHtml:function(t){function s(t,n){return e.toolbar.getButtonHtml(t,n,e.config.strings[n])}var n='<div class="toolbar">',r=e.toolbar.items,i=r.list;for(var o=0;o<i.length;o++)n+=(r[i[o]].getHtml||s)(t,i[o]);return n+="</div>",n},getButtonHtml:function(e,t,n){return'<span><a href="#" class="toolbar_item command_'+t+" "+t+'">'+n+"</a></span>"},handler:function(t){function i(e){var t=new RegExp(e+"_(\\w+)"),n=t.exec(r);return n?n[1]:null}var n=t.target,r=n.className||"",s=u(c(n,".syntaxhighlighter").id),o=i("command");s&&o&&e.toolbar.items[o].execute(s),t.preventDefault()},items:{list:["expandSource","help"],expandSource:{getHtml:function(t){if(t.getParam("collapse")!=1)return"";var n=t.getParam("title");return e.toolbar.getButtonHtml(t,"expandSource",n?n:e.config.strings.expandSource)},execute:function(e){var t=a(e.id);r(t,"collapsed")}},help:{execute:function(t){var n=m("","_blank",500,250,"scrollbars=0"),r=n.document;r.write(e.config.strings.aboutDialog),r.close(),n.focus()}}}},findElements:function(t,n){var r=n?[n]:i(document.getElementsByTagName(e.config.tagName)),s=e.config,o=[];s.useScriptTags&&(r=r.concat(D()));if(r.length===0)return o;for(var u=0;u<r.length;u++){var a={target:r[u],params:d(t,S(r[u].className))};if(a.params["brush"]==null)continue;o.push(a)}return o},highlight:function(t,n){var r=this.findElements(t,n),i="innerHTML",s=null,o=e.config;if(r.length===0)return;for(var u=0;u<r.length;u++){var n=r[u],a=n.target,f=n.params,l=f.brush,c;if(l==null)continue;if(f["html-script"]=="true"||e.defaults["html-script"]==1)s=new e.HtmlScript(l),l="htmlscript";else{var h=b(l);if(!h)continue;s=new h}c=a[i],o.useScriptTags&&(c=P(c)),(a.title||"")!=""&&(f.title=a.title),f.brush=l,s.init(f),n=s.getDiv(c),(a.id||"")!=""&&(n.id=a.id),a.parentNode.replaceChild(n,a)}},all:function(t){g(window,"load",function(){e.highlight(t)})}};return e.Match=function(e,t,n){this.value=e,this.index=t,this.length=e.length,this.css=n,this.brushName=null},e.Match.prototype.toString=function(){return this.value},e.HtmlScript=function(t){function f(e,t){for(var n=0;n<e.length;n++)e[n].index+=t}function l(e,t){var i=e.code,s=[],o=r.regexList,u=e.index+e.left.length,a=r.htmlScript,l;for(var c=0;c<o.length;c++)l=M(i,o[c]),f(l,u),s=s.concat(l);a.left!=null&&e.left!=null&&(l=M(e.left,a.left),f(l,e.index),s=s.concat(l)),a.right!=null&&e.right!=null&&(l=M(e.right,a.right),f(l,e.index+e[0].lastIndexOf(e.right)),s=s.concat(l));for(var h=0;h<s.length;h++)s[h].brushName=n.brushName;return s}var n=b(t),r,i=new e.brushes.Xml,s=null,o=this,u="getDiv getHtml init".split(" ");if(n==null)return;r=new n;for(var a=0;a<u.length;a++)(function(){var e=u[a];o[e]=function(){return i[e].apply(i,arguments)}})();if(r.htmlScript==null){y(e.config.strings.brushNotHtmlScript+t);return}i.regexList.push({regex:r.htmlScript.code,func:l})},e.Highlighter=function(){},e.Highlighter.prototype={getParam:function(e,t){var n=this.params[e];return v(n==null?t:n)},create:function(e){return document.createElement(e)},findMatches:function(e,t){var n=[];if(e!=null)for(var r=0;r<e.length;r++)typeof e[r]=="object"&&(n=n.concat(M(t,e[r])));return this.removeNestedMatches(n.sort(O))},removeNestedMatches:function(e){for(var t=0;t<e.length;t++){if(e[t]===null)continue;var n=e[t],r=n.index+n.length;for(var i=t+1;i<e.length&&e[t]!==null;i++){var s=e[i];if(s===null)continue;if(s.index>r)break;s.index==n.index&&s.length>n.length?e[t]=null:s.index>=n.index&&s.index<r&&(e[i]=null)}}return e},figureOutLineNumbers:function(e){var t=[],n=parseInt(this.getParam("first-line"));return w(e,function(e,r){t.push(r+n)}),t},isLineHighlighted:function(e){var t=this.getParam("highlight",[]);return typeof t!="object"&&t.push==null&&(t=[t]),h(t,e.toString())!=-1},getLineHtml:function(e,t,n){var r=["line","number"+t,"index"+e,"alt"+(t%2==0?1:2).toString()];return this.isLineHighlighted(t)&&r.push("highlighted"),t==0&&r.push("break"),'<div class="'+r.join(" ")+'">'+n+"</div>"},getLineNumbersHtml:function(t,n){var r="",i=s(t).length,o=parseInt(this.getParam("first-line")),u=this.getParam("pad-line-numbers");u==1?u=(o+i-1).toString().length:isNaN(u)==1&&(u=0);for(var a=0;a<i;a++){var f=n?n[a]:o+a,t=f==0?e.config.space:T(f,u);r+=this.getLineHtml(a,f,t)}return r},getCodeLinesHtml:function(t,n){t=L(t);var r=s(t),i=this.getParam("pad-line-numbers"),o=parseInt(this.getParam("first-line")),t="",u=this.getParam("brush");for(var a=0;a<r.length;a++){var f=r[a],l=/^( |\s)+/.exec(f),c=null,h=n?n[a]:o+a;l!=null&&(c=l[0].toString(),f=f.substr(c.length),c=c.replace(" ",e.config.space)),f=L(f),f.length==0&&(f=e.config.space),t+=this.getLineHtml(a,h,(c!=null?'<code class="'+u+' spaces">'+c+"</code>":"")+f)}return t},getTitleHtml:function(e){return e?"<caption>"+e+"</caption>":""},getMatchesHtml:function(e,t){function s(e){var t=e?e.brushName||i:i;return t?t+" ":""}var n=0,r="",i=this.getParam("brush","");for(var o=0;o<t.length;o++){var u=t[o],a;if(u===null||u.length===0)continue;a=s(u),r+=x(e.substr(n,u.index-n),a+"plain")+x(u.value,a+u.css),n=u.index+u.length+(u.offset||0)}return r+=x(e.substr(n),s()+"plain"),r},getHtml:function(t){var n="",r=["syntaxhighlighter"],i,s,u;return this.getParam("light")==1&&(this.params.toolbar=this.params.gutter=!1),className="syntaxhighlighter",this.getParam("collapse")==1&&r.push("collapsed"),(gutter=this.getParam("gutter"))==0&&r.push("nogutter"),r.push(this.getParam("class-name")),r.push(this.getParam("brush")),t=E(t).replace(/\r/g," "),i=this.getParam("tab-size"),t=this.getParam("smart-tabs")==1?C(t,i):N(t,i),this.getParam("unindent")&&(t=A(t)),gutter&&(u=this.figureOutLineNumbers(t)),s=this.findMatches(this.regexList,t),n=this.getMatchesHtml(t,s),n=this.getCodeLinesHtml(n,u),this.getParam("auto-links")&&(n=_(n)),typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.match(/MSIE/)&&r.push("ie"),n='<div id="'+o(this.id)+'" class="'+r.join(" ")+'">'+(this.getParam("toolbar")?e.toolbar.getHtml(this):"")+'<table border="0" cellpadding="0" cellspacing="0">'+this.getTitleHtml(this.getParam("title"))+"<tbody>"+"<tr>"+(gutter?'<td class="gutter">'+this.getLineNumbersHtml(t)+"</td>":"")+'<td class="code">'+'<div class="container">'+n+"</div>"+"</td>"+"</tr>"+"</tbody>"+"</table>"+"</div>",n},getDiv:function(t){t===null&&(t=""),this.code=t;var n=this.create("div");return n.innerHTML=this.getHtml(t),this.getParam("toolbar")&&g(l(n,".toolbar"),"click",e.toolbar.handler),this.getParam("quick-code")&&g(l(n,".code"),"dblclick",H),n},init:function(t){this.id=p(),f(this),this.params=d(e.defaults,t||{}),this.getParam("light")==1&&(this.params.toolbar=this.params.gutter=!1)},getKeywords:function(e){return e=e.replace(/^\s+|\s+$/g,"").replace(/\s+/g,"|"),"\\b(?:"+e+")\\b"},forHtmlScript:function(e){var t={end:e.right.source};e.eof&&(t.end="(?:(?:"+t.end+")|$)"),this.htmlScript={left:{regex:e.left,css:"script"},right:{regex:e.right,css:"script"},code:new XRegExp("(?<left>"+e.left.source+")"+"(?<code>.*?)"+"(?<right>"+t.end+")","sgi")}}},e}();typeof exports!="undefined"?exports.SyntaxHighlighter=SyntaxHighlighter:null
\ No newline at end of file
+++ /dev/null
-var dp = {
- SyntaxHighlighter : {}
-};
-
-dp.SyntaxHighlighter = {
- parseParams: function(
- input,
- showGutter,
- showControls,
- collapseAll,
- firstLine,
- showColumns
- )
- {
- function getValue(list, name)
- {
- var regex = new XRegExp('^' + name + '\\[(?<value>\\w+)\\]$', 'gi'),
- match = null
- ;
-
- for (var i = 0; i < list.length; i++)
- if ((match = regex.exec(list[i])) != null)
- return match.value;
-
- return null;
- };
-
- function defaultValue(value, def)
- {
- return value != null ? value : def;
- };
-
- function asString(value)
- {
- return value != null ? value.toString() : null;
- };
-
- var parts = input.split(':'),
- brushName = parts[0],
- options = {},
- straight = { 'true' : true }
- reverse = { 'true' : false },
- result = null,
- defaults = SyntaxHighlighter.defaults
- ;
-
- for (var i in parts)
- options[parts[i]] = 'true';
-
- showGutter = asString(defaultValue(showGutter, defaults.gutter));
- showControls = asString(defaultValue(showControls, defaults.toolbar));
- collapseAll = asString(defaultValue(collapseAll, defaults.collapse));
- showColumns = asString(defaultValue(showColumns, defaults.ruler));
- firstLine = asString(defaultValue(firstLine, defaults['first-line']));
-
- return {
- brush : brushName,
- gutter : defaultValue(reverse[options.nogutter], showGutter),
- toolbar : defaultValue(reverse[options.nocontrols], showControls),
- collapse : defaultValue(straight[options.collapse], collapseAll),
- // ruler : defaultValue(straight[options.showcolumns], showColumns),
- 'first-line' : defaultValue(getValue(parts, 'firstline'), firstLine)
- };
- },
-
- HighlightAll: function(
- name,
- showGutter /* optional */,
- showControls /* optional */,
- collapseAll /* optional */,
- firstLine /* optional */,
- showColumns /* optional */
- )
- {
- function findValue()
- {
- var a = arguments;
-
- for (var i = 0; i < a.length; i++)
- {
- if (a[i] === null)
- continue;
-
- if (typeof(a[i]) == 'string' && a[i] != '')
- return a[i] + '';
-
- if (typeof(a[i]) == 'object' && a[i].value != '')
- return a[i].value + '';
- }
-
- return null;
- };
-
- function findTagsByName(list, name, tagName)
- {
- var tags = document.getElementsByTagName(tagName);
-
- for (var i = 0; i < tags.length; i++)
- if (tags[i].getAttribute('name') == name)
- list.push(tags[i]);
- }
-
- var elements = [],
- highlighter = null,
- registered = {},
- propertyName = 'innerHTML'
- ;
-
- // for some reason IE doesn't find <pre/> by name, however it does see them just fine by tag name...
- findTagsByName(elements, name, 'pre');
- findTagsByName(elements, name, 'textarea');
-
- if (elements.length === 0)
- return;
-
- for (var i = 0; i < elements.length; i++)
- {
- var element = elements[i],
- params = findValue(
- element.attributes['class'], element.className,
- element.attributes['language'], element.language
- ),
- language = ''
- ;
-
- if (params === null)
- continue;
-
- params = dp.SyntaxHighlighter.parseParams(
- params,
- showGutter,
- showControls,
- collapseAll,
- firstLine,
- showColumns
- );
-
- SyntaxHighlighter.highlight(params, element);
- }
- }
-};
+++ /dev/null
-<?php
-/**
- * PHPMailer simple file upload and send example
- */
-$msg = '';
-if (array_key_exists('userfile', $_FILES)) {
- // First handle the upload
- // Don't trust provided filename - same goes for MIME types
- // See http://php.net/manual/en/features.file-upload.php#114004 for more thorough upload validation
- $uploadfile = tempnam(sys_get_temp_dir(), sha1($_FILES['userfile']['name']));
- if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
- // Upload handled successfully
- // Now create a message
- // This should be somewhere in your include_path
- require '../PHPMailerAutoload.php';
- $mail = new PHPMailer;
- $mail->setFrom('from@example.com', 'First Last');
- $mail->addAddress('whoto@example.com', 'John Doe');
- $mail->Subject = 'PHPMailer file sender';
- $mail->msgHTML("My message body");
- // Attach the uploaded file
- $mail->addAttachment($uploadfile, 'My uploaded file');
- if (!$mail->send()) {
- $msg .= "Mailer Error: " . $mail->ErrorInfo;
- } else {
- $msg .= "Message sent!";
- }
- } else {
- $msg .= 'Failed to move file to ' . $uploadfile;
- }
-}
-?>
-<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>PHPMailer Upload</title>
-</head>
-<body>
-<?php if (empty($msg)) { ?>
- <form method="post" enctype="multipart/form-data">
- <input type="hidden" name="MAX_FILE_SIZE" value="100000"> Send this file: <input name="userfile" type="file">
- <input type="submit" value="Send File">
- </form>
-<?php } else {
- echo $msg;
-} ?>
-</body>
-</html>
\ No newline at end of file
+++ /dev/null
-<?php
-/**
- * PHPMailer multiple files upload and send example
- */
-$msg = '';
-if (array_key_exists('userfile', $_FILES)) {
-
- // Create a message
- // This should be somewhere in your include_path
- require '../PHPMailerAutoload.php';
- $mail = new PHPMailer;
- $mail->setFrom('from@example.com', 'First Last');
- $mail->addAddress('whoto@example.com', 'John Doe');
- $mail->Subject = 'PHPMailer file sender';
- $mail->msgHTML('My message body');
- //Attach multiple files one by one
- for ($ct = 0; $ct < count($_FILES['userfile']['tmp_name']); $ct++) {
- $uploadfile = tempnam(sys_get_temp_dir(), sha1($_FILES['userfile']['name'][$ct]));
- $filename = $_FILES['userfile']['name'][$ct];
- if (move_uploaded_file($_FILES['userfile']['tmp_name'][$ct], $uploadfile)) {
- $mail->addAttachment($uploadfile, $filename);
- } else {
- $msg .= 'Failed to move file to ' . $uploadfile;
- }
- }
- if (!$mail->send()) {
- $msg .= "Mailer Error: " . $mail->ErrorInfo;
- } else {
- $msg .= "Message sent!";
- }
-}
-?>
-<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>PHPMailer Upload</title>
-</head>
-<body>
-<?php if (empty($msg)) { ?>
- <form method="post" enctype="multipart/form-data">
- <input type="hidden" name="MAX_FILE_SIZE" value="100000">
- Select one or more files:
- <input name="userfile[]" type="file" multiple="multiple">
- <input type="submit" value="Send Files">
- </form>
-<?php } else {
- echo $msg;
-} ?>
-</body>
-</html>
+++ /dev/null
-<?php
-/**
- * This example shows sending a message using a local sendmail binary.
- */
-
-require '../PHPMailerAutoload.php';
-
-//Create a new PHPMailer instance
-$mail = new PHPMailer;
-// Set PHPMailer to use the sendmail transport
-$mail->isSendmail();
-//Set who the message is to be sent from
-$mail->setFrom('from@example.com', 'First Last');
-//Set an alternative reply-to address
-$mail->addReplyTo('replyto@example.com', 'First Last');
-//Set who the message is to be sent to
-$mail->addAddress('whoto@example.com', 'John Doe');
-//Set the subject line
-$mail->Subject = 'PHPMailer sendmail test';
-//Read an HTML message body from an external file, convert referenced images to embedded,
-//convert HTML into a basic plain-text alternative body
-$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
-//Replace the plain text body with one created manually
-$mail->AltBody = 'This is a plain-text message body';
-//Attach an image file
-$mail->addAttachment('images/phpmailer_mini.png');
-
-//send the message, check for errors
-if (!$mail->send()) {
- echo "Mailer Error: " . $mail->ErrorInfo;
-} else {
- echo "Message sent!";
-}
+++ /dev/null
-<?php
-/**
- * This example shows signing a message and then sending it via the mail() function of PHP.
- *
- * Before you can sign the mail certificates are needed.
- *
- *
- * STEP 1 - Creating a certificate:
- * You can either use a self signed certificate, pay for a signed one or use free alternatives such as StartSSL/Comodo etc.
- * Check out this link for more providers: http://kb.mozillazine.org/Getting_an_SMIME_certificate
- * In this example I am using Comodo.
- * The form is directly available via https://secure.comodo.com/products/frontpage?area=SecureEmailCertificate
- * Fill it out and you'll get an email with a link to download your certificate.
- * Usually the certificate will be directly installed into your browser (FireFox/Chrome).
- *
- *
- * STEP 2 - Exporting the certificate
- * This is specific to your browser, however, most browsers will give you the option to export your recently added certificate in PKCS12 (.pfx)
- * Include your private key if you are asked for it.
- * Set up a password to protect your exported file.
- *
- * STEP 3 - Splitting the .pfx into a private key and the certificate.
- * I use openssl for this. You only need two commands. In my case the certificate file is called 'exported-cert.pfx'
- * To create the private key do the following:
- *
- * openssl pkcs12 -in exported-cert.pfx -nocerts -out cert.key
- *
- * Of course the way you name your file (-out) is up to you.
- * You will be asked for a password for the Import password. This is the password you just set while exporting the certificate into the pfx file.
- * Afterwards, you can password protect your private key (recommended)
- * Also make sure to set the permissions to a minimum level and suitable for your application.
- * To create the certificate file use the following command:
- *
- * openssl pkcs12 -in exported-cert.pfx -clcerts -nokeys -out cert.crt
- *
- * Again, the way you name your certificate is up to you. You will be also asked for the Import Password.
- * To create the certificate-chain file use the following command:
- *
- * openssl pkcs12 -in exported-cert.pfx -cacerts -out certchain.pem
- *
- * Again, the way you name your chain file is up to you. You will be also asked for the Import Password.
- *
- *
- * STEP 3 - Code
- */
-
-require '../PHPMailerAutoload.php';
-
-//Create a new PHPMailer instance
-$mail = new PHPMailer();
-//Set who the message is to be sent from
-//IMPORTANT: This must match the email address of your certificate.
-//Although the certificate will be valid, an error will be thrown since it cannot be verified that the sender and the signer are the same person.
-$mail->setFrom('from@example.com', 'First Last');
-//Set an alternative reply-to address
-$mail->addReplyTo('replyto@example.com', 'First Last');
-//Set who the message is to be sent to
-$mail->addAddress('whoto@example.com', 'John Doe');
-//Set the subject line
-$mail->Subject = 'PHPMailer mail() test';
-//Read an HTML message body from an external file, convert referenced images to embedded,
-//Convert HTML into a basic plain-text alternative body
-$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
-//Replace the plain text body with one created manually
-$mail->AltBody = 'This is a plain-text message body';
-//Attach an image file
-$mail->addAttachment('images/phpmailer_mini.png');
-
-//Configure message signing (the actual signing does not occur until sending)
-$mail->sign(
- '/path/to/cert.crt', //The location of your certificate file
- '/path/to/cert.key', //The location of your private key file
- 'yourSecretPrivateKeyPassword', //The password you protected your private key with (not the Import Password! may be empty but parameter must not be omitted!)
- '/path/to/certchain.pem' //The location of your chain file
-);
-
-//Send the message, check for errors
-if (!$mail->send()) {
- echo "Mailer Error: " . $mail->ErrorInfo;
-} else {
- echo "Message sent!";
-}
-
-/**
- * REMARKS:
- * If your email client does not support S/MIME it will most likely just show an attachment smime.p7s which is the signature contained in the email.
- * Other clients, such as Thunderbird support S/MIME natively and will validate the signature automatically and report the result in some way.
- */
-?>
+++ /dev/null
-<?php
-/**
- * This example shows making an SMTP connection with authentication.
- */
-
-//SMTP needs accurate times, and the PHP time zone MUST be set
-//This should be done in your php.ini, but this is how to do it if you don't have access to that
-date_default_timezone_set('Etc/UTC');
-
-require '../PHPMailerAutoload.php';
-
-//Create a new PHPMailer instance
-$mail = new PHPMailer;
-//Tell PHPMailer to use SMTP
-$mail->isSMTP();
-//Enable SMTP debugging
-// 0 = off (for production use)
-// 1 = client messages
-// 2 = client and server messages
-$mail->SMTPDebug = 2;
-//Ask for HTML-friendly debug output
-$mail->Debugoutput = 'html';
-//Set the hostname of the mail server
-$mail->Host = "mail.example.com";
-//Set the SMTP port number - likely to be 25, 465 or 587
-$mail->Port = 25;
-//Whether to use SMTP authentication
-$mail->SMTPAuth = true;
-//Username to use for SMTP authentication
-$mail->Username = "yourname@example.com";
-//Password to use for SMTP authentication
-$mail->Password = "yourpassword";
-//Set who the message is to be sent from
-$mail->setFrom('from@example.com', 'First Last');
-//Set an alternative reply-to address
-$mail->addReplyTo('replyto@example.com', 'First Last');
-//Set who the message is to be sent to
-$mail->addAddress('whoto@example.com', 'John Doe');
-//Set the subject line
-$mail->Subject = 'PHPMailer SMTP test';
-//Read an HTML message body from an external file, convert referenced images to embedded,
-//convert HTML into a basic plain-text alternative body
-$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
-//Replace the plain text body with one created manually
-$mail->AltBody = 'This is a plain-text message body';
-//Attach an image file
-$mail->addAttachment('images/phpmailer_mini.png');
-
-//send the message, check for errors
-if (!$mail->send()) {
- echo "Mailer Error: " . $mail->ErrorInfo;
-} else {
- echo "Message sent!";
-}
+++ /dev/null
-<?php
-/**
- * This uses the SMTP class alone to check that a connection can be made to an SMTP server,
- * authenticate, then disconnect
- */
-
-//SMTP needs accurate times, and the PHP time zone MUST be set
-//This should be done in your php.ini, but this is how to do it if you don't have access to that
-date_default_timezone_set('Etc/UTC');
-
-require '../PHPMailerAutoload.php';
-
-//Create a new SMTP instance
-$smtp = new SMTP;
-
-//Enable connection-level debug output
-$smtp->do_debug = SMTP::DEBUG_CONNECTION;
-
-try {
- //Connect to an SMTP server
- if (!$smtp->connect('mail.example.com', 25)) {
- throw new Exception('Connect failed');
- }
- //Say hello
- if (!$smtp->hello(gethostname())) {
- throw new Exception('EHLO failed: ' . $smtp->getError()['error']);
- }
- //Get the list of ESMTP services the server offers
- $e = $smtp->getServerExtList();
- //If server can do TLS encryption, use it
- if (is_array($e) && array_key_exists('STARTTLS', $e)) {
- $tlsok = $smtp->startTLS();
- if (!$tlsok) {
- throw new Exception('Failed to start encryption: ' . $smtp->getError()['error']);
- }
- //Repeat EHLO after STARTTLS
- if (!$smtp->hello(gethostname())) {
- throw new Exception('EHLO (2) failed: ' . $smtp->getError()['error']);
- }
- //Get new capabilities list, which will usually now include AUTH if it didn't before
- $e = $smtp->getServerExtList();
- }
- //If server supports authentication, do it (even if no encryption)
- if (is_array($e) && array_key_exists('AUTH', $e)) {
- if ($smtp->authenticate('username', 'password')) {
- echo "Connected ok!";
- } else {
- throw new Exception('Authentication failed: ' . $smtp->getError()['error']);
- }
- }
-} catch (Exception $e) {
- echo 'SMTP error: ' . $e->getMessage(), "\n";
-}
-//Whatever happened, close the connection.
-$smtp->quit(true);
+++ /dev/null
-<?php
-/**
- * This example shows making an SMTP connection without using authentication.
- */
-
-//SMTP needs accurate times, and the PHP time zone MUST be set
-//This should be done in your php.ini, but this is how to do it if you don't have access to that
-date_default_timezone_set('Etc/UTC');
-
-require_once '../PHPMailerAutoload.php';
-
-//Create a new PHPMailer instance
-$mail = new PHPMailer;
-//Tell PHPMailer to use SMTP
-$mail->isSMTP();
-//Enable SMTP debugging
-// 0 = off (for production use)
-// 1 = client messages
-// 2 = client and server messages
-$mail->SMTPDebug = 2;
-//Ask for HTML-friendly debug output
-$mail->Debugoutput = 'html';
-//Set the hostname of the mail server
-$mail->Host = "mail.example.com";
-//Set the SMTP port number - likely to be 25, 465 or 587
-$mail->Port = 25;
-//Whether to use SMTP authentication
-$mail->SMTPAuth = false;
-//Set who the message is to be sent from
-$mail->setFrom('from@example.com', 'First Last');
-//Set an alternative reply-to address
-$mail->addReplyTo('replyto@example.com', 'First Last');
-//Set who the message is to be sent to
-$mail->addAddress('whoto@example.com', 'John Doe');
-//Set the subject line
-$mail->Subject = 'PHPMailer SMTP without auth test';
-//Read an HTML message body from an external file, convert referenced images to embedded,
-//convert HTML into a basic plain-text alternative body
-$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
-//Replace the plain text body with one created manually
-$mail->AltBody = 'This is a plain-text message body';
-//Attach an image file
-$mail->addAttachment('images/phpmailer_mini.png');
-
-//send the message, check for errors
-if (!$mail->send()) {
- echo "Mailer Error: " . $mail->ErrorInfo;
-} else {
- echo "Message sent!";
-}
+++ /dev/null
-<?php
-/**
- * This example shows settings to use when sending over SMTP with TLS and custom connection options.
- */
-
-//SMTP needs accurate times, and the PHP time zone MUST be set
-//This should be done in your php.ini, but this is how to do it if you don't have access to that
-date_default_timezone_set('Etc/UTC');
-
-require '../PHPMailerAutoload.php';
-
-//Create a new PHPMailer instance
-$mail = new PHPMailer;
-
-//Tell PHPMailer to use SMTP
-$mail->isSMTP();
-
-//Enable SMTP debugging
-// 0 = off (for production use)
-// 1 = client messages
-// 2 = client and server messages
-$mail->SMTPDebug = 2;
-
-//Ask for HTML-friendly debug output
-$mail->Debugoutput = 'html';
-
-//Set the hostname of the mail server
-$mail->Host = 'smtp.example.com';
-
-//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
-$mail->Port = 587;
-
-//Set the encryption system to use - ssl (deprecated) or tls
-$mail->SMTPSecure = 'tls';
-
-//Custom connection options
-$mail->SMTPOptions = array (
- 'ssl' => array(
- 'verify_peer' => true,
- 'verify_depth' => 3,
- 'allow_self_signed' => true,
- 'peer_name' => 'smtp.example.com',
- 'cafile' => '/etc/ssl/ca_cert.pem',
- )
-);
-
-//Whether to use SMTP authentication
-$mail->SMTPAuth = true;
-
-//Username to use for SMTP authentication - use full email address for gmail
-$mail->Username = "username@example.com";
-
-//Password to use for SMTP authentication
-$mail->Password = "yourpassword";
-
-//Set who the message is to be sent from
-$mail->setFrom('from@example.com', 'First Last');
-
-//Set who the message is to be sent to
-$mail->addAddress('whoto@example.com', 'John Doe');
-
-//Set the subject line
-$mail->Subject = 'PHPMailer SMTP options test';
-
-//Read an HTML message body from an external file, convert referenced images to embedded,
-//convert HTML into a basic plain-text alternative body
-$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
-
-//send the message, check for errors
-if (!$mail->send()) {
- echo "Mailer Error: " . $mail->ErrorInfo;
-} else {
- echo "Message sent!";
-}
+++ /dev/null
-.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
-.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
-.syntaxhighlighter.source{overflow:hidden !important;}
-.syntaxhighlighter .bold{font-weight:bold !important;}
-.syntaxhighlighter .italic{font-style:italic !important;}
-.syntaxhighlighter .line{white-space:pre !important;}
-.syntaxhighlighter table{width:100% !important;}
-.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
-.syntaxhighlighter table td.code{width:100% !important;}
-.syntaxhighlighter table td.code .container{position:relative !important;}
-.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
-.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
-.syntaxhighlighter table td.code .line{padding:0 1em !important;}
-.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
-.syntaxhighlighter.show{display:block !important;}
-.syntaxhighlighter.collapsed table{display:none !important;}
-.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
-.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
-.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
-.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
-.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
-.syntaxhighlighter .toolbar span.title{display:inline !important;}
-.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
-.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
-.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
-.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
-.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
-.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
-.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
-.syntaxhighlighter.printing .line .content{color:black !important;}
-.syntaxhighlighter.printing .toolbar{display:none !important;}
-.syntaxhighlighter.printing a{text-decoration:none !important;}
-.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
-.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
-.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
-.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
-.syntaxhighlighter.printing .preprocessor{color:gray !important;}
-.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
-.syntaxhighlighter.printing .value{color:#009900 !important;}
-.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
-.syntaxhighlighter.printing .constants{color:#0066cc !important;}
-.syntaxhighlighter.printing .script{font-weight:bold !important;}
-.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
-.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
-.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
-.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
+++ /dev/null
-.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
-.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
-.syntaxhighlighter.source{overflow:hidden !important;}
-.syntaxhighlighter .bold{font-weight:bold !important;}
-.syntaxhighlighter .italic{font-style:italic !important;}
-.syntaxhighlighter .line{white-space:pre !important;}
-.syntaxhighlighter table{width:100% !important;}
-.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
-.syntaxhighlighter table td.code{width:100% !important;}
-.syntaxhighlighter table td.code .container{position:relative !important;}
-.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
-.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
-.syntaxhighlighter table td.code .line{padding:0 1em !important;}
-.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
-.syntaxhighlighter.show{display:block !important;}
-.syntaxhighlighter.collapsed table{display:none !important;}
-.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
-.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
-.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
-.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
-.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
-.syntaxhighlighter .toolbar span.title{display:inline !important;}
-.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
-.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
-.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
-.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
-.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
-.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
-.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
-.syntaxhighlighter.printing .line .content{color:black !important;}
-.syntaxhighlighter.printing .toolbar{display:none !important;}
-.syntaxhighlighter.printing a{text-decoration:none !important;}
-.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
-.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
-.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
-.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
-.syntaxhighlighter.printing .preprocessor{color:gray !important;}
-.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
-.syntaxhighlighter.printing .value{color:#009900 !important;}
-.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
-.syntaxhighlighter.printing .constants{color:#0066cc !important;}
-.syntaxhighlighter.printing .script{font-weight:bold !important;}
-.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
-.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
-.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
-.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
-.syntaxhighlighter{background-color:white !important;}
-.syntaxhighlighter .line.alt1{background-color:white !important;}
-.syntaxhighlighter .line.alt2{background-color:white !important;}
-.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#e0e0e0 !important;}
-.syntaxhighlighter .line.highlighted.number{color:black !important;}
-.syntaxhighlighter table caption{color:black !important;}
-.syntaxhighlighter .gutter{color:#afafaf !important;}
-.syntaxhighlighter .gutter .line{border-right:3px solid #6ce26c !important;}
-.syntaxhighlighter .gutter .line.highlighted{background-color:#6ce26c !important;color:white !important;}
-.syntaxhighlighter.printing .line .content{border:none !important;}
-.syntaxhighlighter.collapsed{overflow:visible !important;}
-.syntaxhighlighter.collapsed .toolbar{color:blue !important;background:white !important;border:1px solid #6ce26c !important;}
-.syntaxhighlighter.collapsed .toolbar a{color:blue !important;}
-.syntaxhighlighter.collapsed .toolbar a:hover{color:red !important;}
-.syntaxhighlighter .toolbar{color:white !important;background:#6ce26c !important;border:none !important;}
-.syntaxhighlighter .toolbar a{color:white !important;}
-.syntaxhighlighter .toolbar a:hover{color:black !important;}
-.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;}
-.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#008200 !important;}
-.syntaxhighlighter .string,.syntaxhighlighter .string a{color:blue !important;}
-.syntaxhighlighter .keyword{color:#006699 !important;}
-.syntaxhighlighter .preprocessor{color:gray !important;}
-.syntaxhighlighter .variable{color:#aa7700 !important;}
-.syntaxhighlighter .value{color:#009900 !important;}
-.syntaxhighlighter .functions{color:#ff1493 !important;}
-.syntaxhighlighter .constants{color:#0066cc !important;}
-.syntaxhighlighter .script{font-weight:bold !important;color:#006699 !important;background-color:none !important;}
-.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;}
-.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;}
-.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;}
-.syntaxhighlighter .keyword{font-weight:bold !important;}
+++ /dev/null
-.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
-.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
-.syntaxhighlighter.source{overflow:hidden !important;}
-.syntaxhighlighter .bold{font-weight:bold !important;}
-.syntaxhighlighter .italic{font-style:italic !important;}
-.syntaxhighlighter .line{white-space:pre !important;}
-.syntaxhighlighter table{width:100% !important;}
-.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
-.syntaxhighlighter table td.code{width:100% !important;}
-.syntaxhighlighter table td.code .container{position:relative !important;}
-.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
-.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
-.syntaxhighlighter table td.code .line{padding:0 1em !important;}
-.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
-.syntaxhighlighter.show{display:block !important;}
-.syntaxhighlighter.collapsed table{display:none !important;}
-.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
-.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
-.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
-.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
-.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
-.syntaxhighlighter .toolbar span.title{display:inline !important;}
-.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
-.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
-.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
-.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
-.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
-.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
-.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
-.syntaxhighlighter.printing .line .content{color:black !important;}
-.syntaxhighlighter.printing .toolbar{display:none !important;}
-.syntaxhighlighter.printing a{text-decoration:none !important;}
-.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
-.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
-.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
-.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
-.syntaxhighlighter.printing .preprocessor{color:gray !important;}
-.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
-.syntaxhighlighter.printing .value{color:#009900 !important;}
-.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
-.syntaxhighlighter.printing .constants{color:#0066cc !important;}
-.syntaxhighlighter.printing .script{font-weight:bold !important;}
-.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
-.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
-.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
-.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
-.syntaxhighlighter{background-color:#0a2b1d !important;}
-.syntaxhighlighter .line.alt1{background-color:#0a2b1d !important;}
-.syntaxhighlighter .line.alt2{background-color:#0a2b1d !important;}
-.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#233729 !important;}
-.syntaxhighlighter .line.highlighted.number{color:white !important;}
-.syntaxhighlighter table caption{color:#f8f8f8 !important;}
-.syntaxhighlighter .gutter{color:#497958 !important;}
-.syntaxhighlighter .gutter .line{border-right:3px solid #41a83e !important;}
-.syntaxhighlighter .gutter .line.highlighted{background-color:#41a83e !important;color:#0a2b1d !important;}
-.syntaxhighlighter.printing .line .content{border:none !important;}
-.syntaxhighlighter.collapsed{overflow:visible !important;}
-.syntaxhighlighter.collapsed .toolbar{color:#96dd3b !important;background:black !important;border:1px solid #41a83e !important;}
-.syntaxhighlighter.collapsed .toolbar a{color:#96dd3b !important;}
-.syntaxhighlighter.collapsed .toolbar a:hover{color:white !important;}
-.syntaxhighlighter .toolbar{color:white !important;background:#41a83e !important;border:none !important;}
-.syntaxhighlighter .toolbar a{color:white !important;}
-.syntaxhighlighter .toolbar a:hover{color:#ffe862 !important;}
-.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#f8f8f8 !important;}
-.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#336442 !important;}
-.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#9df39f !important;}
-.syntaxhighlighter .keyword{color:#96dd3b !important;}
-.syntaxhighlighter .preprocessor{color:#91bb9e !important;}
-.syntaxhighlighter .variable{color:#ffaa3e !important;}
-.syntaxhighlighter .value{color:#f7e741 !important;}
-.syntaxhighlighter .functions{color:#ffaa3e !important;}
-.syntaxhighlighter .constants{color:#e0e8ff !important;}
-.syntaxhighlighter .script{font-weight:bold !important;color:#96dd3b !important;background-color:none !important;}
-.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#eb939a !important;}
-.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#91bb9e !important;}
-.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#edef7d !important;}
-.syntaxhighlighter .comments{font-style:italic !important;}
-.syntaxhighlighter .keyword{font-weight:bold !important;}
+++ /dev/null
-.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
-.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
-.syntaxhighlighter.source{overflow:hidden !important;}
-.syntaxhighlighter .bold{font-weight:bold !important;}
-.syntaxhighlighter .italic{font-style:italic !important;}
-.syntaxhighlighter .line{white-space:pre !important;}
-.syntaxhighlighter table{width:100% !important;}
-.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
-.syntaxhighlighter table td.code{width:100% !important;}
-.syntaxhighlighter table td.code .container{position:relative !important;}
-.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
-.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
-.syntaxhighlighter table td.code .line{padding:0 1em !important;}
-.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
-.syntaxhighlighter.show{display:block !important;}
-.syntaxhighlighter.collapsed table{display:none !important;}
-.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
-.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
-.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
-.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
-.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
-.syntaxhighlighter .toolbar span.title{display:inline !important;}
-.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
-.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
-.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
-.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
-.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
-.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
-.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
-.syntaxhighlighter.printing .line .content{color:black !important;}
-.syntaxhighlighter.printing .toolbar{display:none !important;}
-.syntaxhighlighter.printing a{text-decoration:none !important;}
-.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
-.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
-.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
-.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
-.syntaxhighlighter.printing .preprocessor{color:gray !important;}
-.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
-.syntaxhighlighter.printing .value{color:#009900 !important;}
-.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
-.syntaxhighlighter.printing .constants{color:#0066cc !important;}
-.syntaxhighlighter.printing .script{font-weight:bold !important;}
-.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
-.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
-.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
-.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
-.syntaxhighlighter{background-color:white !important;}
-.syntaxhighlighter .line.alt1{background-color:white !important;}
-.syntaxhighlighter .line.alt2{background-color:white !important;}
-.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#c3defe !important;}
-.syntaxhighlighter .line.highlighted.number{color:white !important;}
-.syntaxhighlighter table caption{color:black !important;}
-.syntaxhighlighter .gutter{color:#787878 !important;}
-.syntaxhighlighter .gutter .line{border-right:3px solid #d4d0c8 !important;}
-.syntaxhighlighter .gutter .line.highlighted{background-color:#d4d0c8 !important;color:white !important;}
-.syntaxhighlighter.printing .line .content{border:none !important;}
-.syntaxhighlighter.collapsed{overflow:visible !important;}
-.syntaxhighlighter.collapsed .toolbar{color:#3f5fbf !important;background:white !important;border:1px solid #d4d0c8 !important;}
-.syntaxhighlighter.collapsed .toolbar a{color:#3f5fbf !important;}
-.syntaxhighlighter.collapsed .toolbar a:hover{color:#aa7700 !important;}
-.syntaxhighlighter .toolbar{color:#a0a0a0 !important;background:#d4d0c8 !important;border:none !important;}
-.syntaxhighlighter .toolbar a{color:#a0a0a0 !important;}
-.syntaxhighlighter .toolbar a:hover{color:red !important;}
-.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;}
-.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#3f5fbf !important;}
-.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#2a00ff !important;}
-.syntaxhighlighter .keyword{color:#7f0055 !important;}
-.syntaxhighlighter .preprocessor{color:#646464 !important;}
-.syntaxhighlighter .variable{color:#aa7700 !important;}
-.syntaxhighlighter .value{color:#009900 !important;}
-.syntaxhighlighter .functions{color:#ff1493 !important;}
-.syntaxhighlighter .constants{color:#0066cc !important;}
-.syntaxhighlighter .script{font-weight:bold !important;color:#7f0055 !important;background-color:none !important;}
-.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;}
-.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;}
-.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;}
-.syntaxhighlighter .keyword{font-weight:bold !important;}
-.syntaxhighlighter .xml .keyword{color:#3f7f7f !important;font-weight:normal !important;}
-.syntaxhighlighter .xml .color1,.syntaxhighlighter .xml .color1 a{color:#7f007f !important;}
-.syntaxhighlighter .xml .string{font-style:italic !important;color:#2a00ff !important;}
+++ /dev/null
-.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
-.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
-.syntaxhighlighter.source{overflow:hidden !important;}
-.syntaxhighlighter .bold{font-weight:bold !important;}
-.syntaxhighlighter .italic{font-style:italic !important;}
-.syntaxhighlighter .line{white-space:pre !important;}
-.syntaxhighlighter table{width:100% !important;}
-.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
-.syntaxhighlighter table td.code{width:100% !important;}
-.syntaxhighlighter table td.code .container{position:relative !important;}
-.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
-.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
-.syntaxhighlighter table td.code .line{padding:0 1em !important;}
-.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
-.syntaxhighlighter.show{display:block !important;}
-.syntaxhighlighter.collapsed table{display:none !important;}
-.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
-.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
-.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
-.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
-.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
-.syntaxhighlighter .toolbar span.title{display:inline !important;}
-.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
-.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
-.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
-.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
-.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
-.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
-.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
-.syntaxhighlighter.printing .line .content{color:black !important;}
-.syntaxhighlighter.printing .toolbar{display:none !important;}
-.syntaxhighlighter.printing a{text-decoration:none !important;}
-.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
-.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
-.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
-.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
-.syntaxhighlighter.printing .preprocessor{color:gray !important;}
-.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
-.syntaxhighlighter.printing .value{color:#009900 !important;}
-.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
-.syntaxhighlighter.printing .constants{color:#0066cc !important;}
-.syntaxhighlighter.printing .script{font-weight:bold !important;}
-.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
-.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
-.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
-.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
-.syntaxhighlighter{background-color:black !important;}
-.syntaxhighlighter .line.alt1{background-color:black !important;}
-.syntaxhighlighter .line.alt2{background-color:black !important;}
-.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#2a3133 !important;}
-.syntaxhighlighter .line.highlighted.number{color:white !important;}
-.syntaxhighlighter table caption{color:#d3d3d3 !important;}
-.syntaxhighlighter .gutter{color:#d3d3d3 !important;}
-.syntaxhighlighter .gutter .line{border-right:3px solid #990000 !important;}
-.syntaxhighlighter .gutter .line.highlighted{background-color:#990000 !important;color:black !important;}
-.syntaxhighlighter.printing .line .content{border:none !important;}
-.syntaxhighlighter.collapsed{overflow:visible !important;}
-.syntaxhighlighter.collapsed .toolbar{color:#ebdb8d !important;background:black !important;border:1px solid #990000 !important;}
-.syntaxhighlighter.collapsed .toolbar a{color:#ebdb8d !important;}
-.syntaxhighlighter.collapsed .toolbar a:hover{color:#ff7d27 !important;}
-.syntaxhighlighter .toolbar{color:white !important;background:#990000 !important;border:none !important;}
-.syntaxhighlighter .toolbar a{color:white !important;}
-.syntaxhighlighter .toolbar a:hover{color:#9ccff4 !important;}
-.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#d3d3d3 !important;}
-.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#ff7d27 !important;}
-.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#ff9e7b !important;}
-.syntaxhighlighter .keyword{color:aqua !important;}
-.syntaxhighlighter .preprocessor{color:#aec4de !important;}
-.syntaxhighlighter .variable{color:#ffaa3e !important;}
-.syntaxhighlighter .value{color:#009900 !important;}
-.syntaxhighlighter .functions{color:#81cef9 !important;}
-.syntaxhighlighter .constants{color:#ff9e7b !important;}
-.syntaxhighlighter .script{font-weight:bold !important;color:aqua !important;background-color:none !important;}
-.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#ebdb8d !important;}
-.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff7d27 !important;}
-.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#aec4de !important;}
+++ /dev/null
-.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
-.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
-.syntaxhighlighter.source{overflow:hidden !important;}
-.syntaxhighlighter .bold{font-weight:bold !important;}
-.syntaxhighlighter .italic{font-style:italic !important;}
-.syntaxhighlighter .line{white-space:pre !important;}
-.syntaxhighlighter table{width:100% !important;}
-.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
-.syntaxhighlighter table td.code{width:100% !important;}
-.syntaxhighlighter table td.code .container{position:relative !important;}
-.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
-.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
-.syntaxhighlighter table td.code .line{padding:0 1em !important;}
-.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
-.syntaxhighlighter.show{display:block !important;}
-.syntaxhighlighter.collapsed table{display:none !important;}
-.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
-.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
-.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
-.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
-.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
-.syntaxhighlighter .toolbar span.title{display:inline !important;}
-.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
-.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
-.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
-.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
-.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
-.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
-.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
-.syntaxhighlighter.printing .line .content{color:black !important;}
-.syntaxhighlighter.printing .toolbar{display:none !important;}
-.syntaxhighlighter.printing a{text-decoration:none !important;}
-.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
-.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
-.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
-.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
-.syntaxhighlighter.printing .preprocessor{color:gray !important;}
-.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
-.syntaxhighlighter.printing .value{color:#009900 !important;}
-.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
-.syntaxhighlighter.printing .constants{color:#0066cc !important;}
-.syntaxhighlighter.printing .script{font-weight:bold !important;}
-.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
-.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
-.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
-.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
-.syntaxhighlighter{background-color:#121212 !important;}
-.syntaxhighlighter .line.alt1{background-color:#121212 !important;}
-.syntaxhighlighter .line.alt2{background-color:#121212 !important;}
-.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#2c2c29 !important;}
-.syntaxhighlighter .line.highlighted.number{color:white !important;}
-.syntaxhighlighter table caption{color:white !important;}
-.syntaxhighlighter .gutter{color:#afafaf !important;}
-.syntaxhighlighter .gutter .line{border-right:3px solid #3185b9 !important;}
-.syntaxhighlighter .gutter .line.highlighted{background-color:#3185b9 !important;color:#121212 !important;}
-.syntaxhighlighter.printing .line .content{border:none !important;}
-.syntaxhighlighter.collapsed{overflow:visible !important;}
-.syntaxhighlighter.collapsed .toolbar{color:#3185b9 !important;background:black !important;border:1px solid #3185b9 !important;}
-.syntaxhighlighter.collapsed .toolbar a{color:#3185b9 !important;}
-.syntaxhighlighter.collapsed .toolbar a:hover{color:#d01d33 !important;}
-.syntaxhighlighter .toolbar{color:white !important;background:#3185b9 !important;border:none !important;}
-.syntaxhighlighter .toolbar a{color:white !important;}
-.syntaxhighlighter .toolbar a:hover{color:#96daff !important;}
-.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:white !important;}
-.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#696854 !important;}
-.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#e3e658 !important;}
-.syntaxhighlighter .keyword{color:#d01d33 !important;}
-.syntaxhighlighter .preprocessor{color:#435a5f !important;}
-.syntaxhighlighter .variable{color:#898989 !important;}
-.syntaxhighlighter .value{color:#009900 !important;}
-.syntaxhighlighter .functions{color:#aaaaaa !important;}
-.syntaxhighlighter .constants{color:#96daff !important;}
-.syntaxhighlighter .script{font-weight:bold !important;color:#d01d33 !important;background-color:none !important;}
-.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#ffc074 !important;}
-.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#4a8cdb !important;}
-.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#96daff !important;}
-.syntaxhighlighter .functions{font-weight:bold !important;}
+++ /dev/null
-.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
-.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
-.syntaxhighlighter.source{overflow:hidden !important;}
-.syntaxhighlighter .bold{font-weight:bold !important;}
-.syntaxhighlighter .italic{font-style:italic !important;}
-.syntaxhighlighter .line{white-space:pre !important;}
-.syntaxhighlighter table{width:100% !important;}
-.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
-.syntaxhighlighter table td.code{width:100% !important;}
-.syntaxhighlighter table td.code .container{position:relative !important;}
-.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
-.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
-.syntaxhighlighter table td.code .line{padding:0 1em !important;}
-.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
-.syntaxhighlighter.show{display:block !important;}
-.syntaxhighlighter.collapsed table{display:none !important;}
-.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
-.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
-.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
-.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
-.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
-.syntaxhighlighter .toolbar span.title{display:inline !important;}
-.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
-.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
-.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
-.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
-.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
-.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
-.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
-.syntaxhighlighter.printing .line .content{color:black !important;}
-.syntaxhighlighter.printing .toolbar{display:none !important;}
-.syntaxhighlighter.printing a{text-decoration:none !important;}
-.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
-.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
-.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
-.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
-.syntaxhighlighter.printing .preprocessor{color:gray !important;}
-.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
-.syntaxhighlighter.printing .value{color:#009900 !important;}
-.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
-.syntaxhighlighter.printing .constants{color:#0066cc !important;}
-.syntaxhighlighter.printing .script{font-weight:bold !important;}
-.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
-.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
-.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
-.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
-.syntaxhighlighter{background-color:#222222 !important;}
-.syntaxhighlighter .line.alt1{background-color:#222222 !important;}
-.syntaxhighlighter .line.alt2{background-color:#222222 !important;}
-.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#253e5a !important;}
-.syntaxhighlighter .line.highlighted.number{color:white !important;}
-.syntaxhighlighter table caption{color:lime !important;}
-.syntaxhighlighter .gutter{color:#38566f !important;}
-.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;}
-.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#222222 !important;}
-.syntaxhighlighter.printing .line .content{border:none !important;}
-.syntaxhighlighter.collapsed{overflow:visible !important;}
-.syntaxhighlighter.collapsed .toolbar{color:#428bdd !important;background:black !important;border:1px solid #435a5f !important;}
-.syntaxhighlighter.collapsed .toolbar a{color:#428bdd !important;}
-.syntaxhighlighter.collapsed .toolbar a:hover{color:lime !important;}
-.syntaxhighlighter .toolbar{color:#aaaaff !important;background:#435a5f !important;border:none !important;}
-.syntaxhighlighter .toolbar a{color:#aaaaff !important;}
-.syntaxhighlighter .toolbar a:hover{color:#9ccff4 !important;}
-.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:lime !important;}
-.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#428bdd !important;}
-.syntaxhighlighter .string,.syntaxhighlighter .string a{color:lime !important;}
-.syntaxhighlighter .keyword{color:#aaaaff !important;}
-.syntaxhighlighter .preprocessor{color:#8aa6c1 !important;}
-.syntaxhighlighter .variable{color:aqua !important;}
-.syntaxhighlighter .value{color:#f7e741 !important;}
-.syntaxhighlighter .functions{color:#ff8000 !important;}
-.syntaxhighlighter .constants{color:yellow !important;}
-.syntaxhighlighter .script{font-weight:bold !important;color:#aaaaff !important;background-color:none !important;}
-.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:red !important;}
-.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:yellow !important;}
-.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}
+++ /dev/null
-.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
-.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
-.syntaxhighlighter.source{overflow:hidden !important;}
-.syntaxhighlighter .bold{font-weight:bold !important;}
-.syntaxhighlighter .italic{font-style:italic !important;}
-.syntaxhighlighter .line{white-space:pre !important;}
-.syntaxhighlighter table{width:100% !important;}
-.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
-.syntaxhighlighter table td.code{width:100% !important;}
-.syntaxhighlighter table td.code .container{position:relative !important;}
-.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
-.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
-.syntaxhighlighter table td.code .line{padding:0 1em !important;}
-.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
-.syntaxhighlighter.show{display:block !important;}
-.syntaxhighlighter.collapsed table{display:none !important;}
-.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
-.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
-.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
-.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
-.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
-.syntaxhighlighter .toolbar span.title{display:inline !important;}
-.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
-.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
-.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
-.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
-.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
-.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
-.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
-.syntaxhighlighter.printing .line .content{color:black !important;}
-.syntaxhighlighter.printing .toolbar{display:none !important;}
-.syntaxhighlighter.printing a{text-decoration:none !important;}
-.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
-.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
-.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
-.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
-.syntaxhighlighter.printing .preprocessor{color:gray !important;}
-.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
-.syntaxhighlighter.printing .value{color:#009900 !important;}
-.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
-.syntaxhighlighter.printing .constants{color:#0066cc !important;}
-.syntaxhighlighter.printing .script{font-weight:bold !important;}
-.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
-.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
-.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
-.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
-.syntaxhighlighter{background-color:#0f192a !important;}
-.syntaxhighlighter .line.alt1{background-color:#0f192a !important;}
-.syntaxhighlighter .line.alt2{background-color:#0f192a !important;}
-.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#253e5a !important;}
-.syntaxhighlighter .line.highlighted.number{color:#38566f !important;}
-.syntaxhighlighter table caption{color:#d1edff !important;}
-.syntaxhighlighter .gutter{color:#afafaf !important;}
-.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;}
-.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#0f192a !important;}
-.syntaxhighlighter.printing .line .content{border:none !important;}
-.syntaxhighlighter.collapsed{overflow:visible !important;}
-.syntaxhighlighter.collapsed .toolbar{color:#428bdd !important;background:black !important;border:1px solid #435a5f !important;}
-.syntaxhighlighter.collapsed .toolbar a{color:#428bdd !important;}
-.syntaxhighlighter.collapsed .toolbar a:hover{color:#1dc116 !important;}
-.syntaxhighlighter .toolbar{color:#d1edff !important;background:#435a5f !important;border:none !important;}
-.syntaxhighlighter .toolbar a{color:#d1edff !important;}
-.syntaxhighlighter .toolbar a:hover{color:#8aa6c1 !important;}
-.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#d1edff !important;}
-.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#428bdd !important;}
-.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#1dc116 !important;}
-.syntaxhighlighter .keyword{color:#b43d3d !important;}
-.syntaxhighlighter .preprocessor{color:#8aa6c1 !important;}
-.syntaxhighlighter .variable{color:#ffaa3e !important;}
-.syntaxhighlighter .value{color:#f7e741 !important;}
-.syntaxhighlighter .functions{color:#ffaa3e !important;}
-.syntaxhighlighter .constants{color:#e0e8ff !important;}
-.syntaxhighlighter .script{font-weight:bold !important;color:#b43d3d !important;background-color:none !important;}
-.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#f8bb00 !important;}
-.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:white !important;}
-.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}
+++ /dev/null
-.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
-.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
-.syntaxhighlighter.source{overflow:hidden !important;}
-.syntaxhighlighter .bold{font-weight:bold !important;}
-.syntaxhighlighter .italic{font-style:italic !important;}
-.syntaxhighlighter .line{white-space:pre !important;}
-.syntaxhighlighter table{width:100% !important;}
-.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
-.syntaxhighlighter table td.code{width:100% !important;}
-.syntaxhighlighter table td.code .container{position:relative !important;}
-.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
-.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
-.syntaxhighlighter table td.code .line{padding:0 1em !important;}
-.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
-.syntaxhighlighter.show{display:block !important;}
-.syntaxhighlighter.collapsed table{display:none !important;}
-.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
-.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
-.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
-.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
-.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
-.syntaxhighlighter .toolbar span.title{display:inline !important;}
-.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
-.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
-.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
-.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
-.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
-.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
-.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
-.syntaxhighlighter.printing .line .content{color:black !important;}
-.syntaxhighlighter.printing .toolbar{display:none !important;}
-.syntaxhighlighter.printing a{text-decoration:none !important;}
-.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
-.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
-.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
-.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
-.syntaxhighlighter.printing .preprocessor{color:gray !important;}
-.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
-.syntaxhighlighter.printing .value{color:#009900 !important;}
-.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
-.syntaxhighlighter.printing .constants{color:#0066cc !important;}
-.syntaxhighlighter.printing .script{font-weight:bold !important;}
-.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
-.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
-.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
-.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
-.syntaxhighlighter{background-color:#1b2426 !important;}
-.syntaxhighlighter .line.alt1{background-color:#1b2426 !important;}
-.syntaxhighlighter .line.alt2{background-color:#1b2426 !important;}
-.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#323e41 !important;}
-.syntaxhighlighter .line.highlighted.number{color:#b9bdb6 !important;}
-.syntaxhighlighter table caption{color:#b9bdb6 !important;}
-.syntaxhighlighter .gutter{color:#afafaf !important;}
-.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;}
-.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#1b2426 !important;}
-.syntaxhighlighter.printing .line .content{border:none !important;}
-.syntaxhighlighter.collapsed{overflow:visible !important;}
-.syntaxhighlighter.collapsed .toolbar{color:#5ba1cf !important;background:black !important;border:1px solid #435a5f !important;}
-.syntaxhighlighter.collapsed .toolbar a{color:#5ba1cf !important;}
-.syntaxhighlighter.collapsed .toolbar a:hover{color:#5ce638 !important;}
-.syntaxhighlighter .toolbar{color:white !important;background:#435a5f !important;border:none !important;}
-.syntaxhighlighter .toolbar a{color:white !important;}
-.syntaxhighlighter .toolbar a:hover{color:#e0e8ff !important;}
-.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#b9bdb6 !important;}
-.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#878a85 !important;}
-.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#5ce638 !important;}
-.syntaxhighlighter .keyword{color:#5ba1cf !important;}
-.syntaxhighlighter .preprocessor{color:#435a5f !important;}
-.syntaxhighlighter .variable{color:#ffaa3e !important;}
-.syntaxhighlighter .value{color:#009900 !important;}
-.syntaxhighlighter .functions{color:#ffaa3e !important;}
-.syntaxhighlighter .constants{color:#e0e8ff !important;}
-.syntaxhighlighter .script{font-weight:bold !important;color:#5ba1cf !important;background-color:none !important;}
-.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#e0e8ff !important;}
-.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:white !important;}
-.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}
+++ /dev/null
-.syntaxhighlighter.applescript{background:white;font-size:1em;color:black;}
-.syntaxhighlighter.applescript div,.syntaxhighlighter.applescript code{font:1em/1.25 Verdana,sans-serif !important;}
-.syntaxhighlighter.applescript .code .line{overflow:hidden !important;}
-.syntaxhighlighter.applescript .code .line.highlighted{background:#b5d5ff !important;}
-.syntaxhighlighter.applescript .color1{color:#000000 !important;}
-.syntaxhighlighter.applescript .color2{color:#000000 !important;}
-.syntaxhighlighter.applescript .color3{color:#000000 !important;font-weight:bold !important;}
-.syntaxhighlighter.applescript .keyword{color:#000000 !important;font-weight:bold !important;}
-.syntaxhighlighter.applescript .color4{color:#0000ff !important;font-style:italic !important;}
-.syntaxhighlighter.applescript .comments{color:#4c4d4d !important;}
-.syntaxhighlighter.applescript .plain{color:#408000 !important;}
-.syntaxhighlighter.applescript .string{color:#000000 !important;}
-.syntaxhighlighter.applescript .commandNames{color:#0000ff !important;font-weight:bold !important;}
-.syntaxhighlighter.applescript .parameterNames{color:#0000ff !important;}
-.syntaxhighlighter.applescript .classes{color:#0000ff !important;font-style:italic !important;}
-.syntaxhighlighter.applescript .properties{color:#6c04d4 !important;}
-.syntaxhighlighter.applescript .enumeratedValues{color:#4a1e7f !important;}
-.syntaxhighlighter.applescript .additionCommandNames{color:#0016b0 !important;font-weight:bold !important;}
-.syntaxhighlighter.applescript .additionParameterNames{color:#0016b0 !important;}
-.syntaxhighlighter.applescript .additionClasses{color:#0016b0 !important;font-style:italic !important;}
-.syntaxhighlighter.applescript .spaces{display:inline-block;height:0 !important;font-size:1.75em !important;line-height:0 !important;}
+++ /dev/null
-.syntaxhighlighter{background-color:white !important;}
-.syntaxhighlighter .line.alt1{background-color:white !important;}
-.syntaxhighlighter .line.alt2{background-color:white !important;}
-.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#e0e0e0 !important;}
-.syntaxhighlighter .line.highlighted.number{color:black !important;}
-.syntaxhighlighter table caption{color:black !important;}
-.syntaxhighlighter .gutter{color:#afafaf !important;}
-.syntaxhighlighter .gutter .line{border-right:3px solid #6ce26c !important;}
-.syntaxhighlighter .gutter .line.highlighted{background-color:#6ce26c !important;color:white !important;}
-.syntaxhighlighter.printing .line .content{border:none !important;}
-.syntaxhighlighter.collapsed{overflow:visible !important;}
-.syntaxhighlighter.collapsed .toolbar{color:blue !important;background:white !important;border:1px solid #6ce26c !important;}
-.syntaxhighlighter.collapsed .toolbar a{color:blue !important;}
-.syntaxhighlighter.collapsed .toolbar a:hover{color:red !important;}
-.syntaxhighlighter .toolbar{color:white !important;background:#6ce26c !important;border:none !important;}
-.syntaxhighlighter .toolbar a{color:white !important;}
-.syntaxhighlighter .toolbar a:hover{color:black !important;}
-.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;}
-.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#008200 !important;}
-.syntaxhighlighter .string,.syntaxhighlighter .string a{color:blue !important;}
-.syntaxhighlighter .keyword{color:#006699 !important;}
-.syntaxhighlighter .preprocessor{color:gray !important;}
-.syntaxhighlighter .variable{color:#aa7700 !important;}
-.syntaxhighlighter .value{color:#009900 !important;}
-.syntaxhighlighter .functions{color:#ff1493 !important;}
-.syntaxhighlighter .constants{color:#0066cc !important;}
-.syntaxhighlighter .script{font-weight:bold !important;color:#006699 !important;background-color:none !important;}
-.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;}
-.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;}
-.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;}
-.syntaxhighlighter .keyword{font-weight:bold !important;}
+++ /dev/null
-.syntaxhighlighter{background-color:#0a2b1d !important;}
-.syntaxhighlighter .line.alt1{background-color:#0a2b1d !important;}
-.syntaxhighlighter .line.alt2{background-color:#0a2b1d !important;}
-.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#233729 !important;}
-.syntaxhighlighter .line.highlighted.number{color:white !important;}
-.syntaxhighlighter table caption{color:#f8f8f8 !important;}
-.syntaxhighlighter .gutter{color:#497958 !important;}
-.syntaxhighlighter .gutter .line{border-right:3px solid #41a83e !important;}
-.syntaxhighlighter .gutter .line.highlighted{background-color:#41a83e !important;color:#0a2b1d !important;}
-.syntaxhighlighter.printing .line .content{border:none !important;}
-.syntaxhighlighter.collapsed{overflow:visible !important;}
-.syntaxhighlighter.collapsed .toolbar{color:#96dd3b !important;background:black !important;border:1px solid #41a83e !important;}
-.syntaxhighlighter.collapsed .toolbar a{color:#96dd3b !important;}
-.syntaxhighlighter.collapsed .toolbar a:hover{color:white !important;}
-.syntaxhighlighter .toolbar{color:white !important;background:#41a83e !important;border:none !important;}
-.syntaxhighlighter .toolbar a{color:white !important;}
-.syntaxhighlighter .toolbar a:hover{color:#ffe862 !important;}
-.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#f8f8f8 !important;}
-.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#336442 !important;}
-.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#9df39f !important;}
-.syntaxhighlighter .keyword{color:#96dd3b !important;}
-.syntaxhighlighter .preprocessor{color:#91bb9e !important;}
-.syntaxhighlighter .variable{color:#ffaa3e !important;}
-.syntaxhighlighter .value{color:#f7e741 !important;}
-.syntaxhighlighter .functions{color:#ffaa3e !important;}
-.syntaxhighlighter .constants{color:#e0e8ff !important;}
-.syntaxhighlighter .script{font-weight:bold !important;color:#96dd3b !important;background-color:none !important;}
-.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#eb939a !important;}
-.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#91bb9e !important;}
-.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#edef7d !important;}
-.syntaxhighlighter .comments{font-style:italic !important;}
-.syntaxhighlighter .keyword{font-weight:bold !important;}
+++ /dev/null
-.syntaxhighlighter{background-color:white !important;}
-.syntaxhighlighter .line.alt1{background-color:white !important;}
-.syntaxhighlighter .line.alt2{background-color:white !important;}
-.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#c3defe !important;}
-.syntaxhighlighter .line.highlighted.number{color:white !important;}
-.syntaxhighlighter table caption{color:black !important;}
-.syntaxhighlighter .gutter{color:#787878 !important;}
-.syntaxhighlighter .gutter .line{border-right:3px solid #d4d0c8 !important;}
-.syntaxhighlighter .gutter .line.highlighted{background-color:#d4d0c8 !important;color:white !important;}
-.syntaxhighlighter.printing .line .content{border:none !important;}
-.syntaxhighlighter.collapsed{overflow:visible !important;}
-.syntaxhighlighter.collapsed .toolbar{color:#3f5fbf !important;background:white !important;border:1px solid #d4d0c8 !important;}
-.syntaxhighlighter.collapsed .toolbar a{color:#3f5fbf !important;}
-.syntaxhighlighter.collapsed .toolbar a:hover{color:#aa7700 !important;}
-.syntaxhighlighter .toolbar{color:#a0a0a0 !important;background:#d4d0c8 !important;border:none !important;}
-.syntaxhighlighter .toolbar a{color:#a0a0a0 !important;}
-.syntaxhighlighter .toolbar a:hover{color:red !important;}
-.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;}
-.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#3f5fbf !important;}
-.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#2a00ff !important;}
-.syntaxhighlighter .keyword{color:#7f0055 !important;}
-.syntaxhighlighter .preprocessor{color:#646464 !important;}
-.syntaxhighlighter .variable{color:#aa7700 !important;}
-.syntaxhighlighter .value{color:#009900 !important;}
-.syntaxhighlighter .functions{color:#ff1493 !important;}
-.syntaxhighlighter .constants{color:#0066cc !important;}
-.syntaxhighlighter .script{font-weight:bold !important;color:#7f0055 !important;background-color:none !important;}
-.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;}
-.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;}
-.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;}
-.syntaxhighlighter .keyword{font-weight:bold !important;}
-.syntaxhighlighter .xml .keyword{color:#3f7f7f !important;font-weight:normal !important;}
-.syntaxhighlighter .xml .color1,.syntaxhighlighter .xml .color1 a{color:#7f007f !important;}
-.syntaxhighlighter .xml .string{font-style:italic !important;color:#2a00ff !important;}
+++ /dev/null
-.syntaxhighlighter{background-color:black !important;}
-.syntaxhighlighter .line.alt1{background-color:black !important;}
-.syntaxhighlighter .line.alt2{background-color:black !important;}
-.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#2a3133 !important;}
-.syntaxhighlighter .line.highlighted.number{color:white !important;}
-.syntaxhighlighter table caption{color:#d3d3d3 !important;}
-.syntaxhighlighter .gutter{color:#d3d3d3 !important;}
-.syntaxhighlighter .gutter .line{border-right:3px solid #990000 !important;}
-.syntaxhighlighter .gutter .line.highlighted{background-color:#990000 !important;color:black !important;}
-.syntaxhighlighter.printing .line .content{border:none !important;}
-.syntaxhighlighter.collapsed{overflow:visible !important;}
-.syntaxhighlighter.collapsed .toolbar{color:#ebdb8d !important;background:black !important;border:1px solid #990000 !important;}
-.syntaxhighlighter.collapsed .toolbar a{color:#ebdb8d !important;}
-.syntaxhighlighter.collapsed .toolbar a:hover{color:#ff7d27 !important;}
-.syntaxhighlighter .toolbar{color:white !important;background:#990000 !important;border:none !important;}
-.syntaxhighlighter .toolbar a{color:white !important;}
-.syntaxhighlighter .toolbar a:hover{color:#9ccff4 !important;}
-.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#d3d3d3 !important;}
-.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#ff7d27 !important;}
-.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#ff9e7b !important;}
-.syntaxhighlighter .keyword{color:aqua !important;}
-.syntaxhighlighter .preprocessor{color:#aec4de !important;}
-.syntaxhighlighter .variable{color:#ffaa3e !important;}
-.syntaxhighlighter .value{color:#009900 !important;}
-.syntaxhighlighter .functions{color:#81cef9 !important;}
-.syntaxhighlighter .constants{color:#ff9e7b !important;}
-.syntaxhighlighter .script{font-weight:bold !important;color:aqua !important;background-color:none !important;}
-.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#ebdb8d !important;}
-.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff7d27 !important;}
-.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#aec4de !important;}
+++ /dev/null
-.syntaxhighlighter{background-color:#121212 !important;}
-.syntaxhighlighter .line.alt1{background-color:#121212 !important;}
-.syntaxhighlighter .line.alt2{background-color:#121212 !important;}
-.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#2c2c29 !important;}
-.syntaxhighlighter .line.highlighted.number{color:white !important;}
-.syntaxhighlighter table caption{color:white !important;}
-.syntaxhighlighter .gutter{color:#afafaf !important;}
-.syntaxhighlighter .gutter .line{border-right:3px solid #3185b9 !important;}
-.syntaxhighlighter .gutter .line.highlighted{background-color:#3185b9 !important;color:#121212 !important;}
-.syntaxhighlighter.printing .line .content{border:none !important;}
-.syntaxhighlighter.collapsed{overflow:visible !important;}
-.syntaxhighlighter.collapsed .toolbar{color:#3185b9 !important;background:black !important;border:1px solid #3185b9 !important;}
-.syntaxhighlighter.collapsed .toolbar a{color:#3185b9 !important;}
-.syntaxhighlighter.collapsed .toolbar a:hover{color:#d01d33 !important;}
-.syntaxhighlighter .toolbar{color:white !important;background:#3185b9 !important;border:none !important;}
-.syntaxhighlighter .toolbar a{color:white !important;}
-.syntaxhighlighter .toolbar a:hover{color:#96daff !important;}
-.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:white !important;}
-.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#696854 !important;}
-.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#e3e658 !important;}
-.syntaxhighlighter .keyword{color:#d01d33 !important;}
-.syntaxhighlighter .preprocessor{color:#435a5f !important;}
-.syntaxhighlighter .variable{color:#898989 !important;}
-.syntaxhighlighter .value{color:#009900 !important;}
-.syntaxhighlighter .functions{color:#aaaaaa !important;}
-.syntaxhighlighter .constants{color:#96daff !important;}
-.syntaxhighlighter .script{font-weight:bold !important;color:#d01d33 !important;background-color:none !important;}
-.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#ffc074 !important;}
-.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#4a8cdb !important;}
-.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#96daff !important;}
-.syntaxhighlighter .functions{font-weight:bold !important;}
+++ /dev/null
-.syntaxhighlighter{background-color:#222222 !important;}
-.syntaxhighlighter .line.alt1{background-color:#222222 !important;}
-.syntaxhighlighter .line.alt2{background-color:#222222 !important;}
-.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#253e5a !important;}
-.syntaxhighlighter .line.highlighted.number{color:white !important;}
-.syntaxhighlighter table caption{color:lime !important;}
-.syntaxhighlighter .gutter{color:#38566f !important;}
-.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;}
-.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#222222 !important;}
-.syntaxhighlighter.printing .line .content{border:none !important;}
-.syntaxhighlighter.collapsed{overflow:visible !important;}
-.syntaxhighlighter.collapsed .toolbar{color:#428bdd !important;background:black !important;border:1px solid #435a5f !important;}
-.syntaxhighlighter.collapsed .toolbar a{color:#428bdd !important;}
-.syntaxhighlighter.collapsed .toolbar a:hover{color:lime !important;}
-.syntaxhighlighter .toolbar{color:#aaaaff !important;background:#435a5f !important;border:none !important;}
-.syntaxhighlighter .toolbar a{color:#aaaaff !important;}
-.syntaxhighlighter .toolbar a:hover{color:#9ccff4 !important;}
-.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:lime !important;}
-.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#428bdd !important;}
-.syntaxhighlighter .string,.syntaxhighlighter .string a{color:lime !important;}
-.syntaxhighlighter .keyword{color:#aaaaff !important;}
-.syntaxhighlighter .preprocessor{color:#8aa6c1 !important;}
-.syntaxhighlighter .variable{color:aqua !important;}
-.syntaxhighlighter .value{color:#f7e741 !important;}
-.syntaxhighlighter .functions{color:#ff8000 !important;}
-.syntaxhighlighter .constants{color:yellow !important;}
-.syntaxhighlighter .script{font-weight:bold !important;color:#aaaaff !important;background-color:none !important;}
-.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:red !important;}
-.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:yellow !important;}
-.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}
+++ /dev/null
-.syntaxhighlighter{background-color:#0f192a !important;}
-.syntaxhighlighter .line.alt1{background-color:#0f192a !important;}
-.syntaxhighlighter .line.alt2{background-color:#0f192a !important;}
-.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#253e5a !important;}
-.syntaxhighlighter .line.highlighted.number{color:#38566f !important;}
-.syntaxhighlighter table caption{color:#d1edff !important;}
-.syntaxhighlighter .gutter{color:#afafaf !important;}
-.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;}
-.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#0f192a !important;}
-.syntaxhighlighter.printing .line .content{border:none !important;}
-.syntaxhighlighter.collapsed{overflow:visible !important;}
-.syntaxhighlighter.collapsed .toolbar{color:#428bdd !important;background:black !important;border:1px solid #435a5f !important;}
-.syntaxhighlighter.collapsed .toolbar a{color:#428bdd !important;}
-.syntaxhighlighter.collapsed .toolbar a:hover{color:#1dc116 !important;}
-.syntaxhighlighter .toolbar{color:#d1edff !important;background:#435a5f !important;border:none !important;}
-.syntaxhighlighter .toolbar a{color:#d1edff !important;}
-.syntaxhighlighter .toolbar a:hover{color:#8aa6c1 !important;}
-.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#d1edff !important;}
-.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#428bdd !important;}
-.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#1dc116 !important;}
-.syntaxhighlighter .keyword{color:#b43d3d !important;}
-.syntaxhighlighter .preprocessor{color:#8aa6c1 !important;}
-.syntaxhighlighter .variable{color:#ffaa3e !important;}
-.syntaxhighlighter .value{color:#f7e741 !important;}
-.syntaxhighlighter .functions{color:#ffaa3e !important;}
-.syntaxhighlighter .constants{color:#e0e8ff !important;}
-.syntaxhighlighter .script{font-weight:bold !important;color:#b43d3d !important;background-color:none !important;}
-.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#f8bb00 !important;}
-.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:white !important;}
-.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}
+++ /dev/null
-.syntaxhighlighter{background-color:#1b2426 !important;}
-.syntaxhighlighter .line.alt1{background-color:#1b2426 !important;}
-.syntaxhighlighter .line.alt2{background-color:#1b2426 !important;}
-.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#323e41 !important;}
-.syntaxhighlighter .line.highlighted.number{color:#b9bdb6 !important;}
-.syntaxhighlighter table caption{color:#b9bdb6 !important;}
-.syntaxhighlighter .gutter{color:#afafaf !important;}
-.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;}
-.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#1b2426 !important;}
-.syntaxhighlighter.printing .line .content{border:none !important;}
-.syntaxhighlighter.collapsed{overflow:visible !important;}
-.syntaxhighlighter.collapsed .toolbar{color:#5ba1cf !important;background:black !important;border:1px solid #435a5f !important;}
-.syntaxhighlighter.collapsed .toolbar a{color:#5ba1cf !important;}
-.syntaxhighlighter.collapsed .toolbar a:hover{color:#5ce638 !important;}
-.syntaxhighlighter .toolbar{color:white !important;background:#435a5f !important;border:none !important;}
-.syntaxhighlighter .toolbar a{color:white !important;}
-.syntaxhighlighter .toolbar a:hover{color:#e0e8ff !important;}
-.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#b9bdb6 !important;}
-.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#878a85 !important;}
-.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#5ce638 !important;}
-.syntaxhighlighter .keyword{color:#5ba1cf !important;}
-.syntaxhighlighter .preprocessor{color:#435a5f !important;}
-.syntaxhighlighter .variable{color:#ffaa3e !important;}
-.syntaxhighlighter .value{color:#009900 !important;}
-.syntaxhighlighter .functions{color:#ffaa3e !important;}
-.syntaxhighlighter .constants{color:#e0e8ff !important;}
-.syntaxhighlighter .script{font-weight:bold !important;color:#5ba1cf !important;background-color:none !important;}
-.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#e0e8ff !important;}
-.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:white !important;}
-.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}
+++ /dev/null
-.syntaxhighlighter{background-color:white !important;}
-.syntaxhighlighter .line.alt1{background-color:white !important;}
-.syntaxhighlighter .line.alt2{background-color:white !important;}
-.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#e0e0e0 !important;}
-.syntaxhighlighter .line.highlighted.number{color:black !important;}
-.syntaxhighlighter table caption{color:black !important;}
-.syntaxhighlighter .gutter{color:#afafaf !important;}
-.syntaxhighlighter .gutter .line{border-right:3px solid #6ce26c !important;}
-.syntaxhighlighter .gutter .line.highlighted{background-color:#6ce26c !important;color:white !important;}
-.syntaxhighlighter.printing .line .content{border:none !important;}
-.syntaxhighlighter.collapsed{overflow:visible !important;}
-.syntaxhighlighter.collapsed .toolbar{color:blue !important;background:white !important;border:1px solid #6ce26c !important;}
-.syntaxhighlighter.collapsed .toolbar a{color:blue !important;}
-.syntaxhighlighter.collapsed .toolbar a:hover{color:red !important;}
-.syntaxhighlighter .toolbar{color:white !important;background:#6ce26c !important;border:none !important;}
-.syntaxhighlighter .toolbar a{color:white !important;}
-.syntaxhighlighter .toolbar a:hover{color:black !important;}
-.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;}
-.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#008200 !important;}
-.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#d11010 !important;}
-.syntaxhighlighter .keyword{color:#006699 !important;}
-.syntaxhighlighter .preprocessor{color:gray !important;}
-.syntaxhighlighter .variable{color:#aa7700 !important;}
-.syntaxhighlighter .value{color:#009900 !important;}
-.syntaxhighlighter .functions{color:#ff1493 !important;}
-.syntaxhighlighter .constants{color:#0066cc !important;}
-.syntaxhighlighter .script{font-weight:bold !important;color:#006699 !important;background-color:none !important;}
-.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;}
-.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;}
-.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;}
-.syntaxhighlighter .keyword{font-weight:bold !important;}
+++ /dev/null
-<?php
-/**
- * EasyPeasyICS Simple ICS/vCal data generator.
- * @author Marcus Bointon <phpmailer@synchromedia.co.uk>
- * @author Manuel Reinhard <manu@sprain.ch>
- *
- * Built with inspiration from
- * http://stackoverflow.com/questions/1463480/how-can-i-use-php-to-dynamically-publish-an-ical-file-to-be-read-by-google-calend/1464355#1464355
- * History:
- * 2010/12/17 - Manuel Reinhard - when it all started
- * 2014 PHPMailer project becomes maintainer
- */
-
-/**
- * Class EasyPeasyICS.
- * Simple ICS data generator
- * @package phpmailer
- * @subpackage easypeasyics
- */
-class EasyPeasyICS
-{
- /**
- * The name of the calendar
- * @var string
- */
- protected $calendarName;
- /**
- * The array of events to add to this calendar
- * @var array
- */
- protected $events = array();
-
- /**
- * Constructor
- * @param string $calendarName
- */
- public function __construct($calendarName = "")
- {
- $this->calendarName = $calendarName;
- }
-
- /**
- * Add an event to this calendar.
- * @param string $start The start date and time as a unix timestamp
- * @param string $end The end date and time as a unix timestamp
- * @param string $summary A summary or title for the event
- * @param string $description A description of the event
- * @param string $url A URL for the event
- * @param string $uid A unique identifier for the event - generated automatically if not provided
- * @return array An array of event details, including any generated UID
- */
- public function addEvent($start, $end, $summary = '', $description = '', $url = '', $uid = '')
- {
- if (empty($uid)) {
- $uid = md5(uniqid(mt_rand(), true)) . '@EasyPeasyICS';
- }
- $event = array(
- 'start' => gmdate('Ymd', $start) . 'T' . gmdate('His', $start) . 'Z',
- 'end' => gmdate('Ymd', $end) . 'T' . gmdate('His', $end) . 'Z',
- 'summary' => $summary,
- 'description' => $description,
- 'url' => $url,
- 'uid' => $uid
- );
- $this->events[] = $event;
- return $event;
- }
-
- /**
- * @return array Get the array of events.
- */
- public function getEvents()
- {
- return $this->events;
- }
-
- /**
- * Clear all events.
- */
- public function clearEvents()
- {
- $this->events = array();
- }
-
- /**
- * Get the name of the calendar.
- * @return string
- */
- public function getName()
- {
- return $this->calendarName;
- }
-
- /**
- * Set the name of the calendar.
- * @param $name
- */
- public function setName($name)
- {
- $this->calendarName = $name;
- }
-
- /**
- * Render and optionally output a vcal string.
- * @param bool $output Whether to output the calendar data directly (the default).
- * @return string The complete rendered vlal
- */
- public function render($output = true)
- {
- //Add header
- $ics = 'BEGIN:VCALENDAR
-METHOD:PUBLISH
-VERSION:2.0
-X-WR-CALNAME:' . $this->calendarName . '
-PRODID:-//hacksw/handcal//NONSGML v1.0//EN';
-
- //Add events
- foreach ($this->events as $event) {
- $ics .= '
-BEGIN:VEVENT
-UID:' . $event['uid'] . '
-DTSTAMP:' . gmdate('Ymd') . 'T' . gmdate('His') . 'Z
-DTSTART:' . $event['start'] . '
-DTEND:' . $event['end'] . '
-SUMMARY:' . str_replace("\n", "\\n", $event['summary']) . '
-DESCRIPTION:' . str_replace("\n", "\\n", $event['description']) . '
-URL;VALUE=URI:' . $event['url'] . '
-END:VEVENT';
- }
-
- //Add footer
- $ics .= '
-END:VCALENDAR';
-
- if ($output) {
- //Output
- $filename = $this->calendarName;
- //Filename needs quoting if it contains spaces
- if (strpos($filename, ' ') !== false) {
- $filename = '"'.$filename.'"';
- }
- header('Content-type: text/calendar; charset=utf-8');
- header('Content-Disposition: inline; filename=' . $filename . '.ics');
- echo $ics;
- }
- return $ics;
- }
-}
+++ /dev/null
-#PHPMailer Extras
-
-These classes provide optional additional functions to PHPMailer.
-
-These are not loaded by the PHPMailer autoloader, so in some cases you may need to `require` them yourself before using them.
-
-##EasyPeasyICS
-
-This class was originally written by Manuel Reinhard and provides a simple means of generating ICS/vCal files that are used in sending calendar events. PHPMailer does not use it directly, but you can use it to generate content appropriate for placing in the `Ical` property of PHPMailer. The PHPMailer project is now its official home as Manuel has given permission for that and is no longer maintaining it himself.
-
-##htmlfilter
-
-This class by Konstantin Riabitsev and Jim Jagielski implements HTML filtering to remove potentially malicious tags, such as `<script>` or `onclick=` attributes that can result in XSS attacks. This is a simple filter and is not as comprehensive as [HTMLawed](http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/) or [HTMLPurifier](http://htmlpurifier.org), but it's easier to use and considerably better than nothing! PHPMailer does not use it directly, but you may want to apply it to user-supplied HTML before using it as a message body.
-
-##NTLM_SASL_client
-
-This class by Manuel Lemos (bundled with permission) adds the ability to authenticate with Microsoft Windows mail servers that use NTLM-based authentication. It is used by PHPMailer if you send via SMTP and set the `AuthType` property to `NTLM`; you will also need to use the `Realm` and `Workstation` properties. The original source is [here](http://www.phpclasses.org/browse/file/7495.html).
+++ /dev/null
-<?php
-/**
- * htmlfilter.inc
- * ---------------
- * This set of functions allows you to filter html in order to remove
- * any malicious tags from it. Useful in cases when you need to filter
- * user input for any cross-site-scripting attempts.
- *
- * Copyright (C) 2002-2004 by Duke University
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- * @Author Konstantin Riabitsev <icon@linux.duke.edu>
- * @Author Jim Jagielski <jim@jaguNET.com / jimjag@gmail.com>
- * @Version 1.1 ($Date$)
- */
-
-/**
- * This function returns the final tag out of the tag name, an array
- * of attributes, and the type of the tag. This function is called by
- * tln_sanitize internally.
- *
- * @param string $tagname the name of the tag.
- * @param array $attary the array of attributes and their values
- * @param integer $tagtype The type of the tag (see in comments).
- * @return string A string with the final tag representation.
- */
-function tln_tagprint($tagname, $attary, $tagtype)
-{
- if ($tagtype == 2) {
- $fulltag = '</' . $tagname . '>';
- } else {
- $fulltag = '<' . $tagname;
- if (is_array($attary) && sizeof($attary)) {
- $atts = array();
- while (list($attname, $attvalue) = each($attary)) {
- array_push($atts, "$attname=$attvalue");
- }
- $fulltag .= ' ' . join(' ', $atts);
- }
- if ($tagtype == 3) {
- $fulltag .= ' /';
- }
- $fulltag .= '>';
- }
- return $fulltag;
-}
-
-/**
- * A small helper function to use with array_walk. Modifies a by-ref
- * value and makes it lowercase.
- *
- * @param string $val a value passed by-ref.
- * @return void since it modifies a by-ref value.
- */
-function tln_casenormalize(&$val)
-{
- $val = strtolower($val);
-}
-
-/**
- * This function skips any whitespace from the current position within
- * a string and to the next non-whitespace value.
- *
- * @param string $body the string
- * @param integer $offset the offset within the string where we should start
- * looking for the next non-whitespace character.
- * @return integer the location within the $body where the next
- * non-whitespace char is located.
- */
-function tln_skipspace($body, $offset)
-{
- preg_match('/^(\s*)/s', substr($body, $offset), $matches);
- if (sizeof($matches[1])) {
- $count = strlen($matches[1]);
- $offset += $count;
- }
- return $offset;
-}
-
-/**
- * This function looks for the next character within a string. It's
- * really just a glorified "strpos", except it catches the failures
- * nicely.
- *
- * @param string $body The string to look for needle in.
- * @param integer $offset Start looking from this position.
- * @param string $needle The character/string to look for.
- * @return integer location of the next occurrence of the needle, or
- * strlen($body) if needle wasn't found.
- */
-function tln_findnxstr($body, $offset, $needle)
-{
- $pos = strpos($body, $needle, $offset);
- if ($pos === false) {
- $pos = strlen($body);
- }
- return $pos;
-}
-
-/**
- * This function takes a PCRE-style regexp and tries to match it
- * within the string.
- *
- * @param string $body The string to look for needle in.
- * @param integer $offset Start looking from here.
- * @param string $reg A PCRE-style regex to match.
- * @return array|boolean Returns a false if no matches found, or an array
- * with the following members:
- * - integer with the location of the match within $body
- * - string with whatever content between offset and the match
- * - string with whatever it is we matched
- */
-function tln_findnxreg($body, $offset, $reg)
-{
- $matches = array();
- $retarr = array();
- $preg_rule = '%^(.*?)(' . $reg . ')%s';
- preg_match($preg_rule, substr($body, $offset), $matches);
- if (!isset($matches[0]) || !$matches[0]) {
- $retarr = false;
- } else {
- $retarr[0] = $offset + strlen($matches[1]);
- $retarr[1] = $matches[1];
- $retarr[2] = $matches[2];
- }
- return $retarr;
-}
-
-/**
- * This function looks for the next tag.
- *
- * @param string $body String where to look for the next tag.
- * @param integer $offset Start looking from here.
- * @return array|boolean false if no more tags exist in the body, or
- * an array with the following members:
- * - string with the name of the tag
- * - array with attributes and their values
- * - integer with tag type (1, 2, or 3)
- * - integer where the tag starts (starting "<")
- * - integer where the tag ends (ending ">")
- * first three members will be false, if the tag is invalid.
- */
-function tln_getnxtag($body, $offset)
-{
- if ($offset > strlen($body)) {
- return false;
- }
- $lt = tln_findnxstr($body, $offset, '<');
- if ($lt == strlen($body)) {
- return false;
- }
- /**
- * We are here:
- * blah blah <tag attribute="value">
- * \---------^
- */
- $pos = tln_skipspace($body, $lt + 1);
- if ($pos >= strlen($body)) {
- return array(false, false, false, $lt, strlen($body));
- }
- /**
- * There are 3 kinds of tags:
- * 1. Opening tag, e.g.:
- * <a href="blah">
- * 2. Closing tag, e.g.:
- * </a>
- * 3. XHTML-style content-less tag, e.g.:
- * <img src="blah"/>
- */
- switch (substr($body, $pos, 1)) {
- case '/':
- $tagtype = 2;
- $pos++;
- break;
- case '!':
- /**
- * A comment or an SGML declaration.
- */
- if (substr($body, $pos + 1, 2) == '--') {
- $gt = strpos($body, '-->', $pos);
- if ($gt === false) {
- $gt = strlen($body);
- } else {
- $gt += 2;
- }
- return array(false, false, false, $lt, $gt);
- } else {
- $gt = tln_findnxstr($body, $pos, '>');
- return array(false, false, false, $lt, $gt);
- }
- break;
- default:
- /**
- * Assume tagtype 1 for now. If it's type 3, we'll switch values
- * later.
- */
- $tagtype = 1;
- break;
- }
-
- /**
- * Look for next [\W-_], which will indicate the end of the tag name.
- */
- $regary = tln_findnxreg($body, $pos, '[^\w\-_]');
- if ($regary == false) {
- return array(false, false, false, $lt, strlen($body));
- }
- list($pos, $tagname, $match) = $regary;
- $tagname = strtolower($tagname);
-
- /**
- * $match can be either of these:
- * '>' indicating the end of the tag entirely.
- * '\s' indicating the end of the tag name.
- * '/' indicating that this is type-3 xhtml tag.
- *
- * Whatever else we find there indicates an invalid tag.
- */
- switch ($match) {
- case '/':
- /**
- * This is an xhtml-style tag with a closing / at the
- * end, like so: <img src="blah"/>. Check if it's followed
- * by the closing bracket. If not, then this tag is invalid
- */
- if (substr($body, $pos, 2) == '/>') {
- $pos++;
- $tagtype = 3;
- } else {
- $gt = tln_findnxstr($body, $pos, '>');
- $retary = array(false, false, false, $lt, $gt);
- return $retary;
- }
- //intentional fall-through
- case '>':
- return array($tagname, false, $tagtype, $lt, $pos);
- break;
- default:
- /**
- * Check if it's whitespace
- */
- if (!preg_match('/\s/', $match)) {
- /**
- * This is an invalid tag! Look for the next closing ">".
- */
- $gt = tln_findnxstr($body, $lt, '>');
- return array(false, false, false, $lt, $gt);
- }
- break;
- }
-
- /**
- * At this point we're here:
- * <tagname attribute='blah'>
- * \-------^
- *
- * At this point we loop in order to find all attributes.
- */
- $attary = array();
-
- while ($pos <= strlen($body)) {
- $pos = tln_skipspace($body, $pos);
- if ($pos == strlen($body)) {
- /**
- * Non-closed tag.
- */
- return array(false, false, false, $lt, $pos);
- }
- /**
- * See if we arrived at a ">" or "/>", which means that we reached
- * the end of the tag.
- */
- $matches = array();
- if (preg_match('%^(\s*)(>|/>)%s', substr($body, $pos), $matches)) {
- /**
- * Yep. So we did.
- */
- $pos += strlen($matches[1]);
- if ($matches[2] == '/>') {
- $tagtype = 3;
- $pos++;
- }
- return array($tagname, $attary, $tagtype, $lt, $pos);
- }
-
- /**
- * There are several types of attributes, with optional
- * [:space:] between members.
- * Type 1:
- * attrname[:space:]=[:space:]'CDATA'
- * Type 2:
- * attrname[:space:]=[:space:]"CDATA"
- * Type 3:
- * attr[:space:]=[:space:]CDATA
- * Type 4:
- * attrname
- *
- * We leave types 1 and 2 the same, type 3 we check for
- * '"' and convert to """ if needed, then wrap in
- * double quotes. Type 4 we convert into:
- * attrname="yes".
- */
- $regary = tln_findnxreg($body, $pos, '[^\w\-_]');
- if ($regary == false) {
- /**
- * Looks like body ended before the end of tag.
- */
- return array(false, false, false, $lt, strlen($body));
- }
- list($pos, $attname, $match) = $regary;
- $attname = strtolower($attname);
- /**
- * We arrived at the end of attribute name. Several things possible
- * here:
- * '>' means the end of the tag and this is attribute type 4
- * '/' if followed by '>' means the same thing as above
- * '\s' means a lot of things -- look what it's followed by.
- * anything else means the attribute is invalid.
- */
- switch ($match) {
- case '/':
- /**
- * This is an xhtml-style tag with a closing / at the
- * end, like so: <img src="blah"/>. Check if it's followed
- * by the closing bracket. If not, then this tag is invalid
- */
- if (substr($body, $pos, 2) == '/>') {
- $pos++;
- $tagtype = 3;
- } else {
- $gt = tln_findnxstr($body, $pos, '>');
- $retary = array(false, false, false, $lt, $gt);
- return $retary;
- }
- //intentional fall-through
- case '>':
- $attary{$attname} = '"yes"';
- return array($tagname, $attary, $tagtype, $lt, $pos);
- break;
- default:
- /**
- * Skip whitespace and see what we arrive at.
- */
- $pos = tln_skipspace($body, $pos);
- $char = substr($body, $pos, 1);
- /**
- * Two things are valid here:
- * '=' means this is attribute type 1 2 or 3.
- * \w means this was attribute type 4.
- * anything else we ignore and re-loop. End of tag and
- * invalid stuff will be caught by our checks at the beginning
- * of the loop.
- */
- if ($char == '=') {
- $pos++;
- $pos = tln_skipspace($body, $pos);
- /**
- * Here are 3 possibilities:
- * "'" attribute type 1
- * '"' attribute type 2
- * everything else is the content of tag type 3
- */
- $quot = substr($body, $pos, 1);
- if ($quot == '\'') {
- $regary = tln_findnxreg($body, $pos + 1, '\'');
- if ($regary == false) {
- return array(false, false, false, $lt, strlen($body));
- }
- list($pos, $attval, $match) = $regary;
- $pos++;
- $attary{$attname} = '\'' . $attval . '\'';
- } elseif ($quot == '"') {
- $regary = tln_findnxreg($body, $pos + 1, '\"');
- if ($regary == false) {
- return array(false, false, false, $lt, strlen($body));
- }
- list($pos, $attval, $match) = $regary;
- $pos++;
- $attary{$attname} = '"' . $attval . '"';
- } else {
- /**
- * These are hateful. Look for \s, or >.
- */
- $regary = tln_findnxreg($body, $pos, '[\s>]');
- if ($regary == false) {
- return array(false, false, false, $lt, strlen($body));
- }
- list($pos, $attval, $match) = $regary;
- /**
- * If it's ">" it will be caught at the top.
- */
- $attval = preg_replace('/\"/s', '"', $attval);
- $attary{$attname} = '"' . $attval . '"';
- }
- } elseif (preg_match('|[\w/>]|', $char)) {
- /**
- * That was attribute type 4.
- */
- $attary{$attname} = '"yes"';
- } else {
- /**
- * An illegal character. Find next '>' and return.
- */
- $gt = tln_findnxstr($body, $pos, '>');
- return array(false, false, false, $lt, $gt);
- }
- break;
- }
- }
- /**
- * The fact that we got here indicates that the tag end was never
- * found. Return invalid tag indication so it gets stripped.
- */
- return array(false, false, false, $lt, strlen($body));
-}
-
-/**
- * Translates entities into literal values so they can be checked.
- *
- * @param string $attvalue the by-ref value to check.
- * @param string $regex the regular expression to check against.
- * @param boolean $hex whether the entites are hexadecimal.
- * @return boolean True or False depending on whether there were matches.
- */
-function tln_deent(&$attvalue, $regex, $hex = false)
-{
- preg_match_all($regex, $attvalue, $matches);
- if (is_array($matches) && sizeof($matches[0]) > 0) {
- $repl = array();
- for ($i = 0; $i < sizeof($matches[0]); $i++) {
- $numval = $matches[1][$i];
- if ($hex) {
- $numval = hexdec($numval);
- }
- $repl{$matches[0][$i]} = chr($numval);
- }
- $attvalue = strtr($attvalue, $repl);
- return true;
- } else {
- return false;
- }
-}
-
-/**
- * This function checks attribute values for entity-encoded values
- * and returns them translated into 8-bit strings so we can run
- * checks on them.
- *
- * @param string $attvalue A string to run entity check against.
- * @return Void, modifies a reference value.
- */
-function tln_defang(&$attvalue)
-{
- /**
- * Skip this if there aren't ampersands or backslashes.
- */
- if (strpos($attvalue, '&') === false
- && strpos($attvalue, '\\') === false
- ) {
- return;
- }
- do {
- $m = false;
- $m = $m || tln_deent($attvalue, '/\�*(\d+);*/s');
- $m = $m || tln_deent($attvalue, '/\�*((\d|[a-f])+);*/si', true);
- $m = $m || tln_deent($attvalue, '/\\\\(\d+)/s', true);
- } while ($m == true);
- $attvalue = stripslashes($attvalue);
-}
-
-/**
- * Kill any tabs, newlines, or carriage returns. Our friends the
- * makers of the browser with 95% market value decided that it'd
- * be funny to make "java[tab]script" be just as good as "javascript".
- *
- * @param string $attvalue The attribute value before extraneous spaces removed.
- * @return Void, modifies a reference value.
- */
-function tln_unspace(&$attvalue)
-{
- if (strcspn($attvalue, "\t\r\n\0 ") != strlen($attvalue)) {
- $attvalue = str_replace(
- array("\t", "\r", "\n", "\0", " "),
- array('', '', '', '', ''),
- $attvalue
- );
- }
-}
-
-/**
- * This function runs various checks against the attributes.
- *
- * @param string $tagname String with the name of the tag.
- * @param array $attary Array with all tag attributes.
- * @param array $rm_attnames See description for tln_sanitize
- * @param array $bad_attvals See description for tln_sanitize
- * @param array $add_attr_to_tag See description for tln_sanitize
- * @param string $trans_image_path
- * @param boolean $block_external_images
- * @return Array with modified attributes.
- */
-function tln_fixatts(
- $tagname,
- $attary,
- $rm_attnames,
- $bad_attvals,
- $add_attr_to_tag,
- $trans_image_path,
- $block_external_images
-) {
- while (list($attname, $attvalue) = each($attary)) {
- /**
- * See if this attribute should be removed.
- */
- foreach ($rm_attnames as $matchtag => $matchattrs) {
- if (preg_match($matchtag, $tagname)) {
- foreach ($matchattrs as $matchattr) {
- if (preg_match($matchattr, $attname)) {
- unset($attary{$attname});
- continue;
- }
- }
- }
- }
- /**
- * Remove any backslashes, entities, or extraneous whitespace.
- */
- $oldattvalue = $attvalue;
- tln_defang($attvalue);
- if ($attname == 'style' && $attvalue !== $oldattvalue) {
- $attvalue = "idiocy";
- $attary{$attname} = $attvalue;
- }
- tln_unspace($attvalue);
-
- /**
- * Now let's run checks on the attvalues.
- * I don't expect anyone to comprehend this. If you do,
- * get in touch with me so I can drive to where you live and
- * shake your hand personally. :)
- */
- foreach ($bad_attvals as $matchtag => $matchattrs) {
- if (preg_match($matchtag, $tagname)) {
- foreach ($matchattrs as $matchattr => $valary) {
- if (preg_match($matchattr, $attname)) {
- /**
- * There are two arrays in valary.
- * First is matches.
- * Second one is replacements
- */
- list($valmatch, $valrepl) = $valary;
- $newvalue = preg_replace($valmatch, $valrepl, $attvalue);
- if ($newvalue != $attvalue) {
- $attary{$attname} = $newvalue;
- $attvalue = $newvalue;
- }
- }
- }
- }
- }
- if ($attname == 'style') {
- if (preg_match('/[\0-\37\200-\377]+/', $attvalue)) {
- $attary{$attname} = '"disallowed character"';
- }
- preg_match_all("/url\s*\((.+)\)/si", $attvalue, $aMatch);
- if (count($aMatch)) {
- foreach($aMatch[1] as $sMatch) {
- $urlvalue = $sMatch;
- tln_fixurl($attname, $urlvalue, $trans_image_path, $block_external_images);
- $attary{$attname} = str_replace($sMatch, $urlvalue, $attvalue);
- }
- }
- }
- }
- /**
- * See if we need to append any attributes to this tag.
- */
- foreach ($add_attr_to_tag as $matchtag => $addattary) {
- if (preg_match($matchtag, $tagname)) {
- $attary = array_merge($attary, $addattary);
- }
- }
- return $attary;
-}
-
-function tln_fixurl($attname, &$attvalue, $trans_image_path, $block_external_images)
-{
- $sQuote = '"';
- $attvalue = trim($attvalue);
- if ($attvalue && ($attvalue[0] =='"'|| $attvalue[0] == "'")) {
- // remove the double quotes
- $sQuote = $attvalue[0];
- $attvalue = trim(substr($attvalue,1,-1));
- }
-
- /**
- * Replace empty src tags with the blank image. src is only used
- * for frames, images, and image inputs. Doing a replace should
- * not affect them working as should be, however it will stop
- * IE from being kicked off when src for img tags are not set
- */
- if ($attvalue == '') {
- $attvalue = $sQuote . $trans_image_path . $sQuote;
- } else {
- // first, disallow 8 bit characters and control characters
- if (preg_match('/[\0-\37\200-\377]+/',$attvalue)) {
- switch ($attname) {
- case 'href':
- $attvalue = $sQuote . 'http://invalid-stuff-detected.example.com' . $sQuote;
- break;
- default:
- $attvalue = $sQuote . $trans_image_path . $sQuote;
- break;
- }
- } else {
- $aUrl = parse_url($attvalue);
- if (isset($aUrl['scheme'])) {
- switch(strtolower($aUrl['scheme'])) {
- case 'mailto':
- case 'http':
- case 'https':
- case 'ftp':
- if ($attname != 'href') {
- if ($block_external_images == true) {
- $attvalue = $sQuote . $trans_image_path . $sQuote;
- } else {
- if (!isset($aUrl['path'])) {
- $attvalue = $sQuote . $trans_image_path . $sQuote;
- }
- }
- } else {
- $attvalue = $sQuote . $attvalue . $sQuote;
- }
- break;
- case 'outbind':
- $attvalue = $sQuote . $attvalue . $sQuote;
- break;
- case 'cid':
- $attvalue = $sQuote . $attvalue . $sQuote;
- break;
- default:
- $attvalue = $sQuote . $trans_image_path . $sQuote;
- break;
- }
- } else {
- if (!isset($aUrl['path']) || $aUrl['path'] != $trans_image_path) {
- $$attvalue = $sQuote . $trans_image_path . $sQuote;
- }
- }
- }
- }
-}
-
-function tln_fixstyle($body, $pos, $trans_image_path, $block_external_images)
-{
- $me = 'tln_fixstyle';
- // workaround for </style> in between comments
- $iCurrentPos = $pos;
- $content = '';
- $sToken = '';
- $bSucces = false;
- $bEndTag = false;
- for ($i=$pos,$iCount=strlen($body);$i<$iCount;++$i) {
- $char = $body{$i};
- switch ($char) {
- case '<':
- $sToken = $char;
- break;
- case '/':
- if ($sToken == '<') {
- $sToken .= $char;
- $bEndTag = true;
- } else {
- $content .= $char;
- }
- break;
- case '>':
- if ($bEndTag) {
- $sToken .= $char;
- if (preg_match('/\<\/\s*style\s*\>/i',$sToken,$aMatch)) {
- $newpos = $i + 1;
- $bSucces = true;
- break 2;
- } else {
- $content .= $sToken;
- }
- $bEndTag = false;
- } else {
- $content .= $char;
- }
- break;
- case '!':
- if ($sToken == '<') {
- // possible comment
- if (isset($body{$i+2}) && substr($body,$i,3) == '!--') {
- $i = strpos($body,'-->',$i+3);
- if ($i === false) { // no end comment
- $i = strlen($body);
- }
- $sToken = '';
- }
- } else {
- $content .= $char;
- }
- break;
- default:
- if ($bEndTag) {
- $sToken .= $char;
- } else {
- $content .= $char;
- }
- break;
- }
- }
- if ($bSucces == FALSE){
- return array(FALSE, strlen($body));
- }
-
-
-
- /**
- * First look for general BODY style declaration, which would be
- * like so:
- * body {background: blah-blah}
- * and change it to .bodyclass so we can just assign it to a <div>
- */
- $content = preg_replace("|body(\s*\{.*?\})|si", ".bodyclass\\1", $content);
-
- $trans_image_path = $trans_image_path;
-
- /**
- * Fix url('blah') declarations.
- */
- // $content = preg_replace("|url\s*\(\s*([\'\"])\s*\S+script\s*:.*?([\'\"])\s*\)|si",
- // "url(\\1$trans_image_path\\2)", $content);
-
- // first check for 8bit sequences and disallowed control characters
- if (preg_match('/[\16-\37\200-\377]+/',$content)) {
- $content = '<!-- style block removed by html filter due to presence of 8bit characters -->';
- return array($content, $newpos);
- }
-
- // remove @import line
- $content = preg_replace("/^\s*(@import.*)$/mi","\n<!-- @import rules forbidden -->\n",$content);
-
- $content = preg_replace("/(\\\\)?u(\\\\)?r(\\\\)?l(\\\\)?/i", 'url', $content);
- preg_match_all("/url\s*\((.+)\)/si",$content,$aMatch);
- if (count($aMatch)) {
- $aValue = $aReplace = array();
- foreach($aMatch[1] as $sMatch) {
- // url value
- $urlvalue = $sMatch;
- tln_fixurl('style',$urlvalue, $trans_image_path, $block_external_images);
- $aValue[] = $sMatch;
- $aReplace[] = $urlvalue;
- }
- $content = str_replace($aValue,$aReplace,$content);
- }
-
- /**
- * Remove any backslashes, entities, and extraneous whitespace.
- */
- $contentTemp = $content;
- tln_defang($contentTemp);
- tln_unspace($contentTemp);
-
- $match = Array('/\/\*.*\*\//',
- '/expression/i',
- '/behaviou*r/i',
- '/binding/i',
- '/include-source/i',
- '/javascript/i',
- '/script/i',
- '/position/i');
- $replace = Array('','idiocy', 'idiocy', 'idiocy', 'idiocy', 'idiocy', 'idiocy', '');
- $contentNew = preg_replace($match, $replace, $contentTemp);
- if ($contentNew !== $contentTemp) {
- $content = $contentNew;
- }
- return array($content, $newpos);
-}
-
-function tln_body2div($attary, $trans_image_path)
-{
- $me = 'tln_body2div';
- $divattary = array('class' => "'bodyclass'");
- $text = '#000000';
- $has_bgc_stl = $has_txt_stl = false;
- $styledef = '';
- if (is_array($attary) && sizeof($attary) > 0){
- foreach ($attary as $attname=>$attvalue){
- $quotchar = substr($attvalue, 0, 1);
- $attvalue = str_replace($quotchar, "", $attvalue);
- switch ($attname){
- case 'background':
- $styledef .= "background-image: url('$trans_image_path'); ";
- break;
- case 'bgcolor':
- $has_bgc_stl = true;
- $styledef .= "background-color: $attvalue; ";
- break;
- case 'text':
- $has_txt_stl = true;
- $styledef .= "color: $attvalue; ";
- break;
- }
- }
- // Outlook defines a white bgcolor and no text color. This can lead to
- // white text on a white bg with certain themes.
- if ($has_bgc_stl && !$has_txt_stl) {
- $styledef .= "color: $text; ";
- }
- if (strlen($styledef) > 0){
- $divattary{"style"} = "\"$styledef\"";
- }
- }
- return $divattary;
-}
-
-/**
- *
- * @param string $body The HTML you wish to filter
- * @param array $tag_list see description above
- * @param array $rm_tags_with_content see description above
- * @param array $self_closing_tags see description above
- * @param boolean $force_tag_closing see description above
- * @param array $rm_attnames see description above
- * @param array $bad_attvals see description above
- * @param array $add_attr_to_tag see description above
- * @param string $trans_image_path
- * @param boolean $block_external_images
-
- * @return string Sanitized html safe to show on your pages.
- */
-function tln_sanitize(
- $body,
- $tag_list,
- $rm_tags_with_content,
- $self_closing_tags,
- $force_tag_closing,
- $rm_attnames,
- $bad_attvals,
- $add_attr_to_tag,
- $trans_image_path,
- $block_external_images
-) {
- /**
- * Normalize rm_tags and rm_tags_with_content.
- */
- $rm_tags = array_shift($tag_list);
- @array_walk($tag_list, 'tln_casenormalize');
- @array_walk($rm_tags_with_content, 'tln_casenormalize');
- @array_walk($self_closing_tags, 'tln_casenormalize');
- /**
- * See if tag_list is of tags to remove or tags to allow.
- * false means remove these tags
- * true means allow these tags
- */
- $curpos = 0;
- $open_tags = array();
- $trusted = "<!-- begin tln_sanitized html -->\n";
- $skip_content = false;
- /**
- * Take care of netscape's stupid javascript entities like
- * &{alert('boo')};
- */
- $body = preg_replace('/&(\{.*?\};)/si', '&\\1', $body);
- while (($curtag = tln_getnxtag($body, $curpos)) != false) {
- list($tagname, $attary, $tagtype, $lt, $gt) = $curtag;
- $free_content = substr($body, $curpos, $lt-$curpos);
- /**
- * Take care of <style>
- */
- if ($tagname == "style" && $tagtype == 1){
- list($free_content, $curpos) =
- tln_fixstyle($body, $gt+1, $trans_image_path, $block_external_images);
- if ($free_content != FALSE){
- if ( !empty($attary) ) {
- $attary = tln_fixatts($tagname,
- $attary,
- $rm_attnames,
- $bad_attvals,
- $add_attr_to_tag,
- $trans_image_path,
- $block_external_images
- );
- }
- $trusted .= tln_tagprint($tagname, $attary, $tagtype);
- $trusted .= $free_content;
- $trusted .= tln_tagprint($tagname, false, 2);
- }
- continue;
- }
- if ($skip_content == false){
- $trusted .= $free_content;
- }
- if ($tagname != false) {
- if ($tagtype == 2) {
- if ($skip_content == $tagname) {
- /**
- * Got to the end of tag we needed to remove.
- */
- $tagname = false;
- $skip_content = false;
- } else {
- if ($skip_content == false) {
- if ($tagname == "body") {
- $tagname = "div";
- }
- if (isset($open_tags{$tagname}) &&
- $open_tags{$tagname} > 0
- ) {
- $open_tags{$tagname}--;
- } else {
- $tagname = false;
- }
- }
- }
- } else {
- /**
- * $rm_tags_with_content
- */
- if ($skip_content == false) {
- /**
- * See if this is a self-closing type and change
- * tagtype appropriately.
- */
- if ($tagtype == 1
- && in_array($tagname, $self_closing_tags)
- ) {
- $tagtype = 3;
- }
- /**
- * See if we should skip this tag and any content
- * inside it.
- */
- if ($tagtype == 1
- && in_array($tagname, $rm_tags_with_content)
- ) {
- $skip_content = $tagname;
- } else {
- if (($rm_tags == false
- && in_array($tagname, $tag_list)) ||
- ($rm_tags == true
- && !in_array($tagname, $tag_list))
- ) {
- $tagname = false;
- } else {
- /**
- * Convert body into div.
- */
- if ($tagname == "body"){
- $tagname = "div";
- $attary = tln_body2div($attary, $trans_image_path);
- }
- if ($tagtype == 1) {
- if (isset($open_tags{$tagname})) {
- $open_tags{$tagname}++;
- } else {
- $open_tags{$tagname} = 1;
- }
- }
- /**
- * This is where we run other checks.
- */
- if (is_array($attary) && sizeof($attary) > 0) {
- $attary = tln_fixatts(
- $tagname,
- $attary,
- $rm_attnames,
- $bad_attvals,
- $add_attr_to_tag,
- $trans_image_path,
- $block_external_images
- );
- }
- }
- }
- }
- }
- if ($tagname != false && $skip_content == false) {
- $trusted .= tln_tagprint($tagname, $attary, $tagtype);
- }
- }
- $curpos = $gt + 1;
- }
- $trusted .= substr($body, $curpos, strlen($body) - $curpos);
- if ($force_tag_closing == true) {
- foreach ($open_tags as $tagname => $opentimes) {
- while ($opentimes > 0) {
- $trusted .= '</' . $tagname . '>';
- $opentimes--;
- }
- }
- $trusted .= "\n";
- }
- $trusted .= "<!-- end tln_sanitized html -->\n";
- return $trusted;
-}
-
-//
-// Use the nifty htmlfilter library
-//
-
-
-function HTMLFilter($body, $trans_image_path, $block_external_images = false)
-{
-
- $tag_list = array(
- false,
- "object",
- "meta",
- "html",
- "head",
- "base",
- "link",
- "frame",
- "iframe",
- "plaintext",
- "marquee"
- );
-
- $rm_tags_with_content = array(
- "script",
- "applet",
- "embed",
- "title",
- "frameset",
- "xmp",
- "xml"
- );
-
- $self_closing_tags = array(
- "img",
- "br",
- "hr",
- "input",
- "outbind"
- );
-
- $force_tag_closing = true;
-
- $rm_attnames = array(
- "/.*/" =>
- array(
- // "/target/i",
- "/^on.*/i",
- "/^dynsrc/i",
- "/^data.*/i",
- "/^lowsrc.*/i"
- )
- );
-
- $bad_attvals = array(
- "/.*/" =>
- array(
- "/^src|background/i" =>
- array(
- array(
- '/^([\'"])\s*\S+script\s*:.*([\'"])/si',
- '/^([\'"])\s*mocha\s*:*.*([\'"])/si',
- '/^([\'"])\s*about\s*:.*([\'"])/si'
- ),
- array(
- "\\1$trans_image_path\\2",
- "\\1$trans_image_path\\2",
- "\\1$trans_image_path\\2"
- )
- ),
- "/^href|action/i" =>
- array(
- array(
- '/^([\'"])\s*\S+script\s*:.*([\'"])/si',
- '/^([\'"])\s*mocha\s*:*.*([\'"])/si',
- '/^([\'"])\s*about\s*:.*([\'"])/si'
- ),
- array(
- "\\1#\\1",
- "\\1#\\1",
- "\\1#\\1"
- )
- ),
- "/^style/i" =>
- array(
- array(
- "/\/\*.*\*\//",
- "/expression/i",
- "/binding/i",
- "/behaviou*r/i",
- "/include-source/i",
- '/position\s*:/i',
- '/(\\\\)?u(\\\\)?r(\\\\)?l(\\\\)?/i',
- '/url\s*\(\s*([\'"])\s*\S+script\s*:.*([\'"])\s*\)/si',
- '/url\s*\(\s*([\'"])\s*mocha\s*:.*([\'"])\s*\)/si',
- '/url\s*\(\s*([\'"])\s*about\s*:.*([\'"])\s*\)/si',
- '/(.*)\s*:\s*url\s*\(\s*([\'"]*)\s*\S+script\s*:.*([\'"]*)\s*\)/si'
- ),
- array(
- "",
- "idiocy",
- "idiocy",
- "idiocy",
- "idiocy",
- "idiocy",
- "url",
- "url(\\1#\\1)",
- "url(\\1#\\1)",
- "url(\\1#\\1)",
- "\\1:url(\\2#\\3)"
- )
- )
- )
- );
-
- if ($block_external_images) {
- array_push(
- $bad_attvals{'/.*/'}{'/^src|background/i'}[0],
- '/^([\'\"])\s*https*:.*([\'\"])/si'
- );
- array_push(
- $bad_attvals{'/.*/'}{'/^src|background/i'}[1],
- "\\1$trans_image_path\\1"
- );
- array_push(
- $bad_attvals{'/.*/'}{'/^style/i'}[0],
- '/url\(([\'\"])\s*https*:.*([\'\"])\)/si'
- );
- array_push(
- $bad_attvals{'/.*/'}{'/^style/i'}[1],
- "url(\\1$trans_image_path\\1)"
- );
- }
-
- $add_attr_to_tag = array(
- "/^a$/i" =>
- array('target' => '"_blank"')
- );
-
- $trusted = tln_sanitize(
- $body,
- $tag_list,
- $rm_tags_with_content,
- $self_closing_tags,
- $force_tag_closing,
- $rm_attnames,
- $bad_attvals,
- $add_attr_to_tag,
- $trans_image_path,
- $block_external_images
- );
- return $trusted;
-}
+++ /dev/null
-<?php
-/*
- * ntlm_sasl_client.php
- *
- * @(#) $Id: ntlm_sasl_client.php,v 1.3 2004/11/17 08:00:37 mlemos Exp $
- *
- */
-
-define("SASL_NTLM_STATE_START", 0);
-define("SASL_NTLM_STATE_IDENTIFY_DOMAIN", 1);
-define("SASL_NTLM_STATE_RESPOND_CHALLENGE", 2);
-define("SASL_NTLM_STATE_DONE", 3);
-define("SASL_FAIL", -1);
-define("SASL_CONTINUE", 1);
-
-class ntlm_sasl_client_class
-{
- public $credentials = array();
- public $state = SASL_NTLM_STATE_START;
-
- public function initialize(&$client)
- {
- if (!function_exists($function = "mcrypt_encrypt")
- || !function_exists($function = "mhash")
- ) {
- $extensions = array(
- "mcrypt_encrypt" => "mcrypt",
- "mhash" => "mhash"
- );
- $client->error = "the extension " . $extensions[$function] .
- " required by the NTLM SASL client class is not available in this PHP configuration";
- return (0);
- }
- return (1);
- }
-
- public function ASCIIToUnicode($ascii)
- {
- for ($unicode = "", $a = 0; $a < strlen($ascii); $a++) {
- $unicode .= substr($ascii, $a, 1) . chr(0);
- }
- return ($unicode);
- }
-
- public function typeMsg1($domain, $workstation)
- {
- $domain_length = strlen($domain);
- $workstation_length = strlen($workstation);
- $workstation_offset = 32;
- $domain_offset = $workstation_offset + $workstation_length;
- return (
- "NTLMSSP\0" .
- "\x01\x00\x00\x00" .
- "\x07\x32\x00\x00" .
- pack("v", $domain_length) .
- pack("v", $domain_length) .
- pack("V", $domain_offset) .
- pack("v", $workstation_length) .
- pack("v", $workstation_length) .
- pack("V", $workstation_offset) .
- $workstation .
- $domain
- );
- }
-
- public function NTLMResponse($challenge, $password)
- {
- $unicode = $this->ASCIIToUnicode($password);
- $md4 = mhash(MHASH_MD4, $unicode);
- $padded = $md4 . str_repeat(chr(0), 21 - strlen($md4));
- $iv_size = mcrypt_get_iv_size(MCRYPT_DES, MCRYPT_MODE_ECB);
- $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
- for ($response = "", $third = 0; $third < 21; $third += 7) {
- for ($packed = "", $p = $third; $p < $third + 7; $p++) {
- $packed .= str_pad(decbin(ord(substr($padded, $p, 1))), 8, "0", STR_PAD_LEFT);
- }
- for ($key = "", $p = 0; $p < strlen($packed); $p += 7) {
- $s = substr($packed, $p, 7);
- $b = $s . ((substr_count($s, "1") % 2) ? "0" : "1");
- $key .= chr(bindec($b));
- }
- $ciphertext = mcrypt_encrypt(MCRYPT_DES, $key, $challenge, MCRYPT_MODE_ECB, $iv);
- $response .= $ciphertext;
- }
- return $response;
- }
-
- public function typeMsg3($ntlm_response, $user, $domain, $workstation)
- {
- $domain_unicode = $this->ASCIIToUnicode($domain);
- $domain_length = strlen($domain_unicode);
- $domain_offset = 64;
- $user_unicode = $this->ASCIIToUnicode($user);
- $user_length = strlen($user_unicode);
- $user_offset = $domain_offset + $domain_length;
- $workstation_unicode = $this->ASCIIToUnicode($workstation);
- $workstation_length = strlen($workstation_unicode);
- $workstation_offset = $user_offset + $user_length;
- $lm = "";
- $lm_length = strlen($lm);
- $lm_offset = $workstation_offset + $workstation_length;
- $ntlm = $ntlm_response;
- $ntlm_length = strlen($ntlm);
- $ntlm_offset = $lm_offset + $lm_length;
- $session = "";
- $session_length = strlen($session);
- $session_offset = $ntlm_offset + $ntlm_length;
- return (
- "NTLMSSP\0" .
- "\x03\x00\x00\x00" .
- pack("v", $lm_length) .
- pack("v", $lm_length) .
- pack("V", $lm_offset) .
- pack("v", $ntlm_length) .
- pack("v", $ntlm_length) .
- pack("V", $ntlm_offset) .
- pack("v", $domain_length) .
- pack("v", $domain_length) .
- pack("V", $domain_offset) .
- pack("v", $user_length) .
- pack("v", $user_length) .
- pack("V", $user_offset) .
- pack("v", $workstation_length) .
- pack("v", $workstation_length) .
- pack("V", $workstation_offset) .
- pack("v", $session_length) .
- pack("v", $session_length) .
- pack("V", $session_offset) .
- "\x01\x02\x00\x00" .
- $domain_unicode .
- $user_unicode .
- $workstation_unicode .
- $lm .
- $ntlm
- );
- }
-
- public function start(&$client, &$message, &$interactions)
- {
- if ($this->state != SASL_NTLM_STATE_START) {
- $client->error = "NTLM authentication state is not at the start";
- return (SASL_FAIL);
- }
- $this->credentials = array(
- "user" => "",
- "password" => "",
- "realm" => "",
- "workstation" => ""
- );
- $defaults = array();
- $status = $client->GetCredentials($this->credentials, $defaults, $interactions);
- if ($status == SASL_CONTINUE) {
- $this->state = SASL_NTLM_STATE_IDENTIFY_DOMAIN;
- }
- unset($message);
- return ($status);
- }
-
- public function step(&$client, $response, &$message, &$interactions)
- {
- switch ($this->state) {
- case SASL_NTLM_STATE_IDENTIFY_DOMAIN:
- $message = $this->TypeMsg1($this->credentials["realm"], $this->credentials["workstation"]);
- $this->state = SASL_NTLM_STATE_RESPOND_CHALLENGE;
- break;
- case SASL_NTLM_STATE_RESPOND_CHALLENGE:
- $ntlm_response = $this->NTLMResponse(substr($response, 24, 8), $this->credentials["password"]);
- $message = $this->TypeMsg3(
- $ntlm_response,
- $this->credentials["user"],
- $this->credentials["realm"],
- $this->credentials["workstation"]
- );
- $this->state = SASL_NTLM_STATE_DONE;
- break;
- case SASL_NTLM_STATE_DONE:
- $client->error = "NTLM authentication was finished without success";
- return (SASL_FAIL);
- default:
- $client->error = "invalid NTLM authentication step state";
- return (SASL_FAIL);
- }
- return (SASL_CONTINUE);
- }
-}
<?php
/**
- * Get an OAuth2 token from Google.
+ * PHPMailer - PHP email creation and transport class.
+ * PHP Version 5.5
+ * @package PHPMailer
+ * @see 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 - 2017 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.
+ */
+/**
+ * Get an OAuth2 token from an OAuth2 provider.
* * Install this script on your server so that it's accessible
* as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
- * e.g.: http://localhost/phpmail/get_oauth_token.php
+ * e.g.: http://localhost/phpmailer/get_oauth_token.php
* * Ensure dependencies are installed with 'composer install'
- * * Set up an app in your Google developer console
+ * * Set up an app in your Google/Yahoo/Microsoft account
* * Set the script address as the app's redirect URL
- * If no refresh token is obtained when running this file, revoke access to your app
- * using link: https://accounts.google.com/b/0/IssuedAuthSubTokens and run the script again.
- * This script requires PHP 5.4 or later
- * PHP Version 5.4
+ * If no refresh token is obtained when running this file,
+ * revoke access to your app and run the script again.
*/
-namespace League\OAuth2\Client\Provider;
+namespace PHPMailer\PHPMailer;
-require 'vendor/autoload.php';
+/**
+ * Aliases for League Provider Classes
+ * Make sure you have added these to your composer.json and run `composer install`
+ * Plenty to choose from here:
+ * @see http://oauth2-client.thephpleague.com/providers/thirdparty/
+ */
+// @see https://github.com/thephpleague/oauth2-google
+use League\OAuth2\Client\Provider\Google;
+// @see https://packagist.org/packages/hayageek/oauth2-yahoo
+use Hayageek\OAuth2\Client\Provider\Yahoo;
+// @see https://github.com/stevenmaguire/oauth2-microsoft
+use Stevenmaguire\OAuth2\Client\Provider\Microsoft;
+
+if (!isset($_GET['code']) && !isset($_GET['provider'])) {
+?>
+<html>
+<body>Select Provider:<br/>
+<a href='?provider=Google'>Google</a><br/>
+<a href='?provider=Yahoo'>Yahoo</a><br/>
+<a href='?provider=Microsoft'>Microsoft/Outlook/Hotmail/Live/Office365</a><br/>
+</body>
+</html>
+<?php
+exit;
+}
-use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
-use League\OAuth2\Client\Token\AccessToken;
-use League\OAuth2\Client\Tool\BearerAuthorizationTrait;
-use Psr\Http\Message\ResponseInterface;
+require 'vendor/autoload.php';
session_start();
-//If this automatic URL doesn't work, set it yourself manually
-$redirectUri = isset($_SERVER['HTTPS']) ? 'https://' : 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
-//$redirectUri = 'http://localhost/phpmailer/get_oauth_token.php';
+$providerName = '';
-//These details obtained are by setting up app in Google developer console.
+if (array_key_exists('provider', $_GET)) {
+ $providerName = $_GET['provider'];
+ $_SESSION['provider'] = $providerName;
+} elseif (array_key_exists('provider', $_SESSION)) {
+ $providerName = $_SESSION['provider'];
+}
+if (!in_array($providerName, ['Google', 'Microsoft', 'Yahoo'])) {
+ exit('Only Google, Microsoft and Yahoo OAuth2 providers are currently supported in this script.');
+}
+
+//These details are obtained by setting up an app in the Google developer console,
+//or whichever provider you're using.
$clientId = 'RANDOMCHARS-----duv1n2.apps.googleusercontent.com';
$clientSecret = 'RANDOMCHARS-----lGyjPcRtvP';
-class Google extends AbstractProvider
-{
- use BearerAuthorizationTrait;
-
- const ACCESS_TOKEN_RESOURCE_OWNER_ID = 'id';
-
- /**
- * @var string If set, this will be sent to google as the "access_type" parameter.
- * @link https://developers.google.com/accounts/docs/OAuth2WebServer#offline
- */
- protected $accessType;
-
- /**
- * @var string If set, this will be sent to google as the "hd" parameter.
- * @link https://developers.google.com/accounts/docs/OAuth2Login#hd-param
- */
- protected $hostedDomain;
-
- /**
- * @var string If set, this will be sent to google as the "scope" parameter.
- * @link https://developers.google.com/gmail/api/auth/scopes
- */
- protected $scope;
-
- public function getBaseAuthorizationUrl()
- {
- return 'https://accounts.google.com/o/oauth2/auth';
- }
-
- public function getBaseAccessTokenUrl(array $params)
- {
- return 'https://accounts.google.com/o/oauth2/token';
- }
-
- public function getResourceOwnerDetailsUrl(AccessToken $token)
- {
- return ' ';
- }
-
- protected function getAuthorizationParameters(array $options)
- {
- if (is_array($this->scope)) {
- $separator = $this->getScopeSeparator();
- $this->scope = implode($separator, $this->scope);
- }
-
- $params = array_merge(
- parent::getAuthorizationParameters($options),
- array_filter([
- 'hd' => $this->hostedDomain,
- 'access_type' => $this->accessType,
- 'scope' => $this->scope,
- // if the user is logged in with more than one account ask which one to use for the login!
- 'authuser' => '-1'
- ])
- );
- return $params;
- }
-
- protected function getDefaultScopes()
- {
- return [
- 'email',
- 'openid',
- 'profile',
+//If this automatic URL doesn't work, set it yourself manually to the URL of this script
+$redirectUri = (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
+//$redirectUri = 'http://localhost/PHPMailer/redirect';
+
+$params = [
+ 'clientId' => $clientId,
+ 'clientSecret' => $clientSecret,
+ 'redirectUri' => $redirectUri,
+ 'accessType' => 'offline'
+];
+
+$options = [];
+$provider = null;
+
+switch ($providerName) {
+ case 'Google':
+ $provider = new Google($params);
+ $options = [
+ 'scope' => [
+ 'https://mail.google.com/'
+ ]
];
- }
-
- protected function getScopeSeparator()
- {
- return ' ';
- }
-
- protected function checkResponse(ResponseInterface $response, $data)
- {
- if (!empty($data['error'])) {
- $code = 0;
- $error = $data['error'];
-
- if (is_array($error)) {
- $code = $error['code'];
- $error = $error['message'];
- }
-
- throw new IdentityProviderException($error, $code, $data);
- }
- }
-
- protected function createResourceOwner(array $response, AccessToken $token)
- {
- return new GoogleUser($response);
- }
+ break;
+ case 'Yahoo':
+ $provider = new Yahoo($params);
+ break;
+ case 'Microsoft':
+ $provider = new Microsoft($params);
+ $options = [
+ 'scope' => [
+ 'wl.imap',
+ 'wl.offline_access'
+ ]
+ ];
+ break;
}
-
-//Set Redirect URI in Developer Console as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
-$provider = new Google(
- array(
- 'clientId' => $clientId,
- 'clientSecret' => $clientSecret,
- 'redirectUri' => $redirectUri,
- 'scope' => array('https://mail.google.com/'),
- 'accessType' => 'offline'
- )
-);
+if (null === $provider) {
+ exit('Provider missing');
+}
if (!isset($_GET['code'])) {
// If we don't have an authorization code then get one
- $authUrl = $provider->getAuthorizationUrl();
+ $authUrl = $provider->getAuthorizationUrl($options);
$_SESSION['oauth2state'] = $provider->getState();
header('Location: ' . $authUrl);
exit;
// Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {
unset($_SESSION['oauth2state']);
+ unset($_SESSION['provider']);
exit('Invalid state');
} else {
+ unset($_SESSION['provider']);
// Try to get an access token (using the authorization code grant)
$token = $provider->getAccessToken(
'authorization_code',
- array(
+ [
'code' => $_GET['code']
- )
+ ]
);
-
+ // Use this to interact with an API on the users behalf
// Use this to get a new access token if the old one expires
- echo 'Refresh Token: ' . $token->getRefreshToken();
+ echo 'Refresh Token: ', $token->getRefreshToken();
}
--- /dev/null
+<?php
+/**
+ * Afrikaans PHPMailer language file: refer to English translation for definitive list
+ * @package PHPMailer
+ */
+
+$PHPMAILER_LANG['authenticate'] = 'SMTP-fout: kon nie geverifieer word nie.';
+$PHPMAILER_LANG['connect_host'] = 'SMTP-fout: kon nie aan SMTP-verbind nie.';
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP-fout: data nie aanvaar nie.';
+$PHPMAILER_LANG['empty_message'] = 'Boodskapliggaam leeg.';
+$PHPMAILER_LANG['encoding'] = 'Onbekende kodering: ';
+$PHPMAILER_LANG['execute'] = 'Kon nie uitvoer nie: ';
+$PHPMAILER_LANG['file_access'] = 'Kon nie lêer oopmaak nie: ';
+$PHPMAILER_LANG['file_open'] = 'Lêerfout: Kon nie lêer oopmaak nie: ';
+$PHPMAILER_LANG['from_failed'] = 'Die volgende Van adres misluk: ';
+$PHPMAILER_LANG['instantiate'] = 'Kon nie posfunksie instansieer nie.';
+$PHPMAILER_LANG['invalid_address'] = 'Ongeldige adres: ';
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer word nie ondersteun nie.';
+$PHPMAILER_LANG['provide_address'] = 'U moet ten minste een ontvanger e-pos adres verskaf.';
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP-fout: Die volgende ontvangers het misluk: ';
+$PHPMAILER_LANG['signing'] = 'Ondertekening Fout: ';
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP-verbinding () misluk.';
+$PHPMAILER_LANG['smtp_error'] = 'SMTP-bediener fout: ';
+$PHPMAILER_LANG['variable_set'] = 'Kan nie veranderlike instel of herstel nie: ';
+$PHPMAILER_LANG['extension_missing'] = 'Uitbreiding ontbreek: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() غير ممكن.';
$PHPMAILER_LANG['smtp_error'] = 'خطأ على مستوى الخادم SMTP: ';
$PHPMAILER_LANG['variable_set'] = 'لا يمكن تعيين أو إعادة تعيين متغير: ';
-//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
+$PHPMAILER_LANG['extension_missing'] = 'الإضافة غير موجودة: ';
--- /dev/null
+<?php
+/**
+ * Bosnian PHPMailer language file: refer to English translation for definitive list
+ * @package PHPMailer
+ * @author Ermin Islamagić <ermin@islamagic.com>
+ */
+
+$PHPMAILER_LANG['authenticate'] = 'SMTP Greška: Neuspjela prijava.';
+$PHPMAILER_LANG['connect_host'] = 'SMTP Greška: Nije moguće spojiti se sa SMTP serverom.';
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Greška: Podatci nisu prihvaćeni.';
+$PHPMAILER_LANG['empty_message'] = 'Sadržaj poruke je prazan.';
+$PHPMAILER_LANG['encoding'] = 'Nepoznata kriptografija: ';
+$PHPMAILER_LANG['execute'] = 'Nije moguće izvršiti naredbu: ';
+$PHPMAILER_LANG['file_access'] = 'Nije moguće pristupiti datoteci: ';
+$PHPMAILER_LANG['file_open'] = 'Nije moguće otvoriti datoteku: ';
+$PHPMAILER_LANG['from_failed'] = 'SMTP Greška: Slanje sa navedenih e-mail adresa nije uspjelo: ';
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP Greška: Slanje na navedene e-mail adrese nije uspjelo: ';
+$PHPMAILER_LANG['instantiate'] = 'Ne mogu pokrenuti mail funkcionalnost.';
+$PHPMAILER_LANG['invalid_address'] = 'E-mail nije poslan. Neispravna e-mail adresa: ';
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer nije podržan.';
+$PHPMAILER_LANG['provide_address'] = 'Definišite barem jednu adresu primaoca.';
+$PHPMAILER_LANG['signing'] = 'Greška prilikom prijave: ';
+$PHPMAILER_LANG['smtp_connect_failed'] = 'Spajanje na SMTP server nije uspjelo.';
+$PHPMAILER_LANG['smtp_error'] = 'SMTP greška: ';
+$PHPMAILER_LANG['variable_set'] = 'Nije moguće postaviti varijablu ili je vratiti nazad: ';
+$PHPMAILER_LANG['extension_missing'] = 'Nedostaje ekstenzija: ';
\ No newline at end of file
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() selhal.';
$PHPMAILER_LANG['smtp_error'] = 'Chyba SMTP serveru: ';
$PHPMAILER_LANG['variable_set'] = 'Nelze nastavit nebo změnit proměnnou: ';
-//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
+$PHPMAILER_LANG['extension_missing'] = 'Chybí rozšíření: ';
* @package PHPMailer
*/
-$PHPMAILER_LANG['authenticate'] = 'SMTP Fehler: Authentifizierung fehlgeschlagen.';
-$PHPMAILER_LANG['connect_host'] = 'SMTP Fehler: Konnte keine Verbindung zum SMTP-Host herstellen.';
-$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Fehler: Daten werden nicht akzeptiert.';
-$PHPMAILER_LANG['empty_message'] = 'E-Mail Inhalt ist leer.';
-$PHPMAILER_LANG['encoding'] = 'Unbekanntes Encoding-Format: ';
+$PHPMAILER_LANG['authenticate'] = 'SMTP-Fehler: Authentifizierung fehlgeschlagen.';
+$PHPMAILER_LANG['connect_host'] = 'SMTP-Fehler: Konnte keine Verbindung zum SMTP-Host herstellen.';
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP-Fehler: Daten werden nicht akzeptiert.';
+$PHPMAILER_LANG['empty_message'] = 'E-Mail-Inhalt ist leer.';
+$PHPMAILER_LANG['encoding'] = 'Unbekannte Kodierung: ';
$PHPMAILER_LANG['execute'] = 'Konnte folgenden Befehl nicht ausführen: ';
$PHPMAILER_LANG['file_access'] = 'Zugriff auf folgende Datei fehlgeschlagen: ';
-$PHPMAILER_LANG['file_open'] = 'Datei Fehler: konnte folgende Datei nicht öffnen: ';
+$PHPMAILER_LANG['file_open'] = 'Dateifehler: Konnte folgende Datei nicht öffnen: ';
$PHPMAILER_LANG['from_failed'] = 'Die folgende Absenderadresse ist nicht korrekt: ';
-$PHPMAILER_LANG['instantiate'] = 'Mail Funktion konnte nicht initialisiert werden.';
-$PHPMAILER_LANG['invalid_address'] = 'E-Mail wird nicht gesendet, die Adresse ist ungültig: ';
+$PHPMAILER_LANG['instantiate'] = 'Mail-Funktion konnte nicht initialisiert werden.';
+$PHPMAILER_LANG['invalid_address'] = 'Die Adresse ist ungültig: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer wird nicht unterstützt.';
-$PHPMAILER_LANG['provide_address'] = 'Bitte geben Sie mindestens eine Empfänger E-Mailadresse an.';
-$PHPMAILER_LANG['recipients_failed'] = 'SMTP Fehler: Die folgenden Empfänger sind nicht korrekt: ';
+$PHPMAILER_LANG['provide_address'] = 'Bitte geben Sie mindestens eine Empfängeradresse an.';
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP-Fehler: Die folgenden Empfänger sind nicht korrekt: ';
$PHPMAILER_LANG['signing'] = 'Fehler beim Signieren: ';
-$PHPMAILER_LANG['smtp_connect_failed'] = 'Verbindung zu SMTP Server fehlgeschlagen.';
-$PHPMAILER_LANG['smtp_error'] = 'Fehler vom SMTP Server: ';
+$PHPMAILER_LANG['smtp_connect_failed'] = 'Verbindung zum SMTP-Server fehlgeschlagen.';
+$PHPMAILER_LANG['smtp_error'] = 'Fehler vom SMTP-Server: ';
$PHPMAILER_LANG['variable_set'] = 'Kann Variable nicht setzen oder zurücksetzen: ';
$PHPMAILER_LANG['extension_missing'] = 'Fehlende Erweiterung: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP konektado malsukcesis.';
$PHPMAILER_LANG['smtp_error'] = 'Eraro de servilo SMTP : ';
$PHPMAILER_LANG['variable_set'] = 'Variablo ne pravalorizeblas aŭ ne repravalorizeblas: ';
-//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
+$PHPMAILER_LANG['extension_missing'] = 'Mankas etendo: ';
$PHPMAILER_LANG['authenticate'] = 'Error SMTP: Imposible autentificar.';
$PHPMAILER_LANG['connect_host'] = 'Error SMTP: Imposible conectar al servidor SMTP.';
$PHPMAILER_LANG['data_not_accepted'] = 'Error SMTP: Datos no aceptados.';
-$PHPMAILER_LANG['empty_message'] = 'El cuerpo del mensaje está vacío';
+$PHPMAILER_LANG['empty_message'] = 'El cuerpo del mensaje está vacío.';
$PHPMAILER_LANG['encoding'] = 'Codificación desconocida: ';
$PHPMAILER_LANG['execute'] = 'Imposible ejecutar: ';
$PHPMAILER_LANG['file_access'] = 'Imposible acceder al archivo: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'خطا در اتصال به SMTP.';
$PHPMAILER_LANG['smtp_error'] = 'خطا در SMTP Server: ';
$PHPMAILER_LANG['variable_set'] = 'امکان ارسال یا ارسال مجدد متغیرها وجود ندارد: ';
-//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
+$PHPMAILER_LANG['extension_missing'] = 'افزونه موجود نیست: ';
* Some French punctuation requires a thin non-breaking space (U+202F) character before it,
* for example before a colon or exclamation mark.
* There is one of these characters between these quotes: " "
- * @link http://unicode.org/udhr/n/notes_fra.html
+ * @see http://unicode.org/udhr/n/notes_fra.html
*/
$PHPMAILER_LANG['authenticate'] = 'Erreur SMTP : échec de l\'authentification.';
--- /dev/null
+<?php
+/**
+ * Hindi PHPMailer language file: refer to English translation for definitive list
+ * @package PHPMailer
+ * @author Yash Karanke <mr.karanke@gmail.com>
+ */
+
+$PHPMAILER_LANG['authenticate'] = 'SMTP त्रुटि: प्रामाणिकता की जांच नहीं हो सका। ';
+$PHPMAILER_LANG['connect_host'] = 'SMTP त्रुटि: SMTP सर्वर से कनेक्ट नहीं हो सका। ';
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP त्रुटि: डेटा स्वीकार नहीं किया जाता है। ';
+$PHPMAILER_LANG['empty_message'] = 'संदेश खाली है। ';
+$PHPMAILER_LANG['encoding'] = 'अज्ञात एन्कोडिंग प्रकार। ';
+$PHPMAILER_LANG['execute'] = 'आदेश को निष्पादित करने में विफल। ';
+$PHPMAILER_LANG['file_access'] = 'फ़ाइल उपलब्ध नहीं है। ';
+$PHPMAILER_LANG['file_open'] = 'फ़ाइल त्रुटि: फाइल को खोला नहीं जा सका। ';
+$PHPMAILER_LANG['from_failed'] = 'प्रेषक का पता गलत है। ';
+$PHPMAILER_LANG['instantiate'] = 'मेल फ़ंक्शन कॉल नहीं कर सकता है।';
+$PHPMAILER_LANG['invalid_address'] = 'पता गलत है। ';
+$PHPMAILER_LANG['mailer_not_supported'] = 'मेल सर्वर के साथ काम नहीं करता है। ';
+$PHPMAILER_LANG['provide_address'] = 'आपको कम से कम एक प्राप्तकर्ता का ई-मेल पता प्रदान करना होगा।';
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP त्रुटि: निम्न प्राप्तकर्ताओं को पते भेजने में विफल। ';
+$PHPMAILER_LANG['signing'] = 'साइनअप त्रुटि:। ';
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP का connect () फ़ंक्शन विफल हुआ। ';
+$PHPMAILER_LANG['smtp_error'] = 'SMTP सर्वर त्रुटि। ';
+$PHPMAILER_LANG['variable_set'] = 'चर को बना या संशोधित नहीं किया जा सकता। ';
+$PHPMAILER_LANG['extension_missing'] = 'एक्सटेन्षन गायब है: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'Hiba az SMTP-kapcsolatban.';
$PHPMAILER_LANG['smtp_error'] = 'SMTP-szerver hiba: ';
$PHPMAILER_LANG['variable_set'] = 'A következő változók beállítása nem sikerült: ';
-//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
+$PHPMAILER_LANG['extension_missing'] = 'Bővítmény hiányzik: ';
* Indonesian PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
* @author Cecep Prawiro <cecep.prawiro@gmail.com>
+ * @author @januridp
*/
-$PHPMAILER_LANG['authenticate'] = 'Kesalahan SMTP: Tidak dapat mengautentikasi.';
+$PHPMAILER_LANG['authenticate'] = 'Kesalahan SMTP: Tidak dapat mengotentikasi.';
$PHPMAILER_LANG['connect_host'] = 'Kesalahan SMTP: Tidak dapat terhubung ke host SMTP.';
-$PHPMAILER_LANG['data_not_accepted'] = 'Kesalahan SMTP: Data tidak diterima peladen.';
+$PHPMAILER_LANG['data_not_accepted'] = 'Kesalahan SMTP: Data tidak diterima.';
$PHPMAILER_LANG['empty_message'] = 'Isi pesan kosong';
$PHPMAILER_LANG['encoding'] = 'Pengkodean karakter tidak dikenali: ';
$PHPMAILER_LANG['execute'] = 'Tidak dapat menjalankan proses : ';
$PHPMAILER_LANG['file_access'] = 'Tidak dapat mengakses berkas : ';
-$PHPMAILER_LANG['file_open'] = 'Kesalahan File: Berkas tidak bisa dibuka : ';
-$PHPMAILER_LANG['from_failed'] = 'Alamat pengirim berikut mengakibatkan error : ';
-$PHPMAILER_LANG['instantiate'] = 'Tidak dapat menginisialisasi fungsi email';
-$PHPMAILER_LANG['invalid_address'] = 'Gagal terkirim, alamat email tidak valid : ';
+$PHPMAILER_LANG['file_open'] = 'Kesalahan File: Berkas tidak dapat dibuka : ';
+$PHPMAILER_LANG['from_failed'] = 'Alamat pengirim berikut mengakibatkan kesalahan : ';
+$PHPMAILER_LANG['instantiate'] = 'Tidak dapat menginisialisasi fungsi surel';
+$PHPMAILER_LANG['invalid_address'] = 'Gagal terkirim, alamat surel tidak benar : ';
$PHPMAILER_LANG['provide_address'] = 'Harus disediakan minimal satu alamat tujuan';
-$PHPMAILER_LANG['mailer_not_supported'] = 'Mailer tidak didukung';
-$PHPMAILER_LANG['recipients_failed'] = 'Kesalahan SMTP: Alamat tujuan berikut menghasilkan error : ';
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer tidak didukung';
+$PHPMAILER_LANG['recipients_failed'] = 'Kesalahan SMTP: Alamat tujuan berikut menghasilkan kesalahan : ';
$PHPMAILER_LANG['signing'] = 'Kesalahan dalam tanda tangan : ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() gagal.';
-$PHPMAILER_LANG['smtp_error'] = 'Kesalahan peladen SMTP : ';
-$PHPMAILER_LANG['variable_set'] = 'Tidak berhasil mengatur atau mengatur ulang variable : ';
-//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
+$PHPMAILER_LANG['smtp_error'] = 'Kesalahan pada pelayan SMTP : ';
+$PHPMAILER_LANG['variable_set'] = 'Tidak dapat mengatur atau mengatur ulang variable : ';
+$PHPMAILER_LANG['extension_missing'] = 'Ekstensi hilang: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() fallita.';
$PHPMAILER_LANG['smtp_error'] = 'Errore del server SMTP: ';
$PHPMAILER_LANG['variable_set'] = 'Impossibile impostare o resettare la variabile: ';
-//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
+$PHPMAILER_LANG['extension_missing'] = 'Estensione mancante: ';
--- /dev/null
+<?php
+/**
+ * Malagasy PHPMailer language file: refer to English translation for definitive list
+ * @package PHPMailer
+ * @author Hackinet <piyushjha8164@gmail.com>
+ */
+$PHPMAILER_LANG['authenticate'] = 'Hadisoana SMTP: Tsy nahomby ny fanamarinana.';
+$PHPMAILER_LANG['connect_host'] = 'SMTP Error: Tsy afaka mampifandray amin\'ny mpampiantrano SMTP.';
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP diso: tsy voarakitra ny angona.';
+$PHPMAILER_LANG['empty_message'] = 'Tsy misy ny votoaty mailaka.';
+$PHPMAILER_LANG['encoding'] = 'Tsy fantatra encoding: ';
+$PHPMAILER_LANG['execute'] = 'Tsy afaka manatanteraka ity baiko manaraka ity: ';
+$PHPMAILER_LANG['file_access'] = 'Tsy nahomby ny fidirana amin\'ity rakitra ity: ';
+$PHPMAILER_LANG['file_open'] = 'Hadisoana diso: Tsy afaka nanokatra ity file manaraka ity: ';
+$PHPMAILER_LANG['from_failed'] = 'Ny adiresy iraka manaraka dia diso: ';
+$PHPMAILER_LANG['instantiate'] = 'Tsy afaka nanomboka ny hetsika mail.';
+$PHPMAILER_LANG['invalid_address'] = 'Tsy mety ny adiresy: ';
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer tsy manohana.';
+$PHPMAILER_LANG['provide_address'] = 'Alefaso azafady iray adiresy iray farafahakeliny.';
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: Tsy mety ireo mpanaraka ireto: ';
+$PHPMAILER_LANG['signing'] = 'Error nandritra ny sonia:';
+$PHPMAILER_LANG['smtp_connect_failed'] = 'Tsy nahomby ny fifandraisana tamin\'ny server SMTP.';
+$PHPMAILER_LANG['smtp_error'] = 'Fahadisoana tamin\'ny server SMTP: ';
+$PHPMAILER_LANG['variable_set'] = 'Tsy azo atao ny mametraka na mamerina ny variable: ';
+$PHPMAILER_LANG['extension_missing'] = 'Tsy hita ny ampahany: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() telah gagal.';
$PHPMAILER_LANG['smtp_error'] = 'Ralat pada pelayan SMTP: ';
$PHPMAILER_LANG['variable_set'] = 'Tidak boleh menetapkan atau menetapkan semula pembolehubah: ';
-//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
+$PHPMAILER_LANG['extension_missing'] = 'Sambungan hilang: ';
--- /dev/null
+<?php
+/**
+ * Norwegian Bokmål PHPMailer language file: refer to English translation for definitive list
+ * @package PHPMailer
+ */
+
+$PHPMAILER_LANG['authenticate'] = 'SMTP Feil: Kunne ikke autentisere.';
+$PHPMAILER_LANG['connect_host'] = 'SMTP Feil: Kunne ikke koble til SMTP tjener.';
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Feil: Datainnhold ikke akseptert.';
+$PHPMAILER_LANG['empty_message'] = 'Meldingsinnhold mangler';
+$PHPMAILER_LANG['encoding'] = 'Ukjent koding: ';
+$PHPMAILER_LANG['execute'] = 'Kunne ikke utføre: ';
+$PHPMAILER_LANG['file_access'] = 'Får ikke tilgang til filen: ';
+$PHPMAILER_LANG['file_open'] = 'Fil Feil: Kunne ikke åpne filen: ';
+$PHPMAILER_LANG['from_failed'] = 'Følgende Frå adresse feilet: ';
+$PHPMAILER_LANG['instantiate'] = 'Kunne ikke initialisere post funksjon.';
+$PHPMAILER_LANG['invalid_address'] = 'Ugyldig adresse: ';
+$PHPMAILER_LANG['mailer_not_supported'] = ' sender er ikke støttet.';
+$PHPMAILER_LANG['provide_address'] = 'Du må opppgi minst en mottakeradresse.';
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP Feil: Følgende mottakeradresse feilet: ';
+$PHPMAILER_LANG['signing'] = 'Signering Feil: ';
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP connect() feilet.';
+$PHPMAILER_LANG['smtp_error'] = 'SMTP server feil: ';
+$PHPMAILER_LANG['variable_set'] = 'Kan ikke skrive eller omskrive variabel: ';
+$PHPMAILER_LANG['extension_missing'] = 'Utvidelse mangler: ';
<?php
/**
- * Dutch PHPMailer language file: refer to class.phpmailer.php for definitive list.
+ * Dutch PHPMailer language file: refer to PHPMailer.php for definitive list.
* @package PHPMailer
* @author Tuxion <team@tuxion.nl>
*/
$PHPMAILER_LANG['from_failed'] = 'Het volgende afzendersadres is mislukt: ';
$PHPMAILER_LANG['instantiate'] = 'Kon mailfunctie niet initialiseren.';
$PHPMAILER_LANG['invalid_address'] = 'Ongeldig adres: ';
+$PHPMAILER_LANG['invalid_hostentry'] = 'Ongeldige hostentry: ';
+$PHPMAILER_LANG['invalid_host'] = 'Ongeldige host: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer wordt niet ondersteund.';
$PHPMAILER_LANG['provide_address'] = 'Er moet minstens één ontvanger worden opgegeven.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP-fout: de volgende ontvangers zijn mislukt: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Verbinding mislukt.';
$PHPMAILER_LANG['smtp_error'] = 'SMTP-serverfout: ';
$PHPMAILER_LANG['variable_set'] = 'Kan de volgende variabele niet instellen of resetten: ';
-//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
+$PHPMAILER_LANG['extension_missing'] = 'Extensie afwezig: ';
+++ /dev/null
-<?php
-/**
- * Norwegian PHPMailer language file: refer to English translation for definitive list
- * @package PHPMailer
- */
-
-$PHPMAILER_LANG['authenticate'] = 'SMTP Feil: Kunne ikke autentisere.';
-$PHPMAILER_LANG['connect_host'] = 'SMTP Feil: Kunne ikke koble til SMTP tjener.';
-$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Feil: Data ble ikke akseptert.';
-$PHPMAILER_LANG['empty_message'] = 'Meldingsinnholdet er tomt';
-$PHPMAILER_LANG['encoding'] = 'Ukjent tegnkoding: ';
-$PHPMAILER_LANG['execute'] = 'Kunne ikke utføre: ';
-$PHPMAILER_LANG['file_access'] = 'Får ikke tilgang til filen: ';
-$PHPMAILER_LANG['file_open'] = 'Fil feil: Kunne ikke åpne filen: ';
-$PHPMAILER_LANG['from_failed'] = 'Følgende avsenderadresse feilet: ';
-$PHPMAILER_LANG['instantiate'] = 'Kunne ikke initialisere mailfunksjonen.';
-$PHPMAILER_LANG['invalid_address'] = 'Meldingen ble ikke sendt, følgende adresse er ugyldig: ';
-$PHPMAILER_LANG['provide_address'] = 'Du må angi minst en mottakeradresse.';
-$PHPMAILER_LANG['mailer_not_supported'] = ' mailer er ikke supportert.';
-$PHPMAILER_LANG['recipients_failed'] = 'SMTP Feil: Følgende mottagere feilet: ';
-$PHPMAILER_LANG['signing'] = 'Signeringsfeil: ';
-$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() feilet.';
-$PHPMAILER_LANG['smtp_error'] = 'SMTP-serverfeil: ';
-$PHPMAILER_LANG['variable_set'] = 'Kan ikke sette eller resette variabelen: ';
-//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
* @author Paulo Henrique Garcia <paulo@controllerweb.com.br>
* @author Lucas Guimarães <lucas@lucasguimaraes.com>
* @author Phelipe Alves <phelipealvesdesouza@gmail.com>
+ * @author Fabio Beneditto <fabiobeneditto@gmail.com>
*/
$PHPMAILER_LANG['authenticate'] = 'Erro de SMTP: Não foi possível autenticar.';
-$PHPMAILER_LANG['connect_host'] = 'Erro de SMTP: Não foi possível conectar com o servidor SMTP.';
+$PHPMAILER_LANG['connect_host'] = 'Erro de SMTP: Não foi possível conectar ao servidor SMTP.';
$PHPMAILER_LANG['data_not_accepted'] = 'Erro de SMTP: Dados rejeitados.';
-$PHPMAILER_LANG['empty_message'] = 'Corpo da mensagem vazio';
+$PHPMAILER_LANG['empty_message'] = 'Mensagem vazia';
$PHPMAILER_LANG['encoding'] = 'Codificação desconhecida: ';
$PHPMAILER_LANG['execute'] = 'Não foi possível executar: ';
$PHPMAILER_LANG['file_access'] = 'Não foi possível acessar o arquivo: ';
$PHPMAILER_LANG['file_open'] = 'Erro de Arquivo: Não foi possível abrir o arquivo: ';
-$PHPMAILER_LANG['from_failed'] = 'Os endereços dos remententes a seguir falharam: ';
-$PHPMAILER_LANG['instantiate'] = 'Não foi possível iniciar uma instância da função mail.';
-$PHPMAILER_LANG['invalid_address'] = 'Não enviando, endereço de e-mail inválido: ';
+$PHPMAILER_LANG['from_failed'] = 'Os seguintes remetentes falharam: ';
+$PHPMAILER_LANG['instantiate'] = 'Não foi possível instanciar a função mail.';
+$PHPMAILER_LANG['invalid_address'] = 'Endereço de e-mail inválido: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer não é suportado.';
-$PHPMAILER_LANG['provide_address'] = 'Você deve fornecer pelo menos um endereço de destinatário de e-mail.';
-$PHPMAILER_LANG['recipients_failed'] = 'Erro de SMTP: Os endereços de destinatário a seguir falharam: ';
-$PHPMAILER_LANG['signing'] = 'Erro ao assinar: ';
+$PHPMAILER_LANG['provide_address'] = 'Você deve informar pelo menos um destinatário.';
+$PHPMAILER_LANG['recipients_failed'] = 'Erro de SMTP: Os seguintes destinatários falharam: ';
+$PHPMAILER_LANG['signing'] = 'Erro de Assinatura: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falhou.';
$PHPMAILER_LANG['smtp_error'] = 'Erro de servidor SMTP: ';
-$PHPMAILER_LANG['variable_set'] = 'Não foi possível definir ou resetar a variável: ';
-$PHPMAILER_LANG['extension_missing'] = 'Extensão ausente: ';
+$PHPMAILER_LANG['variable_set'] = 'Não foi possível definir ou redefinir a variável: ';
+$PHPMAILER_LANG['extension_missing'] = 'Extensão não existe: ';
/**
* Romanian PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
- * @author Catalin Constantin <catalin@dazoot.ro>
+ * @author Alex Florea <alecz.fia@gmail.com>
*/
-$PHPMAILER_LANG['authenticate'] = 'Eroare SMTP: Nu a functionat autentificarea.';
-$PHPMAILER_LANG['connect_host'] = 'Eroare SMTP: Nu m-am putut conecta la adresa SMTP.';
-$PHPMAILER_LANG['data_not_accepted'] = 'Eroare SMTP: Continutul mailului nu a fost acceptat.';
+$PHPMAILER_LANG['authenticate'] = 'Eroare SMTP: Autentificarea a eșuat.';
+$PHPMAILER_LANG['connect_host'] = 'Eroare SMTP: Conectarea la serverul SMTP a eșuat.';
+$PHPMAILER_LANG['data_not_accepted'] = 'Eroare SMTP: Datele nu au fost acceptate.';
$PHPMAILER_LANG['empty_message'] = 'Mesajul este gol.';
-$PHPMAILER_LANG['encoding'] = 'Encodare necunoscuta: ';
-$PHPMAILER_LANG['execute'] = 'Nu pot executa: ';
-$PHPMAILER_LANG['file_access'] = 'Nu pot accesa fisierul: ';
-$PHPMAILER_LANG['file_open'] = 'Eroare de fisier: Nu pot deschide fisierul: ';
-$PHPMAILER_LANG['from_failed'] = 'Urmatoarele adrese From au dat eroare: ';
-$PHPMAILER_LANG['instantiate'] = 'Nu am putut instantia functia mail.';
-$PHPMAILER_LANG['invalid_address'] = 'Adresa de email nu este valida: ';
+$PHPMAILER_LANG['encoding'] = 'Encodare necunoscută: ';
+$PHPMAILER_LANG['execute'] = 'Nu se poate executa următoarea comandă: ';
+$PHPMAILER_LANG['file_access'] = 'Nu se poate accesa următorul fișier: ';
+$PHPMAILER_LANG['file_open'] = 'Eroare fișier: Nu se poate deschide următorul fișier: ';
+$PHPMAILER_LANG['from_failed'] = 'Următoarele adrese From au dat eroare: ';
+$PHPMAILER_LANG['instantiate'] = 'Funcția mail nu a putut fi inițializată.';
+$PHPMAILER_LANG['invalid_address'] = 'Adresa de email nu este validă: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer nu este suportat.';
-$PHPMAILER_LANG['provide_address'] = 'Trebuie sa adaugati cel putin un recipient (adresa de mail).';
-$PHPMAILER_LANG['recipients_failed'] = 'Eroare SMTP: Urmatoarele adrese de mail au dat eroare: ';
-$PHPMAILER_LANG['signing'] = 'A aparut o problema la semnarea emailului. ';
-$PHPMAILER_LANG['smtp_connect_failed'] = 'Conectarea la serverul SMTP a esuat.';
-$PHPMAILER_LANG['smtp_error'] = 'A aparut o eroare la serverul SMTP. ';
+$PHPMAILER_LANG['provide_address'] = 'Trebuie să adăugați cel puțin o adresă de email.';
+$PHPMAILER_LANG['recipients_failed'] = 'Eroare SMTP: Următoarele adrese de email au eșuat: ';
+$PHPMAILER_LANG['signing'] = 'A aparut o problemă la semnarea emailului. ';
+$PHPMAILER_LANG['smtp_connect_failed'] = 'Conectarea la serverul SMTP a eșuat.';
+$PHPMAILER_LANG['smtp_error'] = 'Eroare server SMTP: ';
$PHPMAILER_LANG['variable_set'] = 'Nu se poate seta/reseta variabila. ';
-//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
+$PHPMAILER_LANG['extension_missing'] = 'Lipsește extensia: ';
*/
$PHPMAILER_LANG['authenticate'] = 'Ошибка SMTP: ошибка авторизации.';
-$PHPMAILER_LANG['connect_host'] = 'Ошибка SMTP: не удается подключиться к серверу SMTP.';
+$PHPMAILER_LANG['connect_host'] = 'Ошибка SMTP: не удается подключиться к SMTP-серверу.';
$PHPMAILER_LANG['data_not_accepted'] = 'Ошибка SMTP: данные не приняты.';
-$PHPMAILER_LANG['encoding'] = 'Неизвестный вид кодировки: ';
+$PHPMAILER_LANG['encoding'] = 'Неизвестная кодировка: ';
$PHPMAILER_LANG['execute'] = 'Невозможно выполнить команду: ';
$PHPMAILER_LANG['file_access'] = 'Нет доступа к файлу: ';
-$PHPMAILER_LANG['file_open'] = 'Файловая ошибка: не удается открыть файл: ';
+$PHPMAILER_LANG['file_open'] = 'Файловая ошибка: не удаётся открыть файл: ';
$PHPMAILER_LANG['from_failed'] = 'Неверный адрес отправителя: ';
-$PHPMAILER_LANG['instantiate'] = 'Невозможно запустить функцию mail.';
-$PHPMAILER_LANG['provide_address'] = 'Пожалуйста, введите хотя бы один адрес e-mail получателя.';
+$PHPMAILER_LANG['instantiate'] = 'Невозможно запустить функцию mail().';
+$PHPMAILER_LANG['provide_address'] = 'Пожалуйста, введите хотя бы один email-адрес получателя.';
$PHPMAILER_LANG['mailer_not_supported'] = ' — почтовый сервер не поддерживается.';
-$PHPMAILER_LANG['recipients_failed'] = 'Ð\9eÑ\88ибка SMTP: оÑ\82пÑ\80авка по Ñ\81ледÑ\83Ñ\8eÑ\89им адÑ\80еÑ\81ам полÑ\83Ñ\87аÑ\82елей не Ñ\83далаÑ\81Ñ\8c: ';
+$PHPMAILER_LANG['recipients_failed'] = 'Ð\9eÑ\88ибка SMTP: не Ñ\83далаÑ\81Ñ\8c оÑ\82пÑ\80авка Ñ\82аким адÑ\80еÑ\81аÑ\82ам: ';
$PHPMAILER_LANG['empty_message'] = 'Пустое сообщение';
-$PHPMAILER_LANG['invalid_address'] = 'Ð\9dе оÑ\82оÑ\81лано, непÑ\80авилÑ\8cнÑ\8bй Ñ\84оÑ\80маÑ\82 email адреса: ';
+$PHPMAILER_LANG['invalid_address'] = 'Ð\9dе оÑ\82пÑ\80авлено из-за непÑ\80авилÑ\8cного Ñ\84оÑ\80маÑ\82а email-адреса: ';
$PHPMAILER_LANG['signing'] = 'Ошибка подписи: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'Ошибка соединения с SMTP-сервером';
$PHPMAILER_LANG['smtp_error'] = 'Ошибка SMTP-сервера: ';
-$PHPMAILER_LANG['variable_set'] = 'Невозможно установить или переустановить переменную: ';
+$PHPMAILER_LANG['variable_set'] = 'Невозможно установить или сбросить переменную: ';
$PHPMAILER_LANG['extension_missing'] = 'Расширение отсутствует: ';
* Slovak PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
* @author Michal Tinka <michaltinka@gmail.com>
+ * @author Peter Orlický <pcmanik91@gmail.com>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP Error: Chyba autentifikácie.';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() zlyhalo.';
$PHPMAILER_LANG['smtp_error'] = 'SMTP chyba serveru: ';
$PHPMAILER_LANG['variable_set'] = 'Nemožno nastaviť alebo resetovať premennú: ';
-//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
+$PHPMAILER_LANG['extension_missing'] = 'Chýba rozšírenie: ';
* Slovene PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
* @author Klemen Tušar <techouse@gmail.com>
+ * @author Filip Š <projects@filips.si>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP napaka: Avtentikacija ni uspela.';
-$PHPMAILER_LANG['connect_host'] = 'SMTP napaka: Ne morem vzpostaviti povezave s SMTP gostiteljem.';
+$PHPMAILER_LANG['connect_host'] = 'SMTP napaka: Vzpostavljanje povezave s SMTP gostiteljem ni uspelo.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP napaka: Strežnik zavrača podatke.';
$PHPMAILER_LANG['empty_message'] = 'E-poštno sporočilo nima vsebine.';
$PHPMAILER_LANG['encoding'] = 'Nepoznan tip kodiranja: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'Ne morem vzpostaviti povezave s SMTP strežnikom.';
$PHPMAILER_LANG['smtp_error'] = 'Napaka SMTP strežnika: ';
$PHPMAILER_LANG['variable_set'] = 'Ne morem nastaviti oz. ponastaviti spremenljivke: ';
-//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
+$PHPMAILER_LANG['extension_missing'] = 'Manjkajoča razširitev: ';
* Serbian PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
* @author Александар Јевремовић <ajevremovic@gmail.com>
+ * @author Miloš Milanović <mmilanovic016@gmail.com>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP грешка: аутентификација није успела.';
-$PHPMAILER_LANG['connect_host'] = 'SMTP гÑ\80еÑ\88ка: ниÑ\98е могÑ\83Ñ\9bе повезиваÑ\9aе Ñ\81а SMTP Ñ\81еÑ\80веÑ\80ом.';
+$PHPMAILER_LANG['connect_host'] = 'SMTP гÑ\80еÑ\88ка: повезиваÑ\9aе Ñ\81а SMTP Ñ\81еÑ\80веÑ\80ом ниÑ\98е Ñ\83Ñ\81пело.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP грешка: подаци нису прихваћени.';
$PHPMAILER_LANG['empty_message'] = 'Садржај поруке је празан.';
-$PHPMAILER_LANG['encoding'] = 'Ð\9dепознаÑ\82о кодовање: ';
+$PHPMAILER_LANG['encoding'] = 'Ð\9dепознаÑ\82о кодиÑ\80ање: ';
$PHPMAILER_LANG['execute'] = 'Није могуће извршити наредбу: ';
$PHPMAILER_LANG['file_access'] = 'Није могуће приступити датотеци: ';
$PHPMAILER_LANG['file_open'] = 'Није могуће отворити датотеку: ';
$PHPMAILER_LANG['from_failed'] = 'SMTP грешка: слање са следећих адреса није успело: ';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP грешка: слање на следеће адресе није успело: ';
$PHPMAILER_LANG['instantiate'] = 'Није могуће покренути mail функцију.';
-$PHPMAILER_LANG['invalid_address'] = 'Порука није послата због неисправне адресе: ';
+$PHPMAILER_LANG['invalid_address'] = 'Порука није послата. Неисправна адреса: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' мејлер није подржан.';
-$PHPMAILER_LANG['provide_address'] = 'Ð\9fоÑ\82Ñ\80ебно Ñ\98е задаÑ\82и наÑ\98маÑ\9aе Ñ\98еднÑ\83 адÑ\80еÑ\81Ñ\83.';
-$PHPMAILER_LANG['signing'] = 'Грешка приликом пријављивања: ';
+$PHPMAILER_LANG['provide_address'] = 'Ð\94еÑ\84иниÑ\88иÑ\82е баÑ\80 Ñ\98еднÑ\83 адÑ\80еÑ\81Ñ\83 пÑ\80имаоÑ\86а.';
+$PHPMAILER_LANG['signing'] = 'Грешка приликом пријаве: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'Повезивање са SMTP сервером није успело.';
$PHPMAILER_LANG['smtp_error'] = 'Грешка SMTP сервера: ';
-$PHPMAILER_LANG['variable_set'] = 'Ð\9dиÑ\98е могÑ\83Ñ\9bе задаÑ\82и пÑ\80оменÑ\99ивÑ\83, ниÑ\82и Ñ\98е вÑ\80аÑ\82иÑ\82и Ñ\83назад: ';
-//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
+$PHPMAILER_LANG['variable_set'] = 'Ð\9dиÑ\98е могÑ\83Ñ\9bе задаÑ\82и ниÑ\82и Ñ\80еÑ\81еÑ\82оваÑ\82и пÑ\80оменÑ\99ивÑ\83: ';
+$PHPMAILER_LANG['extension_missing'] = 'Недостаје проширење: ';
$PHPMAILER_LANG['file_open'] = 'Fil fel: Kunde inte öppna fil: ';
$PHPMAILER_LANG['from_failed'] = 'Följande avsändaradress är felaktig: ';
$PHPMAILER_LANG['instantiate'] = 'Kunde inte initiera e-postfunktion.';
-//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: ';
+$PHPMAILER_LANG['invalid_address'] = 'Felaktig adress: ';
$PHPMAILER_LANG['provide_address'] = 'Du måste ange minst en mottagares e-postadress.';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer stöds inte.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP fel: Följande mottagare är felaktig: ';
-//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
-//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
-//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
-//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
-//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
+$PHPMAILER_LANG['signing'] = 'Signerings fel: ';
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() misslyckades.';
+$PHPMAILER_LANG['smtp_error'] = 'SMTP server fel: ';
+$PHPMAILER_LANG['variable_set'] = 'Kunde inte definiera eller återställa variabel: ';
+$PHPMAILER_LANG['extension_missing'] = 'Tillägg ej tillgängligt: ';
--- /dev/null
+<?php
+/**
+ * Tagalog PHPMailer language file: refer to English translation for definitive list
+ *
+ * @package PHPMailer
+ * @author Adriane Justine Tan <adrianetan12@gmail.com>
+ */
+
+$PHPMAILER_LANG['authenticate'] = 'SMTP Error: Hindi mapatotohanan.';
+$PHPMAILER_LANG['connect_host'] = 'SMTP Error: Hindi makakonekta sa SMTP host.';
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: Ang datos ay hindi maaaring matatanggap.';
+$PHPMAILER_LANG['empty_message'] = 'Walang laman ang mensahe';
+$PHPMAILER_LANG['encoding'] = 'Hindi alam ang encoding: ';
+$PHPMAILER_LANG['execute'] = 'Hindi maisasagawa: ';
+$PHPMAILER_LANG['file_access'] = 'Hindi ma-access ang file: ';
+$PHPMAILER_LANG['file_open'] = 'Hindi mabuksan ang file: ';
+$PHPMAILER_LANG['from_failed'] = 'Ang sumusunod na address ay nabigo: ';
+$PHPMAILER_LANG['instantiate'] = 'Hindi maaaring magbigay ng institusyon ang mail';
+$PHPMAILER_LANG['invalid_address'] = 'Hindi wasto ang address na naibigay: ';
+$PHPMAILER_LANG['mailer_not_supported'] = 'Ang mailer ay hindi suportado';
+$PHPMAILER_LANG['provide_address'] = 'Kailangan mong magbigay ng kahit isang email address na tatanggap';
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: Ang mga sumusunod na tatanggap ay nabigo: ';
+$PHPMAILER_LANG['signing'] = 'Hindi ma-sign';
+$PHPMAILER_LANG['smtp_connect_failed'] = 'Ang SMTP connect() ay nabigo';
+$PHPMAILER_LANG['smtp_error'] = 'Ang server ng SMTP ay nabigo';
+$PHPMAILER_LANG['variable_set'] = 'Hindi matatakda ang mga variables: ';
+$PHPMAILER_LANG['extension_missing'] = 'Nawawala ang extension';
* @author Can Yılmaz
* @author Mehmet Benlioğlu
* @author @yasinaydin
+ * @author Ogün Karakuş
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP Hatası: Oturum açılamadı.';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP connect() fonksiyonu başarısız.';
$PHPMAILER_LANG['smtp_error'] = 'SMTP sunucu hatası: ';
$PHPMAILER_LANG['variable_set'] = 'Değişken ayarlanamadı ya da sıfırlanamadı: ';
-//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
+$PHPMAILER_LANG['extension_missing'] = 'Eklenti bulunamadı: ';
*/
$PHPMAILER_LANG['authenticate'] = 'Помилка SMTP: помилка авторизації.';
-$PHPMAILER_LANG['connect_host'] = 'Помилка SMTP: не вдається під\'єднатися до серверу SMTP.';
-$PHPMAILER_LANG['data_not_accepted'] = 'Помилка SMTP: дані не прийняті.';
-$PHPMAILER_LANG['encoding'] = 'Ð\9dевÑ\96домий Ñ\82ип кодування: ';
+$PHPMAILER_LANG['connect_host'] = 'Помилка SMTP: не вдається під\'єднатися до SMTP-серверу.';
+$PHPMAILER_LANG['data_not_accepted'] = 'Помилка SMTP: дані не прийнято.';
+$PHPMAILER_LANG['encoding'] = 'Ð\9dевÑ\96доме кодування: ';
$PHPMAILER_LANG['execute'] = 'Неможливо виконати команду: ';
$PHPMAILER_LANG['file_access'] = 'Немає доступу до файлу: ';
$PHPMAILER_LANG['file_open'] = 'Помилка файлової системи: не вдається відкрити файл: ';
$PHPMAILER_LANG['from_failed'] = 'Невірна адреса відправника: ';
-$PHPMAILER_LANG['instantiate'] = 'Неможливо запустити функцію mail.';
-$PHPMAILER_LANG['provide_address'] = 'Будь-ласка, введіть хоча б одну адресу e-mail отримувача.';
+$PHPMAILER_LANG['instantiate'] = 'Неможливо запустити функцію mail().';
+$PHPMAILER_LANG['provide_address'] = 'Будь-ласка, введіть хоча б одну email-адресу отримувача.';
$PHPMAILER_LANG['mailer_not_supported'] = ' - поштовий сервер не підтримується.';
-$PHPMAILER_LANG['recipients_failed'] = 'Ð\9fомилка SMTP: вÑ\96дпÑ\80авленнÑ\8f наÑ\81Ñ\82Ñ\83пним оÑ\82Ñ\80имÑ\83ваÑ\87ам не вдалоÑ\81Ñ\8f: ';
-$PHPMAILER_LANG['empty_message'] = 'Пусте тіло повідомлення';
-$PHPMAILER_LANG['invalid_address'] = 'Не відправлено, невірний формат адреси e-mail: ';
+$PHPMAILER_LANG['recipients_failed'] = 'Ð\9fомилка SMTP: не вдалоÑ\81Ñ\8f вÑ\96дпÑ\80авленнÑ\8f длÑ\8f Ñ\82акиÑ\85 оÑ\82Ñ\80имÑ\83ваÑ\87Ñ\96в: ';
+$PHPMAILER_LANG['empty_message'] = 'Пусте повідомлення';
+$PHPMAILER_LANG['invalid_address'] = 'Не відправлено через невірний формат email-адреси: ';
$PHPMAILER_LANG['signing'] = 'Помилка підпису: ';
-$PHPMAILER_LANG['smtp_connect_failed'] = 'Помилка з\'єднання із SMTP-сервером';
+$PHPMAILER_LANG['smtp_connect_failed'] = 'Помилка з\'єднання з SMTP-сервером';
$PHPMAILER_LANG['smtp_error'] = 'Помилка SMTP-сервера: ';
-$PHPMAILER_LANG['variable_set'] = 'Неможливо встановити або перевстановити змінну: ';
-//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
+$PHPMAILER_LANG['variable_set'] = 'Неможливо встановити або скинути змінну: ';
+$PHPMAILER_LANG['extension_missing'] = 'Розширення відсутнє: ';
* @package PHPMailer
* @author liqwei <liqwei@liqwei.com>
* @author young <masxy@foxmail.com>
+ * @author Teddysun <i@teddysun.com>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP 错误:登录失败。';
$PHPMAILER_LANG['connect_host'] = 'SMTP 错误:无法连接到 SMTP 主机。';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误:数据不被接受。';
$PHPMAILER_LANG['empty_message'] = '邮件正文为空。';
-$PHPMAILER_LANG['encoding'] = '未知编码: ';
+$PHPMAILER_LANG['encoding'] = '未知编码:';
$PHPMAILER_LANG['execute'] = '无法执行:';
$PHPMAILER_LANG['file_access'] = '无法访问文件:';
$PHPMAILER_LANG['file_open'] = '文件错误:无法打开文件:';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误:收件人地址错误:';
$PHPMAILER_LANG['signing'] = '登录失败:';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP服务器连接失败。';
-$PHPMAILER_LANG['smtp_error'] = 'SMTP服务器出错: ';
+$PHPMAILER_LANG['smtp_error'] = 'SMTP服务器出错:';
$PHPMAILER_LANG['variable_set'] = '无法设置或重置变量:';
-//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
+$PHPMAILER_LANG['extension_missing'] = '丢失模块 Extension:';
--- /dev/null
+<?php
+/**
+ * PHPMailer Exception class.
+ * PHP Version 5.5.
+ *
+ * @see 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 - 2017 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.
+ */
+
+namespace PHPMailer\PHPMailer;
+
+/**
+ * PHPMailer exception handler.
+ *
+ * @author Marcus Bointon <phpmailer@synchromedia.co.uk>
+ */
+class Exception extends \Exception
+{
+ /**
+ * Prettify error message output.
+ *
+ * @return string
+ */
+ public function errorMessage()
+ {
+ return '<strong>' . htmlspecialchars($this->getMessage()) . "</strong><br />\n";
+ }
+}
--- /dev/null
+<?php
+/**
+ * PHPMailer - PHP email creation and transport class.
+ * PHP Version 5.5.
+ *
+ * @see 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 - 2015 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.
+ */
+
+namespace PHPMailer\PHPMailer;
+
+use League\OAuth2\Client\Grant\RefreshToken;
+use League\OAuth2\Client\Provider\AbstractProvider;
+use League\OAuth2\Client\Token\AccessToken;
+
+/**
+ * OAuth - OAuth2 authentication wrapper class.
+ * Uses the oauth2-client package from the League of Extraordinary Packages.
+ *
+ * @see http://oauth2-client.thephpleague.com
+ *
+ * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
+ */
+class OAuth
+{
+ /**
+ * An instance of the League OAuth Client Provider.
+ *
+ * @var AbstractProvider
+ */
+ protected $provider;
+
+ /**
+ * The current OAuth access token.
+ *
+ * @var AccessToken
+ */
+ protected $oauthToken;
+
+ /**
+ * The user's email address, usually used as the login ID
+ * and also the from address when sending email.
+ *
+ * @var string
+ */
+ protected $oauthUserEmail = '';
+
+ /**
+ * The client secret, generated in the app definition of the service you're connecting to.
+ *
+ * @var string
+ */
+ protected $oauthClientSecret = '';
+
+ /**
+ * The client ID, generated in the app definition of the service you're connecting to.
+ *
+ * @var string
+ */
+ protected $oauthClientId = '';
+
+ /**
+ * The refresh token, used to obtain new AccessTokens.
+ *
+ * @var string
+ */
+ protected $oauthRefreshToken = '';
+
+ /**
+ * OAuth constructor.
+ *
+ * @param array $options Associative array containing
+ * `provider`, `userName`, `clientSecret`, `clientId` and `refreshToken` elements
+ */
+ public function __construct($options)
+ {
+ $this->provider = $options['provider'];
+ $this->oauthUserEmail = $options['userName'];
+ $this->oauthClientSecret = $options['clientSecret'];
+ $this->oauthClientId = $options['clientId'];
+ $this->oauthRefreshToken = $options['refreshToken'];
+ }
+
+ /**
+ * Get a new RefreshToken.
+ *
+ * @return RefreshToken
+ */
+ protected function getGrant()
+ {
+ return new RefreshToken();
+ }
+
+ /**
+ * Get a new AccessToken.
+ *
+ * @return AccessToken
+ */
+ protected function getToken()
+ {
+ return $this->provider->getAccessToken(
+ $this->getGrant(),
+ ['refresh_token' => $this->oauthRefreshToken]
+ );
+ }
+
+ /**
+ * Generate a base64-encoded OAuth token.
+ *
+ * @return string
+ */
+ public function getOauth64()
+ {
+ // Get a new token if it's not available or has expired
+ if (null === $this->oauthToken || $this->oauthToken->hasExpired()) {
+ $this->oauthToken = $this->getToken();
+ }
+
+ return base64_encode(
+ 'user=' .
+ $this->oauthUserEmail .
+ "\001auth=Bearer " .
+ $this->oauthToken .
+ "\001\001"
+ );
+ }
+}
<?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
+ * PHP Version 5.5.
+ *
+ * @see 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 - 2019 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
+ * @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.
*/
+namespace PHPMailer\PHPMailer;
+
/**
* 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>
*/
class PHPMailer
{
- /**
- * The PHPMailer Version number.
- * @var string
- */
- public $Version = '5.2.16';
+ const CHARSET_ASCII = 'us-ascii';
+ const CHARSET_ISO88591 = 'iso-8859-1';
+ const CHARSET_UTF8 = 'utf-8';
+
+ const CONTENT_TYPE_PLAINTEXT = 'text/plain';
+ const CONTENT_TYPE_TEXT_CALENDAR = 'text/calendar';
+ const CONTENT_TYPE_TEXT_HTML = 'text/html';
+ const CONTENT_TYPE_MULTIPART_ALTERNATIVE = 'multipart/alternative';
+ const CONTENT_TYPE_MULTIPART_MIXED = 'multipart/mixed';
+ const CONTENT_TYPE_MULTIPART_RELATED = 'multipart/related';
+
+ const ENCODING_7BIT = '7bit';
+ const ENCODING_8BIT = '8bit';
+ const ENCODING_BASE64 = 'base64';
+ const ENCODING_BINARY = 'binary';
+ const ENCODING_QUOTED_PRINTABLE = 'quoted-printable';
+
+ const ENCRYPTION_STARTTLS = 'tls';
+ const ENCRYPTION_SMTPS = 'ssl';
+
+ const ICAL_METHOD_REQUEST = 'REQUEST';
+ const ICAL_METHOD_PUBLISH = 'PUBLISH';
+ const ICAL_METHOD_REPLY = 'REPLY';
+ const ICAL_METHOD_ADD = 'ADD';
+ const ICAL_METHOD_CANCEL = 'CANCEL';
+ const ICAL_METHOD_REFRESH = 'REFRESH';
+ const ICAL_METHOD_COUNTER = 'COUNTER';
+ const ICAL_METHOD_DECLINECOUNTER = 'DECLINECOUNTER';
/**
* Email priority.
* Options: null (default), 1 = High, 3 = Normal, 5 = low.
* When null, the header is not set at all.
- * @var integer
+ *
+ * @var int
*/
- public $Priority = null;
+ public $Priority;
/**
* The character set of the message.
+ *
* @var string
*/
- public $CharSet = 'iso-8859-1';
+ public $CharSet = self::CHARSET_ISO88591;
/**
* The MIME Content-type of the message.
+ *
* @var string
*/
- public $ContentType = 'text/plain';
+ public $ContentType = self::CONTENT_TYPE_PLAINTEXT;
/**
* The message encoding.
* Options: "8bit", "7bit", "binary", "base64", and "quoted-printable".
+ *
* @var string
*/
- public $Encoding = '8bit';
+ public $Encoding = self::ENCODING_8BIT;
/**
* Holds the most recent mailer error message.
+ *
* @var string
*/
public $ErrorInfo = '';
/**
* The From email address for the message.
+ *
* @var string
*/
public $From = 'root@localhost';
/**
* The From name of the message.
+ *
* @var 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.
+ * The envelope sender of the message.
+ * This will usually be turned into a Return-Path header by the receiver,
+ * and is the address that bounces will be sent to.
+ * If not empty, will be passed via `-f` to sendmail or as the 'MAIL FROM' value over SMTP.
+ *
* @var string
*/
public $Sender = '';
- /**
- * The Return-Path of the message.
- * If empty, it will be set to either From or Sender.
- * @var 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.
+ *
* @var string
*/
public $Subject = '';
/**
* An HTML or plain text message body.
* If HTML then call isHTML(true).
+ *
* @var string
*/
public $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.
+ *
* @var 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/
+ * To generate iCal event structures, use classes like EasyPeasyICS or iCalcreator.
+ *
+ * @see http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/
+ * @see http://kigkonsult.se/iCalcreator/
+ *
* @var string
*/
public $Ical = '';
+ /**
+ * Value-array of "method" in Contenttype header "text/calendar"
+ *
+ * @var string[]
+ */
+ protected static $IcalMethods = [
+ self::ICAL_METHOD_REQUEST,
+ self::ICAL_METHOD_PUBLISH,
+ self::ICAL_METHOD_REPLY,
+ self::ICAL_METHOD_ADD,
+ self::ICAL_METHOD_CANCEL,
+ self::ICAL_METHOD_REFRESH,
+ self::ICAL_METHOD_COUNTER,
+ self::ICAL_METHOD_DECLINECOUNTER,
+ ];
+
/**
* The complete compiled MIME message body.
- * @access protected
+ *
* @var string
*/
protected $MIMEBody = '';
/**
* The complete compiled MIME message headers.
+ *
* @var string
- * @access protected
*/
protected $MIMEHeader = '';
/**
* Extra headers that createHeader() doesn't fold in.
+ *
* @var 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.
- * @var integer
+ *
+ * @see static::STD_LINE_LENGTH
+ *
+ * @var int
*/
public $WordWrap = 0;
/**
* Which method to use to send mail.
* Options: "mail", "sendmail", or "smtp".
+ *
* @var string
*/
public $Mailer = 'mail';
/**
* The path to the sendmail program.
+ *
* @var string
*/
public $Sendmail = '/usr/sbin/sendmail';
/**
* Whether mail() uses a fully sendmail-compatible MTA.
* One which supports sendmail's "-oi -f" options.
- * @var boolean
+ *
+ * @var bool
*/
public $UseSendmailOptions = true;
- /**
- * Path to PHPMailer plugins.
- * Useful if the SMTP class is not in the PHP include path.
- * @var string
- * @deprecated Should not be needed now there is an autoloader.
- */
- public $PluginDir = '';
-
/**
* The email address that a reading confirmation should be sent to, also known as read receipt.
+ *
* @var string
*/
public $ConfirmReadingTo = '';
* If empty, PHPMailer attempts to find one with, in order,
* $_SERVER['SERVER_NAME'], gethostname(), php_uname('n'), or the value
* 'localhost.localdomain'.
+ *
+ * @see PHPMailer::$Helo
+ *
* @var string
*/
public $Hostname = '';
/**
* An ID to be used in the Message-ID header.
* If empty, a unique id will be generated.
+ * You can set your own, but it must be in the format "<id@domain>",
+ * as defined in RFC5322 section 3.6.4 or it will be ignored.
+ *
+ * @see https://tools.ietf.org/html/rfc5322#section-3.6.4
+ *
* @var string
*/
public $MessageID = '';
/**
* The message Date to be used in the Date header.
* If empty, the current date will be added.
+ *
* @var string
*/
public $MessageDate = '';
* 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.
+ *
* @var string
*/
public $Host = 'localhost';
/**
* The default SMTP server port.
- * @var integer
- * @TODO Why is this needed when the SMTP class takes care of it?
+ *
+ * @var int
*/
public $Port = 25;
/**
- * The SMTP HELO of the message.
+ * The SMTP HELO/EHLO name used for the SMTP connection.
* Default is $Hostname. If $Hostname is empty, PHPMailer attempts to find
* one with the same method described above for $Hostname.
- * @var string
+ *
* @see PHPMailer::$Hostname
+ *
+ * @var string
*/
public $Helo = '';
/**
* What kind of encryption to use on the SMTP connection.
- * Options: '', 'ssl' or 'tls'
+ * Options: '', static::ENCRYPTION_STARTTLS, or static::ENCRYPTION_SMTPS.
+ *
* @var 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.
- * @var boolean
+ *
+ * @var bool
*/
public $SMTPAutoTLS = true;
/**
* Whether to use SMTP authentication.
* Uses the Username and Password properties.
- * @var boolean
+ *
* @see PHPMailer::$Username
* @see PHPMailer::$Password
+ *
+ * @var bool
*/
public $SMTPAuth = false;
/**
* Options array passed to stream_context_create when connecting via SMTP.
+ *
* @var array
*/
- public $SMTPOptions = array();
+ public $SMTPOptions = [];
/**
* SMTP username.
+ *
* @var string
*/
public $Username = '';
/**
* SMTP password.
+ *
* @var string
*/
public $Password = '';
/**
* SMTP auth type.
- * Options are CRAM-MD5, LOGIN, PLAIN, NTLM, XOAUTH2, attempted in that order if not specified
+ * Options are CRAM-MD5, LOGIN, PLAIN, XOAUTH2, attempted in that order if not specified.
+ *
* @var string
*/
public $AuthType = '';
/**
- * SMTP realm.
- * Used for NTLM auth
- * @var string
+ * An instance of the PHPMailer OAuth class.
+ *
+ * @var OAuth
*/
- public $Realm = '';
+ protected $oauth;
/**
- * SMTP workstation.
- * Used for NTLM auth
- * @var string
+ * The SMTP server timeout in seconds.
+ * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2.
+ *
+ * @var int
*/
- public $Workstation = '';
+ public $Timeout = 300;
/**
- * The SMTP server timeout in seconds.
- * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
- * @var integer
+ * Comma separated list of DSN notifications
+ * 'NEVER' under no circumstances a DSN must be returned to the sender.
+ * If you use NEVER all other notifications will be ignored.
+ * 'SUCCESS' will notify you when your mail has arrived at its destination.
+ * 'FAILURE' will arrive if an error occurred during delivery.
+ * 'DELAY' will notify you if there is an unusual delay in delivery, but the actual
+ * delivery's outcome (success or failure) is not yet decided.
+ *
+ * @see https://tools.ietf.org/html/rfc3461 See section 4.1 for more information about NOTIFY
*/
- public $Timeout = 300;
+ public $dsn = '';
/**
* 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
- * @var integer
+ * * SMTP::DEBUG_OFF: No output
+ * * SMTP::DEBUG_CLIENT: Client messages
+ * * SMTP::DEBUG_SERVER: Client and server messages
+ * * SMTP::DEBUG_CONNECTION: As SERVER plus connection status
+ * * SMTP::DEBUG_LOWLEVEL: Noisy, low-level data output, rarely needed
+ *
* @see SMTP::$do_debug
+ *
+ * @var int
*/
public $SMTPDebug = 0;
* * `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
- *
+ * By default PHPMailer will use `echo` if run from a `cli` or `cli-server` SAPI, `html` otherwise.
* Alternatively, you can provide a callable expecting two params: a message string and the debug level:
- * <code>
+ *
+ * ```php
* $mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
- * </code>
- * @var string|callable
+ * ```
+ *
+ * Alternatively, you can pass in an instance of a PSR-3 compatible logger, though only `debug`
+ * level output is used:
+ *
+ * ```php
+ * $mail->Debugoutput = new myPsr3Logger;
+ * ```
+ *
* @see SMTP::$Debugoutput
+ *
+ * @var string|callable|\Psr\Log\LoggerInterface
*/
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().
- * @var boolean
+ *
+ * @var bool
*/
public $SMTPKeepAlive = false;
* Whether to split multiple to addresses into multiple messages
* or send them all in one message.
* Only supported in `mail` and `sendmail` transports, not in SMTP.
- * @var boolean
+ *
+ * @var bool
*/
public $SingleTo = false;
/**
* Storage for addresses when SingleTo is enabled.
+ *
* @var array
- * @TODO This should really not be public
*/
- public $SingleToArray = array();
+ protected $SingleToArray = [];
/**
* 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
- * @var boolean
+ *
+ * @see https://en.wikipedia.org/wiki/Variable_envelope_return_path
+ * @see http://www.postfix.org/VERP_README.html Postfix VERP info
+ *
+ * @var bool
*/
public $do_verp = false;
/**
* Whether to allow sending messages with an empty body.
- * @var boolean
+ *
+ * @var bool
*/
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.
- * @var string
- */
- public $LE = "\n";
-
/**
* DKIM selector.
+ *
* @var string
*/
public $DKIM_selector = '';
/**
* DKIM Identity.
* Usually the email address used as the source of the email.
+ *
* @var string
*/
public $DKIM_identity = '';
/**
* DKIM passphrase.
* Used if your key is encrypted.
+ *
* @var string
*/
public $DKIM_passphrase = '';
/**
* DKIM signing domain name.
+ *
* @example 'example.com'
+ *
* @var string
*/
public $DKIM_domain = '';
+ /**
+ * DKIM Copy header field values for diagnostic use.
+ *
+ * @var bool
+ */
+ public $DKIM_copyHeaderFields = true;
+
+ /**
+ * DKIM Extra signing headers.
+ *
+ * @example ['List-Unsubscribe', 'List-Help']
+ *
+ * @var array
+ */
+ public $DKIM_extraHeaders = [];
+
/**
* DKIM private key file path.
+ *
* @var string
*/
public $DKIM_private = '';
+ /**
+ * DKIM private key string.
+ *
+ * If set, takes precedence over `$DKIM_private`.
+ *
+ * @var string
+ */
+ public $DKIM_private_string = '';
+
/**
* Callback Action function name.
*
* 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
+ * bool $result result of the send action
+ * array $to email addresses of the recipients
+ * array $cc cc email addresses
+ * array $bcc bcc email addresses
* string $subject the subject
* string $body the email body
* string $from email address of sender
+ * string $extra extra information of possible use
+ * "smtp_transaction_id' => last smtp transaction id
+ *
* @var 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
- * @var string
+ * Options: An empty string for PHPMailer default, whitespace/null for none, or a string to use.
+ *
+ * @var string|null
*/
public $XMailer = '';
/**
* Which validator to use by default when validating email addresses.
* May be a callable to inject your own validator, but there are several built-in validators.
+ * The default validator uses PHP's FILTER_VALIDATE_EMAIL filter_var option.
+ *
* @see PHPMailer::validateAddress()
+ *
* @var string|callable
- * @static
*/
- public static $validator = 'auto';
+ public static $validator = 'php';
/**
* An instance of the SMTP sender class.
+ *
* @var SMTP
- * @access protected
*/
- protected $smtp = null;
+ protected $smtp;
/**
* The array of 'to' names and addresses.
+ *
* @var array
- * @access protected
*/
- protected $to = array();
+ protected $to = [];
/**
* The array of 'cc' names and addresses.
+ *
* @var array
- * @access protected
*/
- protected $cc = array();
+ protected $cc = [];
/**
* The array of 'bcc' names and addresses.
+ *
* @var array
- * @access protected
*/
- protected $bcc = array();
+ protected $bcc = [];
/**
* The array of reply-to names and addresses.
+ *
* @var array
- * @access protected
*/
- protected $ReplyTo = array();
+ protected $ReplyTo = [];
/**
* An array of all kinds of addresses.
- * Includes all of $to, $cc, $bcc
+ * Includes all of $to, $cc, $bcc.
+ *
+ * @see PHPMailer::$to
+ * @see PHPMailer::$cc
+ * @see PHPMailer::$bcc
+ *
* @var array
- * @access protected
- * @see PHPMailer::$to @see PHPMailer::$cc @see PHPMailer::$bcc
*/
- protected $all_recipients = array();
+ protected $all_recipients = [];
/**
* An array of names and addresses queued for validation.
* 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.
- * @var array
- * @access protected
- * @see PHPMailer::$to @see PHPMailer::$cc @see PHPMailer::$bcc
+ *
+ * @see PHPMailer::$to
+ * @see PHPMailer::$cc
+ * @see PHPMailer::$bcc
* @see PHPMailer::$all_recipients
+ *
+ * @var array
*/
- protected $RecipientsQueue = array();
+ protected $RecipientsQueue = [];
/**
* An array of reply-to names and addresses queued for validation.
* In send(), valid and non duplicate entries are moved to $ReplyTo.
* This array is used only for addresses with IDN.
- * @var array
- * @access protected
+ *
* @see PHPMailer::$ReplyTo
+ *
+ * @var array
*/
- protected $ReplyToQueue = array();
+ protected $ReplyToQueue = [];
/**
* The array of attachments.
+ *
* @var array
- * @access protected
*/
- protected $attachment = array();
+ protected $attachment = [];
/**
* The array of custom headers.
+ *
* @var array
- * @access protected
*/
- protected $CustomHeader = array();
+ protected $CustomHeader = [];
/**
* The most recent Message-ID (including angular brackets).
+ *
* @var string
- * @access protected
*/
protected $lastMessageID = '';
/**
* The message's MIME type.
+ *
* @var string
- * @access protected
*/
protected $message_type = '';
/**
* The array of MIME boundary strings.
+ *
* @var array
- * @access protected
*/
- protected $boundary = array();
+ protected $boundary = [];
/**
* The array of available languages.
+ *
* @var array
- * @access protected
*/
- protected $language = array();
+ protected $language = [];
/**
* The number of errors encountered.
- * @var integer
- * @access protected
+ *
+ * @var int
*/
protected $error_count = 0;
/**
* The S/MIME certificate file path.
+ *
* @var string
- * @access protected
*/
protected $sign_cert_file = '';
/**
* The S/MIME key file path.
+ *
* @var string
- * @access protected
*/
protected $sign_key_file = '';
/**
* The optional S/MIME extra certificates ("CA Chain") file path.
+ *
* @var string
- * @access protected
*/
protected $sign_extracerts_file = '';
/**
* The S/MIME password for the key.
* Used only if the key is encrypted.
+ *
* @var string
- * @access protected
*/
protected $sign_key_pass = '';
/**
* Whether to throw exceptions for errors.
- * @var boolean
- * @access protected
+ *
+ * @var bool
*/
protected $exceptions = false;
/**
* Unique ID used for message ID and boundaries.
+ *
* @var string
- * @access protected
*/
protected $uniqueid = '';
+ /**
+ * The PHPMailer Version number.
+ *
+ * @var string
+ */
+ const VERSION = '6.1.4';
+
/**
* Error severity: message only, continue processing.
+ *
+ * @var int
*/
const STOP_MESSAGE = 0;
/**
* Error severity: message, likely ok to continue processing.
+ *
+ * @var int
*/
const STOP_CONTINUE = 1;
/**
* Error severity: message, plus full stop, critical error reached.
+ *
+ * @var int
*/
const STOP_CRITICAL = 2;
/**
* SMTP RFC standard line ending.
+ *
+ * @var string
+ */
+ protected static $LE = "\r\n";
+
+ /**
+ * The maximum line length supported by mail().
+ *
+ * Background: mail() will sometimes corrupt messages
+ * with headers headers longer than 65 chars, see #818.
+ *
+ * @var int
*/
- const CRLF = "\r\n";
+ const MAIL_MAX_LINE_LENGTH = 63;
/**
- * The maximum line length allowed by RFC 2822 section 2.1.1
- * @var integer
+ * The maximum line length allowed by RFC 2822 section 2.1.1.
+ *
+ * @var int
*/
const MAX_LINE_LENGTH = 998;
+ /**
+ * The lower maximum line length allowed by RFC 2822 section 2.1.1.
+ * This length does NOT include the line break
+ * 76 means that lines will be 77 or 78 chars depending on whether
+ * the line break format is LF or CRLF; both are valid.
+ *
+ * @var int
+ */
+ const STD_LINE_LENGTH = 76;
+
/**
* Constructor.
- * @param boolean $exceptions Should we throw external exceptions?
+ *
+ * @param bool $exceptions Should we throw external exceptions?
*/
public function __construct($exceptions = null)
{
- if ($exceptions !== null) {
- $this->exceptions = (boolean)$exceptions;
+ if (null !== $exceptions) {
+ $this->exceptions = (bool) $exceptions;
}
+ //Pick an appropriate debug output format automatically
+ $this->Debugoutput = (strpos(PHP_SAPI, 'cli') !== false ? 'echo' : 'html');
}
/**
* 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 string $to To
- * @param string $subject Subject
- * @param string $body Message Body
- * @param string $header Additional Header(s)
- * @param string $params Params
- * @access private
- * @return boolean
+ * 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|null $params Params
+ *
+ * @return bool
*/
private function mailPassthru($to, $subject, $body, $header, $params)
{
} else {
$subject = $this->encodeHeader($this->secureHeader($subject));
}
- //Can't use additional_parameters in safe_mode
- //@link http://php.net/manual/en/function.mail.php
- if (ini_get('safe_mode') or !$this->UseSendmailOptions) {
+ //Calling mail() with null params breaks
+ if (!$this->UseSendmailOptions || null === $params) {
$result = @mail($to, $subject, $body, $header);
} else {
$result = @mail($to, $subject, $body, $header, $params);
}
+
return $result;
}
/**
* Output debugging info via user-defined method.
* Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug).
+ *
* @see PHPMailer::$Debugoutput
* @see PHPMailer::$SMTPDebug
+ *
* @param string $str
*/
protected function edebug($str)
if ($this->SMTPDebug <= 0) {
return;
}
+ //Is this a PSR-3 logger?
+ if ($this->Debugoutput instanceof \Psr\Log\LoggerInterface) {
+ $this->Debugoutput->debug($str);
+
+ return;
+ }
//Avoid clash with built-in function names
- if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
+ if (is_callable($this->Debugoutput) && !in_array($this->Debugoutput, ['error_log', 'html', 'echo'])) {
call_user_func($this->Debugoutput, $str, $this->SMTPDebug);
+
return;
}
switch ($this->Debugoutput) {
preg_replace('/[\r\n]+/', '', $str),
ENT_QUOTES,
'UTF-8'
- )
- . "<br>\n";
+ ), "<br>\n";
break;
case 'echo':
default:
//Normalize line breaks
- $str = preg_replace('/\r\n?/ms', "\n", $str);
- echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
- "\n",
- "\n \t ",
- trim($str)
- ) . "\n";
+ $str = preg_replace('/\r\n|\r/m', "\n", $str);
+ echo gmdate('Y-m-d H:i:s'),
+ "\t",
+ //Trim trailing space
+ trim(
+ //Indent for readability, except for trailing break
+ str_replace(
+ "\n",
+ "\n \t ",
+ trim($str)
+ )
+ ),
+ "\n";
}
}
/**
* Sets message type to HTML or plain.
- * @param boolean $isHtml True for HTML mode.
- * @return void
+ *
+ * @param bool $isHtml True for HTML mode
*/
public function isHTML($isHtml = true)
{
if ($isHtml) {
- $this->ContentType = 'text/html';
+ $this->ContentType = static::CONTENT_TYPE_TEXT_HTML;
} else {
- $this->ContentType = 'text/plain';
+ $this->ContentType = static::CONTENT_TYPE_PLAINTEXT;
}
}
/**
* Send messages using SMTP.
- * @return void
*/
public function isSMTP()
{
/**
* Send messages using PHP's mail() function.
- * @return void
*/
public function isMail()
{
/**
* Send messages using $Sendmail.
- * @return void
*/
public function isSendmail()
{
$ini_sendmail_path = ini_get('sendmail_path');
- if (!stristr($ini_sendmail_path, 'sendmail')) {
+ if (false === stripos($ini_sendmail_path, 'sendmail')) {
$this->Sendmail = '/usr/sbin/sendmail';
} else {
$this->Sendmail = $ini_sendmail_path;
/**
* Send messages using qmail.
- * @return void
*/
public function isQmail()
{
$ini_sendmail_path = ini_get('sendmail_path');
- if (!stristr($ini_sendmail_path, 'qmail')) {
+ if (false === stripos($ini_sendmail_path, 'qmail')) {
$this->Sendmail = '/var/qmail/bin/qmail-inject';
} else {
$this->Sendmail = $ini_sendmail_path;
/**
* Add a "To" address.
+ *
* @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
+ *
+ * @throws Exception
+ *
+ * @return bool true on success, false if address already used or invalid in some way
*/
public function addAddress($address, $name = '')
{
/**
* Add a "CC" address.
- * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
+ *
* @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
+ *
+ * @throws Exception
+ *
+ * @return bool true on success, false if address already used or invalid in some way
*/
public function addCC($address, $name = '')
{
/**
* Add a "BCC" address.
- * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
+ *
* @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
+ *
+ * @throws Exception
+ *
+ * @return bool true on success, false if address already used or invalid in some way
*/
public function addBCC($address, $name = '')
{
/**
* Add a "Reply-To" address.
+ *
* @param string $address The email address to reply to
* @param string $name
- * @return boolean true on success, false if address already used or invalid in some way
+ *
+ * @throws Exception
+ *
+ * @return bool true on success, false if address already used or invalid in some way
*/
public function addReplyTo($address, $name = '')
{
* 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 string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo'
+ *
+ * @param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo'
* @param string $address The email address to send, resp. to reply to
* @param string $name
- * @throws phpmailerException
- * @return boolean true on success, false if address already used or invalid in some way
- * @access protected
+ *
+ * @throws Exception
+ *
+ * @return bool true on success, false if address already used or invalid in some way
*/
protected function addOrEnqueueAnAddress($kind, $address, $name)
{
$address = trim($address);
$name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
- if (($pos = strrpos($address, '@')) === false) {
- // At-sign is misssing.
- $error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address";
+ $pos = strrpos($address, '@');
+ if (false === $pos) {
+ // At-sign is missing.
+ $error_message = sprintf(
+ '%s (%s): %s',
+ $this->lang('invalid_address'),
+ $kind,
+ $address
+ );
$this->setError($error_message);
$this->edebug($error_message);
if ($this->exceptions) {
- throw new phpmailerException($error_message);
+ throw new Exception($error_message);
}
+
return false;
}
- $params = array($kind, $address, $name);
+ $params = [$kind, $address, $name];
// Enqueue addresses with IDN until we know the PHPMailer::$CharSet.
- if ($this->has8bitChars(substr($address, ++$pos)) and $this->idnSupported()) {
- if ($kind != 'Reply-To') {
+ if (static::idnSupported() && $this->has8bitChars(substr($address, ++$pos))) {
+ if ('Reply-To' !== $kind) {
if (!array_key_exists($address, $this->RecipientsQueue)) {
$this->RecipientsQueue[$address] = $params;
+
return true;
}
- } else {
- if (!array_key_exists($address, $this->ReplyToQueue)) {
- $this->ReplyToQueue[$address] = $params;
- return true;
- }
+ } elseif (!array_key_exists($address, $this->ReplyToQueue)) {
+ $this->ReplyToQueue[$address] = $params;
+
+ return true;
}
+
return false;
}
+
// Immediately add standard addresses without IDN.
- return call_user_func_array(array($this, 'addAnAddress'), $params);
+ return call_user_func_array([$this, 'addAnAddress'], $params);
}
/**
* 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 string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo'
+ *
+ * @param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo'
* @param string $address The email address to send, resp. to reply to
* @param string $name
- * @throws phpmailerException
- * @return boolean true on success, false if address already used or invalid in some way
- * @access protected
+ *
+ * @throws Exception
+ *
+ * @return bool true on success, false if address already used or invalid in some way
*/
protected function addAnAddress($kind, $address, $name = '')
{
- if (!in_array($kind, array('to', 'cc', 'bcc', 'Reply-To'))) {
- $error_message = $this->lang('Invalid recipient kind: ') . $kind;
+ if (!in_array($kind, ['to', 'cc', 'bcc', 'Reply-To'])) {
+ $error_message = sprintf(
+ '%s: %s',
+ $this->lang('Invalid recipient kind'),
+ $kind
+ );
$this->setError($error_message);
$this->edebug($error_message);
if ($this->exceptions) {
- throw new phpmailerException($error_message);
+ throw new Exception($error_message);
}
+
return false;
}
- if (!$this->validateAddress($address)) {
- $error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address";
+ if (!static::validateAddress($address)) {
+ $error_message = sprintf(
+ '%s (%s): %s',
+ $this->lang('invalid_address'),
+ $kind,
+ $address
+ );
$this->setError($error_message);
$this->edebug($error_message);
if ($this->exceptions) {
- throw new phpmailerException($error_message);
+ throw new Exception($error_message);
}
+
return false;
}
- if ($kind != 'Reply-To') {
+ if ('Reply-To' !== $kind) {
if (!array_key_exists(strtolower($address), $this->all_recipients)) {
- array_push($this->$kind, array($address, $name));
+ $this->{$kind}[] = [$address, $name];
$this->all_recipients[strtolower($address)] = true;
+
return true;
}
- } else {
- if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
- $this->ReplyTo[strtolower($address)] = array($address, $name);
- return true;
- }
+ } elseif (!array_key_exists(strtolower($address), $this->ReplyTo)) {
+ $this->ReplyTo[strtolower($address)] = [$address, $name];
+
+ return true;
}
+
return false;
}
* 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.
+ *
+ * @see http://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation
+ *
* @param string $addrstr The address list string
- * @param bool $useimap Whether to use the IMAP extension to parse the list
+ * @param bool $useimap Whether to use the IMAP extension to parse the list
+ *
* @return array
- * @link http://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation
*/
- public function parseAddresses($addrstr, $useimap = true)
+ public static function parseAddresses($addrstr, $useimap = true)
{
- $addresses = array();
- if ($useimap and function_exists('imap_rfc822_parse_adrlist')) {
+ $addresses = [];
+ if ($useimap && function_exists('imap_rfc822_parse_adrlist')) {
//Use this built-in parser if it's available
$list = imap_rfc822_parse_adrlist($addrstr, '');
foreach ($list as $address) {
- if ($address->host != '.SYNTAX-ERROR.') {
- if ($this->validateAddress($address->mailbox . '@' . $address->host)) {
- $addresses[] = array(
- 'name' => (property_exists($address, 'personal') ? $address->personal : ''),
- 'address' => $address->mailbox . '@' . $address->host
- );
- }
+ if (('.SYNTAX-ERROR.' !== $address->host) && static::validateAddress(
+ $address->mailbox . '@' . $address->host
+ )) {
+ $addresses[] = [
+ 'name' => (property_exists($address, 'personal') ? $address->personal : ''),
+ 'address' => $address->mailbox . '@' . $address->host,
+ ];
}
}
} else {
//Is there a separate name part?
if (strpos($address, '<') === false) {
//No separate name, just use the whole thing
- if ($this->validateAddress($address)) {
- $addresses[] = array(
+ if (static::validateAddress($address)) {
+ $addresses[] = [
'name' => '',
- 'address' => $address
- );
+ 'address' => $address,
+ ];
}
} else {
list($name, $email) = explode('<', $address);
$email = trim(str_replace('>', '', $email));
- if ($this->validateAddress($email)) {
- $addresses[] = array(
- 'name' => trim(str_replace(array('"', "'"), '', $name)),
- 'address' => $email
- );
+ if (static::validateAddress($email)) {
+ $addresses[] = [
+ 'name' => trim(str_replace(['"', "'"], '', $name)),
+ 'address' => $email,
+ ];
}
}
}
}
+
return $addresses;
}
/**
* 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
- * @throws phpmailerException
- * @return boolean
+ * @param bool $auto Whether to also set the Sender address, defaults to true
+ *
+ * @throws Exception
+ *
+ * @return bool
*/
public function setFrom($address, $name = '', $auto = true)
{
$address = trim($address);
$name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
// Don't validate now addresses with IDN. Will be done in send().
- if (($pos = strrpos($address, '@')) === false or
- (!$this->has8bitChars(substr($address, ++$pos)) or !$this->idnSupported()) and
- !$this->validateAddress($address)) {
- $error_message = $this->lang('invalid_address') . " (setFrom) $address";
+ $pos = strrpos($address, '@');
+ if ((false === $pos)
+ || ((!$this->has8bitChars(substr($address, ++$pos)) || !static::idnSupported())
+ && !static::validateAddress($address))
+ ) {
+ $error_message = sprintf(
+ '%s (From): %s',
+ $this->lang('invalid_address'),
+ $address
+ );
$this->setError($error_message);
$this->edebug($error_message);
if ($this->exceptions) {
- throw new phpmailerException($error_message);
+ throw new Exception($error_message);
}
+
return false;
}
$this->From = $address;
$this->FromName = $name;
- if ($auto) {
- if (empty($this->Sender)) {
- $this->Sender = $address;
- }
+ if ($auto && empty($this->Sender)) {
+ $this->Sender = $address;
}
+
return true;
}
* 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.
+ *
* @return string
*/
public function getLastMessageID()
/**
* Check that a string looks like an email address.
- * @param string $address The email address to check
- * @param string|callable $patternselect A selector for the validation pattern to use :
+ * Validation patterns supported:
* * `auto` Pick best pattern automatically;
- * * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14;
+ * * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0;
* * `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:
+ *
+ * ```php
* PHPMailer::validateAddress('user@example.com', 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.
- * @return boolean
- * @static
- * @access public
+ *
+ * @param string $address The email address to check
+ * @param string|callable $patternselect Which pattern to use
+ *
+ * @return bool
*/
public static function validateAddress($address, $patternselect = null)
{
- if (is_null($patternselect)) {
- $patternselect = self::$validator;
+ if (null === $patternselect) {
+ $patternselect = static::$validator;
}
if (is_callable($patternselect)) {
- return call_user_func($patternselect, $address);
+ return $patternselect($address);
}
//Reject line breaks in addresses; it's valid RFC5322, but not RFC5321
- if (strpos($address, "\n") !== false or strpos($address, "\r") !== false) {
+ if (strpos($address, "\n") !== false || strpos($address, "\r") !== false) {
return false;
}
- if (!$patternselect or $patternselect == 'auto') {
- //Check this constant first so it works when extension_loaded() is disabled by safe mode
- //Constant was added in PHP 5.2.4
- if (defined('PCRE_VERSION')) {
- //This pattern can get stuck in a recursive loop in PCRE <= 8.0.2
- if (version_compare(PCRE_VERSION, '8.0.3') >= 0) {
- $patternselect = 'pcre8';
- } else {
- $patternselect = 'pcre';
- }
- } elseif (function_exists('extension_loaded') and extension_loaded('pcre')) {
- //Fall back to older PCRE
- $patternselect = 'pcre';
- } else {
- //Filter_var appeared in PHP 5.2.0 and does not require the PCRE extension
- if (version_compare(PHP_VERSION, '5.2.0') >= 0) {
- $patternselect = 'php';
- } else {
- $patternselect = 'noregex';
- }
- }
- }
switch ($patternselect) {
+ case 'pcre': //Kept for BC
case 'pcre8':
- /**
- * Uses the same RFC5322 regex on which FILTER_VALIDATE_EMAIL is based, but allows dotless domains.
- * @link http://squiloople.com/2009/12/20/email-address-validation/
+ /*
+ * A more complex and more permissive version of the RFC5322 regex on which FILTER_VALIDATE_EMAIL
+ * is based.
+ * In addition to the addresses allowed by filter_var, also permits:
+ * * dotless domains: `a@b`
+ * * comments: `1234 @ local(blah) .machine .example`
+ * * quoted elements: `'"test blah"@example.org'`
+ * * numeric TLDs: `a@b.123`
+ * * unbracketed IPv4 literals: `a@192.168.0.1`
+ * * IPv6 literals: 'first.last@[IPv6:a1::]'
+ * Not all of these will necessarily work for sending!
+ *
+ * @see http://squiloople.com/2009/12/20/email-address-validation/
* @copyright 2009-2010 Michael Rushton
* Feel free to use and redistribute this code. But please keep this copyright notice.
*/
- return (boolean)preg_match(
+ return (bool) preg_match(
'/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' .
'((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' .
'(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' .
'|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD',
$address
);
- case 'pcre':
- //An older regex that doesn't need a recent PCRE
- return (boolean)preg_match(
- '/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ -~]|[^"])"?){65,}@)(?>' .
- '[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")' .
- '(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*' .
- '@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})' .
- '(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:' .
- '[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?' .
- '::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:' .
- '[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?' .
- '::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
- '|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD',
- $address
- );
case 'html5':
- /**
+ /*
* This is the pattern used in the HTML5 spec for validation of 'email' type form input elements.
- * @link http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email)
+ *
+ * @see http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email)
*/
- return (boolean)preg_match(
+ return (bool) preg_match(
'/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' .
'[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD',
$address
);
- case 'noregex':
- //No PCRE! Do something _very_ approximate!
- //Check the address is 3 chars or longer and contains an @ that's not the first or last char
- return (strlen($address) >= 3
- and strpos($address, '@') >= 1
- and strpos($address, '@') != strlen($address) - 1);
case 'php':
default:
- return (boolean)filter_var($address, FILTER_VALIDATE_EMAIL);
+ return filter_var($address, FILTER_VALIDATE_EMAIL) !== false;
}
}
/**
* Tells whether IDNs (Internationalized Domain Names) are supported or not. This requires the
- * "intl" and "mbstring" PHP extensions.
- * @return bool "true" if required functions for IDN support are present
+ * `intl` and `mbstring` PHP extensions.
+ *
+ * @return bool `true` if required functions for IDN support are present
*/
- public function idnSupported()
+ public static function idnSupported()
{
- // @TODO: Write our own "idn_to_ascii" function for PHP <= 5.2.
- return function_exists('idn_to_ascii') and function_exists('mb_convert_encoding');
+ return function_exists('idn_to_ascii') && function_exists('mb_convert_encoding');
}
/**
* 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)
+ * or fails for any reason (e.g. domain contains characters not allowed in an IDN).
+ *
* @see PHPMailer::$CharSet
+ *
* @param string $address The email address to convert
+ *
* @return string The encoded address in ASCII form
*/
public function punyencodeAddress($address)
{
// Verify we have required functions, CharSet, and at-sign.
- if ($this->idnSupported() and
- !empty($this->CharSet) and
- ($pos = strrpos($address, '@')) !== false) {
+ $pos = strrpos($address, '@');
+ if (!empty($this->CharSet) &&
+ false !== $pos &&
+ static::idnSupported()
+ ) {
$domain = substr($address, ++$pos);
// Verify CharSet string is a valid one, and domain properly encoded in this CharSet.
- if ($this->has8bitChars($domain) and @mb_check_encoding($domain, $this->CharSet)) {
+ if ($this->has8bitChars($domain) && @mb_check_encoding($domain, $this->CharSet)) {
$domain = mb_convert_encoding($domain, 'UTF-8', $this->CharSet);
- if (($punycode = defined('INTL_IDNA_VARIANT_UTS46') ?
- idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46) :
- idn_to_ascii($domain)) !== false) {
+ //Ignore IDE complaints about this line - method signature changed in PHP 5.4
+ $errorcode = 0;
+ if (defined('INTL_IDNA_VARIANT_UTS46')) {
+ $punycode = idn_to_ascii($domain, $errorcode, INTL_IDNA_VARIANT_UTS46);
+ } elseif (defined('INTL_IDNA_VARIANT_2003')) {
+ $punycode = idn_to_ascii($domain, $errorcode, INTL_IDNA_VARIANT_2003);
+ } else {
+ $punycode = idn_to_ascii($domain, $errorcode);
+ }
+ if (false !== $punycode) {
return substr($address, 0, $pos) . $punycode;
}
}
}
+
return $address;
}
/**
* Create a message and send it.
* Uses the sending method specified by $Mailer.
- * @throws phpmailerException
- * @return boolean false on error - See the ErrorInfo property for details of the error.
+ *
+ * @throws Exception
+ *
+ * @return bool false on error - See the ErrorInfo property for details of the error
*/
public function send()
{
if (!$this->preSend()) {
return false;
}
+
return $this->postSend();
- } catch (phpmailerException $exc) {
+ } catch (Exception $exc) {
$this->mailHeader = '';
$this->setError($exc->getMessage());
if ($this->exceptions) {
throw $exc;
}
+
return false;
}
}
/**
* Prepare a message for sending.
- * @throws phpmailerException
- * @return boolean
+ *
+ * @throws Exception
+ *
+ * @return bool
*/
public function preSend()
{
+ if ('smtp' === $this->Mailer
+ || ('mail' === $this->Mailer && stripos(PHP_OS, 'WIN') === 0)
+ ) {
+ //SMTP mandates RFC-compliant line endings
+ //and it's also used with mail() on Windows
+ static::setLE("\r\n");
+ } else {
+ //Maintain backward compatibility with legacy Linux command line mailers
+ static::setLE(PHP_EOL);
+ }
+ //Check for buggy PHP versions that add a header with an incorrect line break
+ if ('mail' === $this->Mailer
+ && ((PHP_VERSION_ID >= 70000 && PHP_VERSION_ID < 70017)
+ || (PHP_VERSION_ID >= 70100 && PHP_VERSION_ID < 70103))
+ && ini_get('mail.add_x_header') === '1'
+ && stripos(PHP_OS, 'WIN') === 0
+ ) {
+ trigger_error(
+ 'Your version of PHP is affected by a bug that may result in corrupted messages.' .
+ ' To fix it, switch to sending using SMTP, disable the mail.add_x_header option in' .
+ ' your php.ini, switch to MacOS or Linux, or upgrade your PHP to version 7.0.17+ or 7.1.3+.',
+ E_USER_WARNING
+ );
+ }
+
try {
$this->error_count = 0; // Reset errors
$this->mailHeader = '';
// Dequeue recipient and Reply-To addresses with IDN
foreach (array_merge($this->RecipientsQueue, $this->ReplyToQueue) as $params) {
$params[1] = $this->punyencodeAddress($params[1]);
- call_user_func_array(array($this, 'addAnAddress'), $params);
+ call_user_func_array([$this, 'addAnAddress'], $params);
}
- if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
- throw new phpmailerException($this->lang('provide_address'), self::STOP_CRITICAL);
+ if (count($this->to) + count($this->cc) + count($this->bcc) < 1) {
+ throw new Exception($this->lang('provide_address'), self::STOP_CRITICAL);
}
// Validate From, Sender, and ConfirmReadingTo addresses
- foreach (array('From', 'Sender', 'ConfirmReadingTo') as $address_kind) {
+ foreach (['From', 'Sender', 'ConfirmReadingTo'] as $address_kind) {
$this->$address_kind = trim($this->$address_kind);
if (empty($this->$address_kind)) {
continue;
}
$this->$address_kind = $this->punyencodeAddress($this->$address_kind);
- if (!$this->validateAddress($this->$address_kind)) {
- $error_message = $this->lang('invalid_address') . ' (punyEncode) ' . $this->$address_kind;
+ if (!static::validateAddress($this->$address_kind)) {
+ $error_message = sprintf(
+ '%s (%s): %s',
+ $this->lang('invalid_address'),
+ $address_kind,
+ $this->$address_kind
+ );
$this->setError($error_message);
$this->edebug($error_message);
if ($this->exceptions) {
- throw new phpmailerException($error_message);
+ throw new Exception($error_message);
}
+
return false;
}
}
// Set whether the message is multipart/alternative
if ($this->alternativeExists()) {
- $this->ContentType = 'multipart/alternative';
+ $this->ContentType = static::CONTENT_TYPE_MULTIPART_ALTERNATIVE;
}
$this->setMessageType();
// Refuse to send an empty message unless we are specifically allowing it
- if (!$this->AllowEmpty and empty($this->Body)) {
- throw new phpmailerException($this->lang('empty_message'), self::STOP_CRITICAL);
+ if (!$this->AllowEmpty && empty($this->Body)) {
+ throw new Exception($this->lang('empty_message'), self::STOP_CRITICAL);
}
+ //Trim subject consistently
+ $this->Subject = trim($this->Subject);
// Create body before headers in case body makes changes to headers (e.g. altering transfer encoding)
$this->MIMEHeader = '';
$this->MIMEBody = $this->createBody();
// To capture the complete message when using mail(), create
// an extra header list which createHeader() doesn't fold in
- if ($this->Mailer == 'mail') {
+ if ('mail' === $this->Mailer) {
if (count($this->to) > 0) {
$this->mailHeader .= $this->addrAppend('To', $this->to);
} else {
}
$this->mailHeader .= $this->headerLine(
'Subject',
- $this->encodeHeader($this->secureHeader(trim($this->Subject)))
+ $this->encodeHeader($this->secureHeader($this->Subject))
);
}
// Sign with DKIM if enabled
if (!empty($this->DKIM_domain)
- && !empty($this->DKIM_private)
&& !empty($this->DKIM_selector)
- && file_exists($this->DKIM_private)) {
+ && (!empty($this->DKIM_private_string)
+ || (!empty($this->DKIM_private)
+ && static::isPermittedPath($this->DKIM_private)
+ && file_exists($this->DKIM_private)
+ )
+ )
+ ) {
$header_dkim = $this->DKIM_Add(
$this->MIMEHeader . $this->mailHeader,
$this->encodeHeader($this->secureHeader($this->Subject)),
$this->MIMEBody
);
- $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . self::CRLF .
- str_replace("\r\n", "\n", $header_dkim) . self::CRLF;
+ $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . static::$LE .
+ static::normalizeBreaks($header_dkim) . static::$LE;
}
+
return true;
- } catch (phpmailerException $exc) {
+ } catch (Exception $exc) {
$this->setError($exc->getMessage());
if ($this->exceptions) {
throw $exc;
}
+
return false;
}
}
/**
- * Actually send a message.
- * Send the email via the selected mechanism
- * @throws phpmailerException
- * @return boolean
+ * Actually send a message via the selected mechanism.
+ *
+ * @throws Exception
+ *
+ * @return bool
*/
public function postSend()
{
case 'mail':
return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
default:
- $sendMethod = $this->Mailer.'Send';
+ $sendMethod = $this->Mailer . 'Send';
if (method_exists($this, $sendMethod)) {
return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody);
}
return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
}
- } catch (phpmailerException $exc) {
+ } catch (Exception $exc) {
$this->setError($exc->getMessage());
$this->edebug($exc->getMessage());
if ($this->exceptions) {
throw $exc;
}
}
+
return false;
}
/**
* Send mail using the $Sendmail program.
- * @param string $header The message headers
- * @param string $body The message body
+ *
* @see PHPMailer::$Sendmail
- * @throws phpmailerException
- * @access protected
- * @return boolean
+ *
+ * @param string $header The message headers
+ * @param string $body The message body
+ *
+ * @throws Exception
+ *
+ * @return bool
*/
protected function sendmailSend($header, $body)
{
- if ($this->Sender != '') {
- if ($this->Mailer == 'qmail') {
- $sendmail = sprintf('%s -f%s', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
+ $header = rtrim($header, "\r\n ") . static::$LE . static::$LE;
+
+ // CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped.
+ if (!empty($this->Sender) && self::isShellSafe($this->Sender)) {
+ if ('qmail' === $this->Mailer) {
+ $sendmailFmt = '%s -f%s';
} else {
- $sendmail = sprintf('%s -oi -f%s -t', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
+ $sendmailFmt = '%s -oi -f%s -t';
}
+ } elseif ('qmail' === $this->Mailer) {
+ $sendmailFmt = '%s';
} else {
- if ($this->Mailer == 'qmail') {
- $sendmail = sprintf('%s', escapeshellcmd($this->Sendmail));
- } else {
- $sendmail = sprintf('%s -oi -t', escapeshellcmd($this->Sendmail));
- }
+ $sendmailFmt = '%s -oi -t';
}
+
+ $sendmail = sprintf($sendmailFmt, escapeshellcmd($this->Sendmail), $this->Sender);
+
if ($this->SingleTo) {
foreach ($this->SingleToArray as $toAddr) {
- if (!@$mail = popen($sendmail, 'w')) {
- throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
+ $mail = @popen($sendmail, 'w');
+ if (!$mail) {
+ throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
}
- fputs($mail, 'To: ' . $toAddr . "\n");
- fputs($mail, $header);
- fputs($mail, $body);
+ fwrite($mail, 'To: ' . $toAddr . "\n");
+ fwrite($mail, $header);
+ fwrite($mail, $body);
$result = pclose($mail);
$this->doCallback(
- ($result == 0),
- array($toAddr),
+ ($result === 0),
+ [$toAddr],
$this->cc,
$this->bcc,
$this->Subject,
$body,
- $this->From
+ $this->From,
+ []
);
- if ($result != 0) {
- throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
+ if (0 !== $result) {
+ throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
}
}
} else {
- if (!@$mail = popen($sendmail, 'w')) {
- throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
+ $mail = @popen($sendmail, 'w');
+ if (!$mail) {
+ throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
}
- fputs($mail, $header);
- fputs($mail, $body);
+ fwrite($mail, $header);
+ fwrite($mail, $body);
$result = pclose($mail);
$this->doCallback(
- ($result == 0),
+ ($result === 0),
$this->to,
$this->cc,
$this->bcc,
$this->Subject,
$body,
- $this->From
+ $this->From,
+ []
);
- if ($result != 0) {
- throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
+ if (0 !== $result) {
+ throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * 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.
+ *
+ * @see https://github.com/PHPMailer/PHPMailer/issues/924 CVE-2016-10045 bug report
+ *
+ * @param string $string The string to be validated
+ *
+ * @return bool
+ */
+ protected static function isShellSafe($string)
+ {
+ // Future-proof
+ if (escapeshellcmd($string) !== $string
+ || !in_array(escapeshellarg($string), ["'$string'", "\"$string\""])
+ ) {
+ return false;
+ }
+
+ $length = strlen($string);
+
+ for ($i = 0; $i < $length; ++$i) {
+ $c = $string[$i];
+
+ // All other characters have a special meaning in at least one common shell, including = and +.
+ // Full stop (.) has a special meaning in cmd.exe, but its impact should be negligible here.
+ // Note that this does permit non-Latin alphanumeric characters based on the current locale.
+ if (!ctype_alnum($c) && strpos('@_-.', $c) === false) {
+ return false;
}
}
+
return true;
}
+ /**
+ * Check whether a file path is of a permitted type.
+ * Used to reject URLs and phar files from functions that access local file paths,
+ * such as addAttachment.
+ *
+ * @param string $path A relative or absolute path to a file
+ *
+ * @return bool
+ */
+ protected static function isPermittedPath($path)
+ {
+ return !preg_match('#^[a-z]+://#i', $path);
+ }
+
/**
* Send mail using the PHP mail() function.
+ *
+ * @see http://www.php.net/manual/en/book.mail.php
+ *
* @param string $header The message headers
- * @param string $body The message body
- * @link http://www.php.net/manual/en/book.mail.php
- * @throws phpmailerException
- * @access protected
- * @return boolean
+ * @param string $body The message body
+ *
+ * @throws Exception
+ *
+ * @return bool
*/
protected function mailSend($header, $body)
{
- $toArr = array();
+ $header = rtrim($header, "\r\n ") . static::$LE . static::$LE;
+
+ $toArr = [];
foreach ($this->to as $toaddr) {
$toArr[] = $this->addrFormat($toaddr);
}
$params = null;
//This sets the SMTP envelope sender which gets turned into a return-path header by the receiver
- if (!empty($this->Sender)) {
+ //A space after `-f` is optional, but there is a long history of its presence
+ //causing problems, so we don't use one
+ //Exim docs: http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html
+ //Sendmail docs: http://www.sendmail.org/~ca/email/man/sendmail.html
+ //Qmail docs: http://www.qmail.org/man/man8/qmail-inject.html
+ //Example problem: https://www.drupal.org/node/1057954
+ // CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped.
+ if (!empty($this->Sender) && static::validateAddress($this->Sender) && self::isShellSafe($this->Sender)) {
$params = sprintf('-f%s', $this->Sender);
}
- if ($this->Sender != '' and !ini_get('safe_mode')) {
+ if (!empty($this->Sender) && static::validateAddress($this->Sender)) {
$old_from = ini_get('sendmail_from');
ini_set('sendmail_from', $this->Sender);
}
$result = false;
- if ($this->SingleTo and count($toArr) > 1) {
+ if ($this->SingleTo && count($toArr) > 1) {
foreach ($toArr as $toAddr) {
$result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params);
- $this->doCallback($result, array($toAddr), $this->cc, $this->bcc, $this->Subject, $body, $this->From);
+ $this->doCallback($result, [$toAddr], $this->cc, $this->bcc, $this->Subject, $body, $this->From, []);
}
} else {
$result = $this->mailPassthru($to, $this->Subject, $body, $header, $params);
- $this->doCallback($result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From);
+ $this->doCallback($result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From, []);
}
if (isset($old_from)) {
ini_set('sendmail_from', $old_from);
}
if (!$result) {
- throw new phpmailerException($this->lang('instantiate'), self::STOP_CRITICAL);
+ throw new Exception($this->lang('instantiate'), self::STOP_CRITICAL);
}
+
return true;
}
/**
* Get an instance to use for SMTP operations.
- * Override this function to load your own SMTP implementation
+ * Override this function to load your own SMTP implementation,
+ * or set one with setSMTPInstance.
+ *
* @return SMTP
*/
public function getSMTPInstance()
{
if (!is_object($this->smtp)) {
- $this->smtp = new SMTP;
+ $this->smtp = new SMTP();
}
+
+ return $this->smtp;
+ }
+
+ /**
+ * Provide an instance to use for SMTP operations.
+ *
+ * @return SMTP
+ */
+ public function setSMTPInstance(SMTP $smtp)
+ {
+ $this->smtp = $smtp;
+
return $this->smtp;
}
/**
* Send mail via SMTP.
* Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
- * Uses the PHPMailerSMTP class by default.
- * @see PHPMailer::getSMTPInstance() to use a different class.
+ *
+ * @see PHPMailer::setSMTPInstance() to use a different class.
+ *
+ * @uses \PHPMailer\PHPMailer\SMTP
+ *
* @param string $header The message headers
- * @param string $body The message body
- * @throws phpmailerException
- * @uses SMTP
- * @access protected
- * @return boolean
+ * @param string $body The message body
+ *
+ * @throws Exception
+ *
+ * @return bool
*/
protected function smtpSend($header, $body)
{
- $bad_rcpt = array();
+ $header = rtrim($header, "\r\n ") . static::$LE . static::$LE;
+ $bad_rcpt = [];
if (!$this->smtpConnect($this->SMTPOptions)) {
- throw new phpmailerException($this->lang('smtp_connect_failed'), self::STOP_CRITICAL);
+ throw new Exception($this->lang('smtp_connect_failed'), self::STOP_CRITICAL);
}
- if ('' == $this->Sender) {
+ //Sender already validated in preSend()
+ if ('' === $this->Sender) {
$smtp_from = $this->From;
} else {
$smtp_from = $this->Sender;
}
if (!$this->smtp->mail($smtp_from)) {
$this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError()));
- throw new phpmailerException($this->ErrorInfo, self::STOP_CRITICAL);
+ throw new Exception($this->ErrorInfo, self::STOP_CRITICAL);
}
+ $callbacks = [];
// Attempt to send to all recipients
- foreach (array($this->to, $this->cc, $this->bcc) as $togroup) {
+ foreach ([$this->to, $this->cc, $this->bcc] as $togroup) {
foreach ($togroup as $to) {
- if (!$this->smtp->recipient($to[0])) {
+ if (!$this->smtp->recipient($to[0], $this->dsn)) {
$error = $this->smtp->getError();
- $bad_rcpt[] = array('to' => $to[0], 'error' => $error['detail']);
+ $bad_rcpt[] = ['to' => $to[0], 'error' => $error['detail']];
$isSent = false;
} else {
$isSent = true;
}
- $this->doCallback($isSent, array($to[0]), array(), array(), $this->Subject, $body, $this->From);
+
+ $callbacks[] = ['issent'=>$isSent, 'to'=>$to[0]];
}
}
// Only send the DATA command if we have viable recipients
- if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header . $body)) {
- throw new phpmailerException($this->lang('data_not_accepted'), self::STOP_CRITICAL);
+ if ((count($this->all_recipients) > count($bad_rcpt)) && !$this->smtp->data($header . $body)) {
+ throw new Exception($this->lang('data_not_accepted'), self::STOP_CRITICAL);
}
+
+ $smtp_transaction_id = $this->smtp->getLastTransactionID();
+
if ($this->SMTPKeepAlive) {
$this->smtp->reset();
} else {
$this->smtp->quit();
$this->smtp->close();
}
+
+ foreach ($callbacks as $cb) {
+ $this->doCallback(
+ $cb['issent'],
+ [$cb['to']],
+ [],
+ [],
+ $this->Subject,
+ $body,
+ $this->From,
+ ['smtp_transaction_id' => $smtp_transaction_id]
+ );
+ }
+
//Create error message for any bad addresses
if (count($bad_rcpt) > 0) {
$errstr = '';
foreach ($bad_rcpt as $bad) {
$errstr .= $bad['to'] . ': ' . $bad['error'];
}
- throw new phpmailerException(
- $this->lang('recipients_failed') . $errstr,
- self::STOP_CONTINUE
- );
+ throw new Exception($this->lang('recipients_failed') . $errstr, self::STOP_CONTINUE);
}
+
return true;
}
/**
* Initiate a connection to an SMTP server.
* Returns false if the operation failed.
+ *
* @param array $options An array of options compatible with stream_context_create()
- * @uses SMTP
- * @access public
- * @throws phpmailerException
- * @return boolean
+ *
+ * @throws Exception
+ *
+ * @uses \PHPMailer\PHPMailer\SMTP
+ *
+ * @return bool
*/
public function smtpConnect($options = null)
{
- if (is_null($this->smtp)) {
+ if (null === $this->smtp) {
$this->smtp = $this->getSMTPInstance();
}
//If no options are provided, use whatever is set in the instance
- if (is_null($options)) {
+ if (null === $options) {
$options = $this->SMTPOptions;
}
$lastexception = null;
foreach ($hosts as $hostentry) {
- $hostinfo = array();
- if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) {
+ $hostinfo = [];
+ if (!preg_match(
+ '/^(?:(ssl|tls):\/\/)?(.+?)(?::(\d+))?$/',
+ trim($hostentry),
+ $hostinfo
+ )) {
+ $this->edebug($this->lang('invalid_hostentry') . ' ' . trim($hostentry));
// Not a valid host entry
continue;
}
- // $hostinfo[2]: optional ssl or tls prefix
- // $hostinfo[3]: the hostname
- // $hostinfo[4]: optional port number
+ // $hostinfo[1]: optional ssl or tls prefix
+ // $hostinfo[2]: the hostname
+ // $hostinfo[3]: optional port number
// The host string prefix can temporarily override the current setting for SMTPSecure
// If it's not specified, the default value is used
+
+ //Check the host name is a valid name or IP address before trying to use it
+ if (!static::isValidHost($hostinfo[2])) {
+ $this->edebug($this->lang('invalid_host') . ' ' . $hostinfo[2]);
+ continue;
+ }
$prefix = '';
$secure = $this->SMTPSecure;
- $tls = ($this->SMTPSecure == 'tls');
- if ('ssl' == $hostinfo[2] or ('' == $hostinfo[2] and 'ssl' == $this->SMTPSecure)) {
+ $tls = (static::ENCRYPTION_STARTTLS === $this->SMTPSecure);
+ if ('ssl' === $hostinfo[1] || ('' === $hostinfo[1] && static::ENCRYPTION_SMTPS === $this->SMTPSecure)) {
$prefix = 'ssl://';
$tls = false; // Can't have SSL and TLS at the same time
- $secure = 'ssl';
- } elseif ($hostinfo[2] == 'tls') {
+ $secure = static::ENCRYPTION_SMTPS;
+ } elseif ('tls' === $hostinfo[1]) {
$tls = true;
// tls doesn't use a prefix
- $secure = 'tls';
+ $secure = static::ENCRYPTION_STARTTLS;
}
//Do we need the OpenSSL extension?
- $sslext = defined('OPENSSL_ALGO_SHA1');
- if ('tls' === $secure or 'ssl' === $secure) {
+ $sslext = defined('OPENSSL_ALGO_SHA256');
+ if (static::ENCRYPTION_STARTTLS === $secure || static::ENCRYPTION_SMTPS === $secure) {
//Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled
if (!$sslext) {
- throw new phpmailerException($this->lang('extension_missing').'openssl', self::STOP_CRITICAL);
+ throw new Exception($this->lang('extension_missing') . 'openssl', self::STOP_CRITICAL);
}
}
- $host = $hostinfo[3];
+ $host = $hostinfo[2];
$port = $this->Port;
- $tport = (integer)$hostinfo[4];
- if ($tport > 0 and $tport < 65536) {
- $port = $tport;
+ if (array_key_exists(3, $hostinfo) && is_numeric($hostinfo[3]) && $hostinfo[3] > 0 && $hostinfo[3] < 65536) {
+ $port = (int) $hostinfo[3];
}
if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) {
try {
// * we have openssl extension
// * we are not already using SSL
// * the server offers STARTTLS
- if ($this->SMTPAutoTLS and $sslext and $secure != 'ssl' and $this->smtp->getServerExt('STARTTLS')) {
+ if ($this->SMTPAutoTLS && $sslext && 'ssl' !== $secure && $this->smtp->getServerExt('STARTTLS')) {
$tls = true;
}
if ($tls) {
if (!$this->smtp->startTLS()) {
- throw new phpmailerException($this->lang('connect_host'));
+ throw new Exception($this->lang('connect_host'));
}
// We must resend EHLO after TLS negotiation
$this->smtp->hello($hello);
}
- if ($this->SMTPAuth) {
- if (!$this->smtp->authenticate(
- $this->Username,
- $this->Password,
- $this->AuthType,
- $this->Realm,
- $this->Workstation
- )
- ) {
- throw new phpmailerException($this->lang('authenticate'));
- }
+ if ($this->SMTPAuth && !$this->smtp->authenticate(
+ $this->Username,
+ $this->Password,
+ $this->AuthType,
+ $this->oauth
+ )) {
+ throw new Exception($this->lang('authenticate'));
}
+
return true;
- } catch (phpmailerException $exc) {
+ } catch (Exception $exc) {
$lastexception = $exc;
$this->edebug($exc->getMessage());
// We must have connected, but then failed TLS or Auth, so close connection nicely
// If we get here, all connection attempts have failed, so close connection hard
$this->smtp->close();
// As we've caught all exceptions, just report whatever the last one was
- if ($this->exceptions and !is_null($lastexception)) {
+ if ($this->exceptions && null !== $lastexception) {
throw $lastexception;
}
+
return false;
}
/**
* Close the active SMTP session if one exists.
- * @return void
*/
public function smtpClose()
{
- if (is_a($this->smtp, 'SMTP')) {
- if ($this->smtp->connected()) {
- $this->smtp->quit();
- $this->smtp->close();
- }
+ if ((null !== $this->smtp) && $this->smtp->connected()) {
+ $this->smtp->quit();
+ $this->smtp->close();
}
}
* Set the language for 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. French is "fr")
+ *
+ * @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr")
* @param string $lang_path Path to the language file directory, with trailing separator (slash)
- * @return boolean
- * @access public
+ *
+ * @return bool
*/
public function setLanguage($langcode = 'en', $lang_path = '')
{
// Backwards compatibility for renamed language codes
- $renamed_langcodes = array(
+ $renamed_langcodes = [
+ 'br' => 'pt_br',
+ 'cz' => 'cs',
'dk' => 'da',
- );
+ 'no' => 'nb',
+ 'se' => 'sv',
+ 'rs' => 'sr',
+ 'tg' => 'tl',
+ ];
if (isset($renamed_langcodes[$langcode])) {
$langcode = $renamed_langcodes[$langcode];
}
// Define full set of translatable strings in English
- $PHPMAILER_LANG = array(
+ $PHPMAILER_LANG = [
'authenticate' => 'SMTP Error: Could not authenticate.',
'connect_host' => 'SMTP Error: Could not connect to SMTP host.',
'data_not_accepted' => 'SMTP Error: data not accepted.',
'from_failed' => 'The following From address failed: ',
'instantiate' => 'Could not instantiate mail function.',
'invalid_address' => 'Invalid address: ',
+ 'invalid_hostentry' => 'Invalid hostentry: ',
+ 'invalid_host' => 'Invalid host: ',
'mailer_not_supported' => ' mailer is not supported.',
'provide_address' => 'You must provide at least one recipient email address.',
'recipients_failed' => 'SMTP Error: The following recipients failed: ',
'smtp_connect_failed' => 'SMTP connect() failed.',
'smtp_error' => 'SMTP server error: ',
'variable_set' => 'Cannot set or reset variable: ',
- 'extension_missing' => 'Extension missing: '
- );
+ 'extension_missing' => 'Extension missing: ',
+ ];
if (empty($lang_path)) {
// Calculate an absolute path so it can work if CWD is not here
- $lang_path = dirname(__FILE__). DIRECTORY_SEPARATOR . 'language'. DIRECTORY_SEPARATOR;
+ $lang_path = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR;
}
//Validate $langcode
if (!preg_match('/^[a-z]{2}(?:_[a-zA-Z]{2})?$/', $langcode)) {
$foundlang = true;
$lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php';
// There is no English translation file
- if ($langcode != 'en') {
+ if ('en' !== $langcode) {
// Make sure language file path is readable
- if (!is_readable($lang_file)) {
+ if (!static::isPermittedPath($lang_file) || !file_exists($lang_file)) {
$foundlang = false;
} else {
// Overwrite language-specific strings.
}
}
$this->language = $PHPMAILER_LANG;
- return (boolean)$foundlang; // Returns false if language not found
+
+ return (bool) $foundlang; // Returns false if language not found
}
/**
* Get the array of strings for the current language.
+ *
* @return array
*/
public function getTranslations()
/**
* Create recipient headers.
- * @access public
+ *
* @param string $type
- * @param array $addr 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('joe@example.com', 'Joe User'), array('zoe@example.com', 'Zoe User'))
+ * @param array $addr An array of recipients,
+ * where each recipient is a 2-element indexed array with element 0 containing an address
+ * and element 1 containing a name, like:
+ * [['joe@example.com', 'Joe User'], ['zoe@example.com', 'Zoe User']]
+ *
* @return string
*/
public function addrAppend($type, $addr)
{
- $addresses = array();
+ $addresses = [];
foreach ($addr as $address) {
$addresses[] = $this->addrFormat($address);
}
- return $type . ': ' . implode(', ', $addresses) . $this->LE;
+
+ return $type . ': ' . implode(', ', $addresses) . static::$LE;
}
/**
* Format an address for use in a message header.
- * @access public
- * @param array $addr A 2-element indexed array, element 0 containing an address, element 1 containing a name
- * like array('joe@example.com', 'Joe User')
+ *
+ * @param array $addr A 2-element indexed array, element 0 containing an address, element 1 containing a name like
+ * ['joe@example.com', 'Joe User']
+ *
* @return string
*/
public function addrFormat($addr)
{
if (empty($addr[1])) { // No name provided
return $this->secureHeader($addr[0]);
- } else {
- return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') . ' <' . $this->secureHeader(
- $addr[0]
- ) . '>';
}
+
+ return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') .
+ ' <' . $this->secureHeader($addr[0]) . '>';
}
/**
* For use with mailers that do not automatically perform wrapping
* and for quoted-printable encoded messages.
* 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
- * @access public
+ * @param int $length The line length to wrap to
+ * @param bool $qp_mode Whether to run in Quoted-Printable mode
+ *
* @return string
*/
public function wrapText($message, $length, $qp_mode = false)
{
if ($qp_mode) {
- $soft_break = sprintf(' =%s', $this->LE);
+ $soft_break = sprintf(' =%s', static::$LE);
} else {
- $soft_break = $this->LE;
+ $soft_break = static::$LE;
}
// If utf-8 encoding is used, we will need to make sure we don't
// split multibyte characters when we wrap
- $is_utf8 = (strtolower($this->CharSet) == 'utf-8');
- $lelen = strlen($this->LE);
- $crlflen = strlen(self::CRLF);
+ $is_utf8 = static::CHARSET_UTF8 === strtolower($this->CharSet);
+ $lelen = strlen(static::$LE);
+ $crlflen = strlen(static::$LE);
- $message = $this->fixEOL($message);
+ $message = static::normalizeBreaks($message);
//Remove a trailing line break
- if (substr($message, -$lelen) == $this->LE) {
+ if (substr($message, -$lelen) === static::$LE) {
$message = substr($message, 0, -$lelen);
}
//Split message into lines
- $lines = explode($this->LE, $message);
+ $lines = explode(static::$LE, $message);
//Message will be rebuilt in here
$message = '';
foreach ($lines as $line) {
$buf = '';
$firstword = true;
foreach ($words as $word) {
- if ($qp_mode and (strlen($word) > $length)) {
+ if ($qp_mode && (strlen($word) > $length)) {
$space_left = $length - strlen($buf) - $crlflen;
if (!$firstword) {
if ($space_left > 20) {
$len = $space_left;
if ($is_utf8) {
$len = $this->utf8CharBoundary($word, $len);
- } elseif (substr($word, $len - 1, 1) == '=') {
- $len--;
- } elseif (substr($word, $len - 2, 1) == '=') {
+ } elseif ('=' === substr($word, $len - 1, 1)) {
+ --$len;
+ } elseif ('=' === substr($word, $len - 2, 1)) {
$len -= 2;
}
$part = substr($word, 0, $len);
$word = substr($word, $len);
$buf .= ' ' . $part;
- $message .= $buf . sprintf('=%s', self::CRLF);
+ $message .= $buf . sprintf('=%s', static::$LE);
} else {
$message .= $buf . $soft_break;
}
$buf = '';
}
- while (strlen($word) > 0) {
+ while ($word !== '') {
if ($length <= 0) {
break;
}
$len = $length;
if ($is_utf8) {
$len = $this->utf8CharBoundary($word, $len);
- } elseif (substr($word, $len - 1, 1) == '=') {
- $len--;
- } elseif (substr($word, $len - 2, 1) == '=') {
+ } elseif ('=' === substr($word, $len - 1, 1)) {
+ --$len;
+ } elseif ('=' === substr($word, $len - 2, 1)) {
$len -= 2;
}
$part = substr($word, 0, $len);
- $word = substr($word, $len);
+ $word = (string) substr($word, $len);
- if (strlen($word) > 0) {
- $message .= $part . sprintf('=%s', self::CRLF);
+ if ($word !== '') {
+ $message .= $part . sprintf('=%s', static::$LE);
} else {
$buf = $part;
}
}
$buf .= $word;
- if (strlen($buf) > $length and $buf_o != '') {
+ if ('' !== $buf_o && strlen($buf) > $length) {
$message .= $buf_o . $soft_break;
$buf = $word;
}
}
$firstword = false;
}
- $message .= $buf . self::CRLF;
+ $message .= $buf . static::$LE;
}
return $message;
* Find the last character boundary prior to $maxLength in a utf-8
* quoted-printable encoded string.
* Original written by Colin Brown.
- * @access public
+ *
* @param string $encodedText utf-8 QP text
- * @param integer $maxLength Find the last character boundary prior to this length
- * @return integer
+ * @param int $maxLength Find the last character boundary prior to this length
+ *
+ * @return int
*/
public function utf8CharBoundary($encodedText, $maxLength)
{
// If the encoded char was found at pos 0, it will fit
// otherwise reduce maxLength to start of the encoded char
if ($encodedCharPos > 0) {
- $maxLength = $maxLength - ($lookBack - $encodedCharPos);
+ $maxLength -= $lookBack - $encodedCharPos;
}
$foundSplitPos = true;
} elseif ($dec >= 192) {
// First byte of a multi byte character
// Reduce maxLength to split at start of character
- $maxLength = $maxLength - ($lookBack - $encodedCharPos);
+ $maxLength -= $lookBack - $encodedCharPos;
$foundSplitPos = true;
} elseif ($dec < 192) {
// Middle byte of a multi byte character, look further back
$foundSplitPos = true;
}
}
+
return $maxLength;
}
* 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.
- * @access public
- * @return void
*/
public function setWordWrap()
{
/**
* Assemble message headers.
- * @access public
+ *
* @return string The assembled headers
*/
public function createHeader()
{
$result = '';
- if ($this->MessageDate == '') {
- $this->MessageDate = self::rfcDate();
- }
- $result .= $this->headerLine('Date', $this->MessageDate);
+ $result .= $this->headerLine('Date', '' === $this->MessageDate ? self::rfcDate() : $this->MessageDate);
// To be created automatically by mail()
if ($this->SingleTo) {
- if ($this->Mailer != 'mail') {
+ if ('mail' !== $this->Mailer) {
foreach ($this->to as $toaddr) {
$this->SingleToArray[] = $this->addrFormat($toaddr);
}
}
- } else {
- if (count($this->to) > 0) {
- if ($this->Mailer != 'mail') {
- $result .= $this->addrAppend('To', $this->to);
- }
- } elseif (count($this->cc) == 0) {
- $result .= $this->headerLine('To', 'undisclosed-recipients:;');
+ } elseif (count($this->to) > 0) {
+ if ('mail' !== $this->Mailer) {
+ $result .= $this->addrAppend('To', $this->to);
}
+ } elseif (count($this->cc) === 0) {
+ $result .= $this->headerLine('To', 'undisclosed-recipients:;');
}
- $result .= $this->addrAppend('From', array(array(trim($this->From), $this->FromName)));
+ $result .= $this->addrAppend('From', [[trim($this->From), $this->FromName]]);
// sendmail and mail() extract Cc from the header before sending
if (count($this->cc) > 0) {
// sendmail and mail() extract Bcc from the header before sending
if ((
- $this->Mailer == 'sendmail' or $this->Mailer == 'qmail' or $this->Mailer == 'mail'
+ 'sendmail' === $this->Mailer || 'qmail' === $this->Mailer || 'mail' === $this->Mailer
)
- and count($this->bcc) > 0
+ && count($this->bcc) > 0
) {
$result .= $this->addrAppend('Bcc', $this->bcc);
}
}
// mail() sets the subject itself
- if ($this->Mailer != 'mail') {
+ if ('mail' !== $this->Mailer) {
$result .= $this->headerLine('Subject', $this->encodeHeader($this->secureHeader($this->Subject)));
}
- if ('' != $this->MessageID and preg_match('/^<.*@.*>$/', $this->MessageID)) {
+ // Only allow a custom message ID if it conforms to RFC 5322 section 3.6.4
+ // https://tools.ietf.org/html/rfc5322#section-3.6.4
+ if ('' !== $this->MessageID && preg_match('/^<.*@.*>$/', $this->MessageID)) {
$this->lastMessageID = $this->MessageID;
} else {
$this->lastMessageID = sprintf('<%s@%s>', $this->uniqueid, $this->serverHostname());
}
$result .= $this->headerLine('Message-ID', $this->lastMessageID);
- if (!is_null($this->Priority)) {
+ if (null !== $this->Priority) {
$result .= $this->headerLine('X-Priority', $this->Priority);
}
- if ($this->XMailer == '') {
+ if ('' === $this->XMailer) {
$result .= $this->headerLine(
'X-Mailer',
- 'PHPMailer ' . $this->Version . ' (https://github.com/PHPMailer/PHPMailer)'
+ 'PHPMailer ' . self::VERSION . ' (https://github.com/PHPMailer/PHPMailer)'
);
} else {
$myXmailer = trim($this->XMailer);
}
}
- if ($this->ConfirmReadingTo != '') {
+ if ('' !== $this->ConfirmReadingTo) {
$result .= $this->headerLine('Disposition-Notification-To', '<' . $this->ConfirmReadingTo . '>');
}
/**
* Get the message MIME type headers.
- * @access public
+ *
* @return string
*/
public function getMailMIME()
$ismultipart = true;
switch ($this->message_type) {
case 'inline':
- $result .= $this->headerLine('Content-Type', 'multipart/related;');
- $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
+ $result .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED . ';');
+ $result .= $this->textLine(' boundary="' . $this->boundary[1] . '"');
break;
case 'attach':
case 'inline_attach':
case 'alt_attach':
case 'alt_inline_attach':
- $result .= $this->headerLine('Content-Type', 'multipart/mixed;');
- $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
+ $result .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_MIXED . ';');
+ $result .= $this->textLine(' boundary="' . $this->boundary[1] . '"');
break;
case 'alt':
case 'alt_inline':
- $result .= $this->headerLine('Content-Type', 'multipart/alternative;');
- $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
+ $result .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_ALTERNATIVE . ';');
+ $result .= $this->textLine(' boundary="' . $this->boundary[1] . '"');
break;
default:
// Catches case 'plain': and case '':
break;
}
// RFC1341 part 5 says 7bit is assumed if not specified
- if ($this->Encoding != '7bit') {
+ if (static::ENCODING_7BIT !== $this->Encoding) {
// RFC 2045 section 6.4 says multipart MIME parts may only use 7bit, 8bit or binary CTE
if ($ismultipart) {
- if ($this->Encoding == '8bit') {
- $result .= $this->headerLine('Content-Transfer-Encoding', '8bit');
+ if (static::ENCODING_8BIT === $this->Encoding) {
+ $result .= $this->headerLine('Content-Transfer-Encoding', static::ENCODING_8BIT);
}
// The only remaining alternatives are quoted-printable and base64, which are both 7bit compatible
} else {
}
}
- if ($this->Mailer != 'mail') {
- $result .= $this->LE;
+ if ('mail' !== $this->Mailer) {
+// $result .= static::$LE;
}
return $result;
* Returns the whole MIME message.
* Includes complete headers and body.
* Only valid post preSend().
+ *
* @see PHPMailer::preSend()
- * @access public
+ *
* @return string
*/
public function getSentMIMEMessage()
{
- return rtrim($this->MIMEHeader . $this->mailHeader, "\n\r") . self::CRLF . self::CRLF . $this->MIMEBody;
+ return rtrim($this->MIMEHeader . $this->mailHeader, "\n\r") . static::$LE . static::$LE . $this->MIMEBody;
+ }
+
+ /**
+ * Create a unique ID to use for boundaries.
+ *
+ * @return string
+ */
+ protected function generateId()
+ {
+ $len = 32; //32 bytes = 256 bits
+ $bytes = '';
+ if (function_exists('random_bytes')) {
+ try {
+ $bytes = random_bytes($len);
+ } catch (\Exception $e) {
+ //Do nothing
+ }
+ } elseif (function_exists('openssl_random_pseudo_bytes')) {
+ /** @noinspection CryptographicallySecureRandomnessInspection */
+ $bytes = openssl_random_pseudo_bytes($len);
+ }
+ if ($bytes === '') {
+ //We failed to produce a proper random string, so make do.
+ //Use a hash to force the length to the same as the other methods
+ $bytes = hash('sha256', uniqid((string) mt_rand(), true), true);
+ }
+
+ //We don't care about messing up base64 format here, just want a random string
+ return str_replace(['=', '+', '/'], '', base64_encode(hash('sha256', $bytes, true)));
}
/**
* Assemble the message body.
* Returns an empty string on failure.
- * @access public
- * @throws phpmailerException
+ *
+ * @throws Exception
+ *
* @return string The assembled message body
*/
public function createBody()
{
$body = '';
//Create unique IDs and preset boundaries
- $this->uniqueid = md5(uniqid(time()));
+ $this->uniqueid = $this->generateId();
$this->boundary[1] = 'b1_' . $this->uniqueid;
$this->boundary[2] = 'b2_' . $this->uniqueid;
$this->boundary[3] = 'b3_' . $this->uniqueid;
if ($this->sign_key_file) {
- $body .= $this->getMailMIME() . $this->LE;
+ $body .= $this->getMailMIME() . static::$LE;
}
$this->setWordWrap();
$bodyEncoding = $this->Encoding;
$bodyCharSet = $this->CharSet;
//Can we do a 7-bit downgrade?
- if ($bodyEncoding == '8bit' and !$this->has8bitChars($this->Body)) {
- $bodyEncoding = '7bit';
+ if (static::ENCODING_8BIT === $bodyEncoding && !$this->has8bitChars($this->Body)) {
+ $bodyEncoding = static::ENCODING_7BIT;
//All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit
- $bodyCharSet = 'us-ascii';
+ $bodyCharSet = static::CHARSET_ASCII;
}
//If lines are too long, and we're not already using an encoding that will shorten them,
//change to quoted-printable transfer encoding for the body part only
- if ('base64' != $this->Encoding and self::hasLineLongerThanMax($this->Body)) {
- $bodyEncoding = 'quoted-printable';
+ if (static::ENCODING_BASE64 !== $this->Encoding && static::hasLineLongerThanMax($this->Body)) {
+ $bodyEncoding = static::ENCODING_QUOTED_PRINTABLE;
}
$altBodyEncoding = $this->Encoding;
$altBodyCharSet = $this->CharSet;
//Can we do a 7-bit downgrade?
- if ($altBodyEncoding == '8bit' and !$this->has8bitChars($this->AltBody)) {
- $altBodyEncoding = '7bit';
+ if (static::ENCODING_8BIT === $altBodyEncoding && !$this->has8bitChars($this->AltBody)) {
+ $altBodyEncoding = static::ENCODING_7BIT;
//All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit
- $altBodyCharSet = 'us-ascii';
+ $altBodyCharSet = static::CHARSET_ASCII;
}
//If lines are too long, and we're not already using an encoding that will shorten them,
//change to quoted-printable transfer encoding for the alt body part only
- if ('base64' != $altBodyEncoding and self::hasLineLongerThanMax($this->AltBody)) {
- $altBodyEncoding = 'quoted-printable';
+ if (static::ENCODING_BASE64 !== $altBodyEncoding && static::hasLineLongerThanMax($this->AltBody)) {
+ $altBodyEncoding = static::ENCODING_QUOTED_PRINTABLE;
}
//Use this as a preamble in all multipart message types
- $mimepre = "This is a multi-part message in MIME format." . $this->LE . $this->LE;
+ $mimepre = 'This is a multi-part message in MIME format.' . static::$LE;
switch ($this->message_type) {
case 'inline':
$body .= $mimepre;
$body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
$body .= $this->encodeString($this->Body, $bodyEncoding);
- $body .= $this->LE . $this->LE;
+ $body .= static::$LE;
$body .= $this->attachAll('inline', $this->boundary[1]);
break;
case 'attach':
$body .= $mimepre;
$body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
$body .= $this->encodeString($this->Body, $bodyEncoding);
- $body .= $this->LE . $this->LE;
+ $body .= static::$LE;
$body .= $this->attachAll('attachment', $this->boundary[1]);
break;
case 'inline_attach':
$body .= $mimepre;
$body .= $this->textLine('--' . $this->boundary[1]);
- $body .= $this->headerLine('Content-Type', 'multipart/related;');
- $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
- $body .= $this->LE;
+ $body .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED . ';');
+ $body .= $this->textLine(' boundary="' . $this->boundary[2] . '";');
+ $body .= $this->textLine(' type="' . static::CONTENT_TYPE_TEXT_HTML . '"');
+ $body .= static::$LE;
$body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding);
$body .= $this->encodeString($this->Body, $bodyEncoding);
- $body .= $this->LE . $this->LE;
+ $body .= static::$LE;
$body .= $this->attachAll('inline', $this->boundary[2]);
- $body .= $this->LE;
+ $body .= static::$LE;
$body .= $this->attachAll('attachment', $this->boundary[1]);
break;
case 'alt':
$body .= $mimepre;
- $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
+ $body .= $this->getBoundary(
+ $this->boundary[1],
+ $altBodyCharSet,
+ static::CONTENT_TYPE_PLAINTEXT,
+ $altBodyEncoding
+ );
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
- $body .= $this->LE . $this->LE;
- $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, 'text/html', $bodyEncoding);
+ $body .= static::$LE;
+ $body .= $this->getBoundary(
+ $this->boundary[1],
+ $bodyCharSet,
+ static::CONTENT_TYPE_TEXT_HTML,
+ $bodyEncoding
+ );
$body .= $this->encodeString($this->Body, $bodyEncoding);
- $body .= $this->LE . $this->LE;
+ $body .= static::$LE;
if (!empty($this->Ical)) {
- $body .= $this->getBoundary($this->boundary[1], '', 'text/calendar; method=REQUEST', '');
+ $method = static::ICAL_METHOD_REQUEST;
+ foreach (static::$IcalMethods as $imethod) {
+ if (stripos($this->Ical, 'METHOD:' . $imethod) !== false) {
+ $method = $imethod;
+ break;
+ }
+ }
+ $body .= $this->getBoundary(
+ $this->boundary[1],
+ '',
+ static::CONTENT_TYPE_TEXT_CALENDAR . '; method=' . $method,
+ ''
+ );
$body .= $this->encodeString($this->Ical, $this->Encoding);
- $body .= $this->LE . $this->LE;
+ $body .= static::$LE;
}
$body .= $this->endBoundary($this->boundary[1]);
break;
case 'alt_inline':
$body .= $mimepre;
- $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
+ $body .= $this->getBoundary(
+ $this->boundary[1],
+ $altBodyCharSet,
+ static::CONTENT_TYPE_PLAINTEXT,
+ $altBodyEncoding
+ );
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
- $body .= $this->LE . $this->LE;
+ $body .= static::$LE;
$body .= $this->textLine('--' . $this->boundary[1]);
- $body .= $this->headerLine('Content-Type', 'multipart/related;');
- $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
- $body .= $this->LE;
- $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
+ $body .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED . ';');
+ $body .= $this->textLine(' boundary="' . $this->boundary[2] . '";');
+ $body .= $this->textLine(' type="' . static::CONTENT_TYPE_TEXT_HTML . '"');
+ $body .= static::$LE;
+ $body .= $this->getBoundary(
+ $this->boundary[2],
+ $bodyCharSet,
+ static::CONTENT_TYPE_TEXT_HTML,
+ $bodyEncoding
+ );
$body .= $this->encodeString($this->Body, $bodyEncoding);
- $body .= $this->LE . $this->LE;
+ $body .= static::$LE;
$body .= $this->attachAll('inline', $this->boundary[2]);
- $body .= $this->LE;
+ $body .= static::$LE;
$body .= $this->endBoundary($this->boundary[1]);
break;
case 'alt_attach':
$body .= $mimepre;
$body .= $this->textLine('--' . $this->boundary[1]);
- $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
- $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
- $body .= $this->LE;
- $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
+ $body .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_ALTERNATIVE . ';');
+ $body .= $this->textLine(' boundary="' . $this->boundary[2] . '"');
+ $body .= static::$LE;
+ $body .= $this->getBoundary(
+ $this->boundary[2],
+ $altBodyCharSet,
+ static::CONTENT_TYPE_PLAINTEXT,
+ $altBodyEncoding
+ );
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
- $body .= $this->LE . $this->LE;
- $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
+ $body .= static::$LE;
+ $body .= $this->getBoundary(
+ $this->boundary[2],
+ $bodyCharSet,
+ static::CONTENT_TYPE_TEXT_HTML,
+ $bodyEncoding
+ );
$body .= $this->encodeString($this->Body, $bodyEncoding);
- $body .= $this->LE . $this->LE;
+ $body .= static::$LE;
+ if (!empty($this->Ical)) {
+ $method = static::ICAL_METHOD_REQUEST;
+ foreach (static::$IcalMethods as $imethod) {
+ if (stripos($this->Ical, 'METHOD:' . $imethod) !== false) {
+ $method = $imethod;
+ break;
+ }
+ }
+ $body .= $this->getBoundary(
+ $this->boundary[2],
+ '',
+ static::CONTENT_TYPE_TEXT_CALENDAR . '; method=' . $method,
+ ''
+ );
+ $body .= $this->encodeString($this->Ical, $this->Encoding);
+ }
$body .= $this->endBoundary($this->boundary[2]);
- $body .= $this->LE;
+ $body .= static::$LE;
$body .= $this->attachAll('attachment', $this->boundary[1]);
break;
case 'alt_inline_attach':
$body .= $mimepre;
$body .= $this->textLine('--' . $this->boundary[1]);
- $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
- $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
- $body .= $this->LE;
- $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
+ $body .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_ALTERNATIVE . ';');
+ $body .= $this->textLine(' boundary="' . $this->boundary[2] . '"');
+ $body .= static::$LE;
+ $body .= $this->getBoundary(
+ $this->boundary[2],
+ $altBodyCharSet,
+ static::CONTENT_TYPE_PLAINTEXT,
+ $altBodyEncoding
+ );
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
- $body .= $this->LE . $this->LE;
+ $body .= static::$LE;
$body .= $this->textLine('--' . $this->boundary[2]);
- $body .= $this->headerLine('Content-Type', 'multipart/related;');
- $body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"');
- $body .= $this->LE;
- $body .= $this->getBoundary($this->boundary[3], $bodyCharSet, 'text/html', $bodyEncoding);
+ $body .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED . ';');
+ $body .= $this->textLine(' boundary="' . $this->boundary[3] . '";');
+ $body .= $this->textLine(' type="' . static::CONTENT_TYPE_TEXT_HTML . '"');
+ $body .= static::$LE;
+ $body .= $this->getBoundary(
+ $this->boundary[3],
+ $bodyCharSet,
+ static::CONTENT_TYPE_TEXT_HTML,
+ $bodyEncoding
+ );
$body .= $this->encodeString($this->Body, $bodyEncoding);
- $body .= $this->LE . $this->LE;
+ $body .= static::$LE;
$body .= $this->attachAll('inline', $this->boundary[3]);
- $body .= $this->LE;
+ $body .= static::$LE;
$body .= $this->endBoundary($this->boundary[2]);
- $body .= $this->LE;
+ $body .= static::$LE;
$body .= $this->attachAll('attachment', $this->boundary[1]);
break;
default:
if ($this->isError()) {
$body = '';
+ if ($this->exceptions) {
+ throw new Exception($this->lang('empty_message'), self::STOP_CRITICAL);
+ }
} elseif ($this->sign_key_file) {
try {
if (!defined('PKCS7_TEXT')) {
- throw new phpmailerException($this->lang('extension_missing') . 'openssl');
+ throw new Exception($this->lang('extension_missing') . 'openssl');
}
- // @TODO would be nice to use php://temp streams here, but need to wrap for PHP < 5.1
- $file = tempnam(sys_get_temp_dir(), 'mail');
- if (false === file_put_contents($file, $body)) {
- throw new phpmailerException($this->lang('signing') . ' Could not write temp file');
- }
- $signed = tempnam(sys_get_temp_dir(), 'signed');
+
+ $file = tempnam(sys_get_temp_dir(), 'srcsign');
+ $signed = tempnam(sys_get_temp_dir(), 'mailsign');
+ file_put_contents($file, $body);
+
//Workaround for PHP bug https://bugs.php.net/bug.php?id=69197
if (empty($this->sign_extracerts_file)) {
$sign = @openssl_pkcs7_sign(
$file,
$signed,
'file://' . realpath($this->sign_cert_file),
- array('file://' . realpath($this->sign_key_file), $this->sign_key_pass),
- null
+ ['file://' . realpath($this->sign_key_file), $this->sign_key_pass],
+ []
);
} else {
$sign = @openssl_pkcs7_sign(
$file,
$signed,
'file://' . realpath($this->sign_cert_file),
- array('file://' . realpath($this->sign_key_file), $this->sign_key_pass),
- null,
+ ['file://' . realpath($this->sign_key_file), $this->sign_key_pass],
+ [],
PKCS7_DETACHED,
$this->sign_extracerts_file
);
}
+
+ @unlink($file);
if ($sign) {
- @unlink($file);
$body = file_get_contents($signed);
@unlink($signed);
//The message returned by openssl contains both headers and body, so need to split them up
$parts = explode("\n\n", $body, 2);
- $this->MIMEHeader .= $parts[0] . $this->LE . $this->LE;
+ $this->MIMEHeader .= $parts[0] . static::$LE . static::$LE;
$body = $parts[1];
} else {
- @unlink($file);
@unlink($signed);
- throw new phpmailerException($this->lang('signing') . openssl_error_string());
+ throw new Exception($this->lang('signing') . openssl_error_string());
}
- } catch (phpmailerException $exc) {
+ } catch (Exception $exc) {
$body = '';
if ($this->exceptions) {
throw $exc;
}
}
}
+
return $body;
}
/**
* Return the start of a message boundary.
- * @access protected
+ *
* @param string $boundary
* @param string $charSet
* @param string $contentType
* @param string $encoding
+ *
* @return string
*/
protected function getBoundary($boundary, $charSet, $contentType, $encoding)
{
$result = '';
- if ($charSet == '') {
+ if ('' === $charSet) {
$charSet = $this->CharSet;
}
- if ($contentType == '') {
+ if ('' === $contentType) {
$contentType = $this->ContentType;
}
- if ($encoding == '') {
+ if ('' === $encoding) {
$encoding = $this->Encoding;
}
$result .= $this->textLine('--' . $boundary);
$result .= sprintf('Content-Type: %s; charset=%s', $contentType, $charSet);
- $result .= $this->LE;
+ $result .= static::$LE;
// RFC1341 part 5 says 7bit is assumed if not specified
- if ($encoding != '7bit') {
+ if (static::ENCODING_7BIT !== $encoding) {
$result .= $this->headerLine('Content-Transfer-Encoding', $encoding);
}
- $result .= $this->LE;
+ $result .= static::$LE;
return $result;
}
/**
* Return the end of a message boundary.
- * @access protected
+ *
* @param string $boundary
+ *
* @return string
*/
protected function endBoundary($boundary)
{
- return $this->LE . '--' . $boundary . '--' . $this->LE;
+ return static::$LE . '--' . $boundary . '--' . static::$LE;
}
/**
* Set the message type.
* PHPMailer only supports some preset message types, not arbitrary MIME structures.
- * @access protected
- * @return void
*/
protected function setMessageType()
{
- $type = array();
+ $type = [];
if ($this->alternativeExists()) {
$type[] = 'alt';
}
$type[] = 'attach';
}
$this->message_type = implode('_', $type);
- if ($this->message_type == '') {
+ if ('' === $this->message_type) {
//The 'plain' message_type refers to the message having a single body element, not that it is plain-text
$this->message_type = 'plain';
}
/**
* Format a header line.
- * @access public
- * @param string $name
- * @param string $value
+ *
+ * @param string $name
+ * @param string|int $value
+ *
* @return string
*/
public function headerLine($name, $value)
{
- return $name . ': ' . $value . $this->LE;
+ return $name . ': ' . $value . static::$LE;
}
/**
* Return a formatted mail line.
- * @access public
+ *
* @param string $value
+ *
* @return string
*/
public function textLine($value)
{
- return $value . $this->LE;
+ return $value . static::$LE;
}
/**
* 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 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.
+ * Explicitly *does not* support passing URLs; PHPMailer is not an HTTP client.
+ * If you need to do that, fetch the resource yourself and pass it in via a local file or string.
+ *
+ * @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
- * @throws phpmailerException
- * @return boolean
+ *
+ * @throws Exception
+ *
+ * @return bool
*/
- public function addAttachment($path, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment')
- {
+ public function addAttachment(
+ $path,
+ $name = '',
+ $encoding = self::ENCODING_BASE64,
+ $type = '',
+ $disposition = 'attachment'
+ ) {
try {
- if (!@is_file($path)) {
- throw new phpmailerException($this->lang('file_access') . $path, self::STOP_CONTINUE);
+ if (!static::isPermittedPath($path) || !@is_file($path)) {
+ throw new Exception($this->lang('file_access') . $path, self::STOP_CONTINUE);
}
// If a MIME type is not specified, try to work it out from the file name
- if ($type == '') {
- $type = self::filenameToType($path);
+ if ('' === $type) {
+ $type = static::filenameToType($path);
}
- $filename = basename($path);
- if ($name == '') {
+ $filename = (string) static::mb_pathinfo($path, PATHINFO_BASENAME);
+ if ('' === $name) {
$name = $filename;
}
- $this->attachment[] = array(
+ if (!$this->validateEncoding($encoding)) {
+ throw new Exception($this->lang('encoding') . $encoding);
+ }
+
+ $this->attachment[] = [
0 => $path,
1 => $filename,
2 => $name,
4 => $type,
5 => false, // isStringAttachment
6 => $disposition,
- 7 => 0
- );
-
- } catch (phpmailerException $exc) {
+ 7 => $name,
+ ];
+ } catch (Exception $exc) {
$this->setError($exc->getMessage());
$this->edebug($exc->getMessage());
if ($this->exceptions) {
throw $exc;
}
+
return false;
}
+
return true;
}
/**
* Return the array of attachments.
+ *
* @return array
*/
public function getAttachments()
/**
* Attach all file, string, and binary attachments to the message.
* Returns an empty string on failure.
- * @access protected
+ *
* @param string $disposition_type
* @param string $boundary
+ *
+ * @throws Exception
+ *
* @return string
*/
protected function attachAll($disposition_type, $boundary)
{
// Return text of body
- $mime = array();
- $cidUniq = array();
- $incl = array();
+ $mime = [];
+ $cidUniq = [];
+ $incl = [];
// Add all attachments
foreach ($this->attachment as $attachment) {
// Check if it is a valid disposition_filter
- if ($attachment[6] == $disposition_type) {
+ if ($attachment[6] === $disposition_type) {
// Check for string attachment
$string = '';
$path = '';
$path = $attachment[0];
}
- $inclhash = md5(serialize($attachment));
- if (in_array($inclhash, $incl)) {
+ $inclhash = hash('sha256', serialize($attachment));
+ if (in_array($inclhash, $incl, true)) {
continue;
}
$incl[] = $inclhash;
$type = $attachment[4];
$disposition = $attachment[6];
$cid = $attachment[7];
- if ($disposition == 'inline' && array_key_exists($cid, $cidUniq)) {
+ if ('inline' === $disposition && array_key_exists($cid, $cidUniq)) {
continue;
}
$cidUniq[$cid] = true;
- $mime[] = sprintf('--%s%s', $boundary, $this->LE);
+ $mime[] = sprintf('--%s%s', $boundary, static::$LE);
//Only include a filename property if we have one
if (!empty($name)) {
$mime[] = sprintf(
'Content-Type: %s; name="%s"%s',
$type,
$this->encodeHeader($this->secureHeader($name)),
- $this->LE
+ static::$LE
);
} else {
$mime[] = sprintf(
'Content-Type: %s%s',
$type,
- $this->LE
+ static::$LE
);
}
// RFC1341 part 5 says 7bit is assumed if not specified
- if ($encoding != '7bit') {
- $mime[] = sprintf('Content-Transfer-Encoding: %s%s', $encoding, $this->LE);
+ if (static::ENCODING_7BIT !== $encoding) {
+ $mime[] = sprintf('Content-Transfer-Encoding: %s%s', $encoding, static::$LE);
}
- if ($disposition == 'inline') {
- $mime[] = sprintf('Content-ID: <%s>%s', $cid, $this->LE);
+ //Only set Content-IDs on inline attachments
+ if ((string) $cid !== '' && $disposition === 'inline') {
+ $mime[] = 'Content-ID: <' . $this->encodeHeader($this->secureHeader($cid)) . '>' . static::$LE;
}
// If a filename contains any of these chars, it should be quoted,
// but not otherwise: RFC2183 & RFC2045 5.1
// Fixes a warning in IETF's msglint MIME checker
// Allow for bypassing the Content-Disposition header totally
- if (!(empty($disposition))) {
+ if (!empty($disposition)) {
$encoded_name = $this->encodeHeader($this->secureHeader($name));
- if (preg_match('/[ \(\)<>@,;:\\"\/\[\]\?=]/', $encoded_name)) {
+ if (preg_match('/[ ()<>@,;:"\/\[\]?=]/', $encoded_name)) {
$mime[] = sprintf(
'Content-Disposition: %s; filename="%s"%s',
$disposition,
$encoded_name,
- $this->LE . $this->LE
+ static::$LE . static::$LE
+ );
+ } elseif (!empty($encoded_name)) {
+ $mime[] = sprintf(
+ 'Content-Disposition: %s; filename=%s%s',
+ $disposition,
+ $encoded_name,
+ static::$LE . static::$LE
);
} else {
- if (!empty($encoded_name)) {
- $mime[] = sprintf(
- 'Content-Disposition: %s; filename=%s%s',
- $disposition,
- $encoded_name,
- $this->LE . $this->LE
- );
- } else {
- $mime[] = sprintf(
- 'Content-Disposition: %s%s',
- $disposition,
- $this->LE . $this->LE
- );
- }
+ $mime[] = sprintf(
+ 'Content-Disposition: %s%s',
+ $disposition,
+ static::$LE . static::$LE
+ );
}
} else {
- $mime[] = $this->LE;
+ $mime[] = static::$LE;
}
// Encode as string attachment
if ($bString) {
$mime[] = $this->encodeString($string, $encoding);
- if ($this->isError()) {
- return '';
- }
- $mime[] = $this->LE . $this->LE;
} else {
$mime[] = $this->encodeFile($path, $encoding);
- if ($this->isError()) {
- return '';
- }
- $mime[] = $this->LE . $this->LE;
}
+ if ($this->isError()) {
+ return '';
+ }
+ $mime[] = static::$LE;
}
}
- $mime[] = sprintf('--%s--%s', $boundary, $this->LE);
+ $mime[] = sprintf('--%s--%s', $boundary, static::$LE);
return implode('', $mime);
}
/**
* Encode a file attachment in requested format.
* Returns an empty string on failure.
- * @param string $path The full path to the file
+ *
+ * @param string $path The full path to the file
* @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
- * @throws phpmailerException
- * @access protected
+ *
* @return string
*/
- protected function encodeFile($path, $encoding = 'base64')
+ protected function encodeFile($path, $encoding = self::ENCODING_BASE64)
{
try {
- if (!is_readable($path)) {
- throw new phpmailerException($this->lang('file_open') . $path, self::STOP_CONTINUE);
- }
- $magic_quotes = get_magic_quotes_runtime();
- if ($magic_quotes) {
- if (version_compare(PHP_VERSION, '5.3.0', '<')) {
- set_magic_quotes_runtime(false);
- } else {
- //Doesn't exist in PHP 5.4, but we don't need to check because
- //get_magic_quotes_runtime always returns false in 5.4+
- //so it will never get here
- ini_set('magic_quotes_runtime', false);
- }
+ if (!static::isPermittedPath($path) || !file_exists($path)) {
+ throw new Exception($this->lang('file_open') . $path, self::STOP_CONTINUE);
}
$file_buffer = file_get_contents($path);
- $file_buffer = $this->encodeString($file_buffer, $encoding);
- if ($magic_quotes) {
- if (version_compare(PHP_VERSION, '5.3.0', '<')) {
- set_magic_quotes_runtime($magic_quotes);
- } else {
- ini_set('magic_quotes_runtime', $magic_quotes);
- }
+ if (false === $file_buffer) {
+ throw new Exception($this->lang('file_open') . $path, self::STOP_CONTINUE);
}
+ $file_buffer = $this->encodeString($file_buffer, $encoding);
+
return $file_buffer;
} catch (Exception $exc) {
$this->setError($exc->getMessage());
+
return '';
}
}
/**
* Encode a string in requested format.
* Returns an empty string on failure.
- * @param string $str The text to encode
+ *
+ * @param string $str The text to encode
* @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
- * @access public
+ *
+ * @throws Exception
+ *
* @return string
*/
- public function encodeString($str, $encoding = 'base64')
+ public function encodeString($str, $encoding = self::ENCODING_BASE64)
{
$encoded = '';
switch (strtolower($encoding)) {
- case 'base64':
- $encoded = chunk_split(base64_encode($str), 76, $this->LE);
+ case static::ENCODING_BASE64:
+ $encoded = chunk_split(
+ base64_encode($str),
+ static::STD_LINE_LENGTH,
+ static::$LE
+ );
break;
- case '7bit':
- case '8bit':
- $encoded = $this->fixEOL($str);
+ case static::ENCODING_7BIT:
+ case static::ENCODING_8BIT:
+ $encoded = static::normalizeBreaks($str);
// Make sure it ends with a line break
- if (substr($encoded, -(strlen($this->LE))) != $this->LE) {
- $encoded .= $this->LE;
+ if (substr($encoded, -(strlen(static::$LE))) !== static::$LE) {
+ $encoded .= static::$LE;
}
break;
- case 'binary':
+ case static::ENCODING_BINARY:
$encoded = $str;
break;
- case 'quoted-printable':
+ case static::ENCODING_QUOTED_PRINTABLE:
$encoded = $this->encodeQP($str);
break;
default:
$this->setError($this->lang('encoding') . $encoding);
+ if ($this->exceptions) {
+ throw new Exception($this->lang('encoding') . $encoding);
+ }
break;
}
+
return $encoded;
}
/**
- * Encode a header string optimally.
- * Picks shortest of Q, B, quoted-printable or none.
- * @access public
- * @param string $str
- * @param string $position
+ * Encode a header value (not including its label) optimally.
+ * Picks shortest of Q, B, or none. Result includes folding if needed.
+ * See RFC822 definitions for phrase, comment and text positions.
+ *
+ * @param string $str The header value to encode
+ * @param string $position What context the string will be used in
+ *
* @return string
*/
public function encodeHeader($str, $position = 'text')
if (!preg_match('/[\200-\377]/', $str)) {
// Can't use addslashes as we don't know the value of magic_quotes_sybase
$encoded = addcslashes($str, "\0..\37\177\\\"");
- if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
- return ($encoded);
- } else {
- return ("\"$encoded\"");
+ if (($str === $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
+ return $encoded;
}
+
+ return "\"$encoded\"";
}
$matchcount = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
break;
- /** @noinspection PhpMissingBreakStatementInspection */
+ /* @noinspection PhpMissingBreakStatementInspection */
case 'comment':
$matchcount = preg_match_all('/[()"]/', $str, $matches);
- // Intentional fall-through
+ //fallthrough
case 'text':
default:
$matchcount += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
break;
}
- //There are no chars that need encoding
- if ($matchcount == 0) {
- return ($str);
+ if ($this->has8bitChars($str)) {
+ $charset = $this->CharSet;
+ } else {
+ $charset = static::CHARSET_ASCII;
+ }
+
+ // Q/B encoding adds 8 chars and the charset ("` =?<charset>?[QB]?<content>?=`").
+ $overhead = 8 + strlen($charset);
+
+ if ('mail' === $this->Mailer) {
+ $maxlen = static::MAIL_MAX_LINE_LENGTH - $overhead;
+ } else {
+ $maxlen = static::MAX_LINE_LENGTH - $overhead;
}
- $maxlen = 75 - 7 - strlen($this->CharSet);
- // Try to select the encoding which should produce the shortest output
+ // Select the encoding that produces the shortest output and/or prevents corruption.
if ($matchcount > strlen($str) / 3) {
- // More than a third of the content will need encoding, so B encoding will be most efficient
+ // More than 1/3 of the content needs encoding, use B-encode.
$encoding = 'B';
- if (function_exists('mb_strlen') && $this->hasMultiBytes($str)) {
- // Use a custom function which correctly encodes and wraps long
- // multibyte strings without breaking lines within a character
- $encoded = $this->base64EncodeWrapMB($str, "\n");
- } else {
- $encoded = base64_encode($str);
- $maxlen -= $maxlen % 4;
- $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
- }
- } else {
+ } elseif ($matchcount > 0) {
+ // Less than 1/3 of the content needs encoding, use Q-encode.
+ $encoding = 'Q';
+ } elseif (strlen($str) > $maxlen) {
+ // No encoding needed, but value exceeds max line length, use Q-encode to prevent corruption.
$encoding = 'Q';
- $encoded = $this->encodeQ($str, $position);
- $encoded = $this->wrapText($encoded, $maxlen, true);
- $encoded = str_replace('=' . self::CRLF, "\n", trim($encoded));
+ } else {
+ // No reformatting needed
+ $encoding = false;
}
- $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
- $encoded = trim(str_replace("\n", $this->LE, $encoded));
+ switch ($encoding) {
+ case 'B':
+ if ($this->hasMultiBytes($str)) {
+ // Use a custom function which correctly encodes and wraps long
+ // multibyte strings without breaking lines within a character
+ $encoded = $this->base64EncodeWrapMB($str, "\n");
+ } else {
+ $encoded = base64_encode($str);
+ $maxlen -= $maxlen % 4;
+ $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
+ }
+ $encoded = preg_replace('/^(.*)$/m', ' =?' . $charset . "?$encoding?\\1?=", $encoded);
+ break;
+ case 'Q':
+ $encoded = $this->encodeQ($str, $position);
+ $encoded = $this->wrapText($encoded, $maxlen, true);
+ $encoded = str_replace('=' . static::$LE, "\n", trim($encoded));
+ $encoded = preg_replace('/^(.*)$/m', ' =?' . $charset . "?$encoding?\\1?=", $encoded);
+ break;
+ default:
+ return $str;
+ }
- return $encoded;
+ return trim(static::normalizeBreaks($encoded));
}
/**
* Check if a string contains multi-byte characters.
- * @access public
+ *
* @param string $str multi-byte text to wrap encode
- * @return boolean
+ *
+ * @return bool
*/
public function hasMultiBytes($str)
{
if (function_exists('mb_strlen')) {
- return (strlen($str) > mb_strlen($str, $this->CharSet));
- } else { // Assume no multibytes (we can't handle without mbstring functions anyway)
- return false;
+ return strlen($str) > mb_strlen($str, $this->CharSet);
}
+
+ // Assume no multibytes (we can't handle without mbstring functions anyway)
+ return false;
}
/**
* Does a string contain any 8-bit chars (in any charset)?
+ *
* @param string $text
- * @return boolean
+ *
+ * @return bool
*/
public function has8bitChars($text)
{
- return (boolean)preg_match('/[\x80-\xFF]/', $text);
+ return (bool) preg_match('/[\x80-\xFF]/', $text);
}
/**
* Encode and wrap long multibyte strings for mail headers
* without breaking lines within a character.
- * Adapted from a function by paravoid
- * @link http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283
- * @access public
- * @param string $str multi-byte text to wrap encode
+ * Adapted from a function by paravoid.
+ *
+ * @see http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283
+ *
+ * @param string $str multi-byte text to wrap encode
* @param string $linebreak string to use as linefeed/end-of-line
+ *
* @return string
*/
public function base64EncodeWrapMB($str, $linebreak = null)
$start = '=?' . $this->CharSet . '?B?';
$end = '?=';
$encoded = '';
- if ($linebreak === null) {
- $linebreak = $this->LE;
+ if (null === $linebreak) {
+ $linebreak = static::$LE;
}
$mb_length = mb_strlen($str, $this->CharSet);
// Base64 has a 4:3 ratio
$avgLength = floor($length * $ratio * .75);
+ $offset = 0;
for ($i = 0; $i < $mb_length; $i += $offset) {
$lookBack = 0;
do {
$offset = $avgLength - $lookBack;
$chunk = mb_substr($str, $i, $offset, $this->CharSet);
$chunk = base64_encode($chunk);
- $lookBack++;
+ ++$lookBack;
} while (strlen($chunk) > $length);
$encoded .= $chunk . $linebreak;
}
// Chomp the last linefeed
- $encoded = substr($encoded, 0, -strlen($linebreak));
- return $encoded;
+ return substr($encoded, 0, -strlen($linebreak));
}
/**
* Encode a string in quoted-printable format.
* According to RFC2045 section 6.7.
- * @access public
+ *
* @param string $string The text to encode
- * @param integer $line_max Number of chars allowed on a line before wrapping
+ *
* @return string
- * @link http://www.php.net/manual/en/function.quoted-printable-decode.php#89417 Adapted from this comment
*/
- public function encodeQP($string, $line_max = 76)
+ public function encodeQP($string)
{
- // Use native function if it's available (>= PHP5.3)
- if (function_exists('quoted_printable_encode')) {
- return quoted_printable_encode($string);
- }
- // Fall back to a pure PHP implementation
- $string = str_replace(
- array('%20', '%0D%0A.', '%0D%0A', '%'),
- array(' ', "\r\n=2E", "\r\n", '='),
- rawurlencode($string)
- );
- return preg_replace('/[^\r\n]{' . ($line_max - 3) . '}[^=\r\n]{2}/', "$0=\r\n", $string);
- }
-
- /**
- * Backward compatibility wrapper for an old QP encoding function that was removed.
- * @see PHPMailer::encodeQP()
- * @access public
- * @param string $string
- * @param integer $line_max
- * @param boolean $space_conv
- * @return string
- * @deprecated Use encodeQP instead.
- */
- public function encodeQPphp(
- $string,
- $line_max = 76,
- /** @noinspection PhpUnusedParameterInspection */ $space_conv = false
- ) {
- return $this->encodeQP($string, $line_max);
+ return static::normalizeBreaks(quoted_printable_encode($string));
}
/**
* Encode a string using Q encoding.
- * @link http://tools.ietf.org/html/rfc2047
- * @param string $str the text to encode
+ *
+ * @see http://tools.ietf.org/html/rfc2047#section-4.2
+ *
+ * @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
- * @access public
+ *
* @return string
*/
public function encodeQ($str, $position = 'text')
{
// There should not be any EOL in the string
$pattern = '';
- $encoded = str_replace(array("\r", "\n"), '', $str);
+ $encoded = str_replace(["\r", "\n"], '', $str);
switch (strtolower($position)) {
case 'phrase':
// RFC 2047 section 5.3
$pattern = '^A-Za-z0-9!*+\/ -';
break;
- /** @noinspection PhpMissingBreakStatementInspection */
+ /*
+ * RFC 2047 section 5.2.
+ * Build $pattern without including delimiters and []
+ */
+ /* @noinspection PhpMissingBreakStatementInspection */
case 'comment':
- // RFC 2047 section 5.2
$pattern = '\(\)"';
- // intentional fall-through
- // for this reason we build the $pattern without including delimiters and []
+ /* Intentional fall through */
case 'text':
default:
// RFC 2047 section 5.1
$pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern;
break;
}
- $matches = array();
+ $matches = [];
if (preg_match_all("/[{$pattern}]/", $encoded, $matches)) {
// If the string contains an '=', make sure it's the first thing we replace
// so as to avoid double-encoding
- $eqkey = array_search('=', $matches[0]);
+ $eqkey = array_search('=', $matches[0], true);
if (false !== $eqkey) {
unset($matches[0][$eqkey]);
array_unshift($matches[0], '=');
$encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded);
}
}
- // Replace every spaces to _ (more readable than =20)
+ // Replace spaces with _ (more readable than =20)
+ // RFC 2047 section 4.2(2)
return str_replace(' ', '_', $encoded);
}
* 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 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 $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
+ *
+ * @throws Exception
+ *
+ * @return bool True on successfully adding an attachment
*/
public function addStringAttachment(
$string,
$filename,
- $encoding = 'base64',
+ $encoding = self::ENCODING_BASE64,
$type = '',
$disposition = 'attachment'
) {
- // If a MIME type is not specified, try to work it out from the file name
- if ($type == '') {
- $type = self::filenameToType($filename);
- }
- // Append to $attachment array
- $this->attachment[] = array(
- 0 => $string,
- 1 => $filename,
- 2 => basename($filename),
- 3 => $encoding,
- 4 => $type,
- 5 => true, // isStringAttachment
- 6 => $disposition,
- 7 => 0
- );
+ try {
+ // If a MIME type is not specified, try to work it out from the file name
+ if ('' === $type) {
+ $type = static::filenameToType($filename);
+ }
+
+ if (!$this->validateEncoding($encoding)) {
+ throw new Exception($this->lang('encoding') . $encoding);
+ }
+
+ // Append to $attachment array
+ $this->attachment[] = [
+ 0 => $string,
+ 1 => $filename,
+ 2 => static::mb_pathinfo($filename, PATHINFO_BASENAME),
+ 3 => $encoding,
+ 4 => $type,
+ 5 => true, // isStringAttachment
+ 6 => $disposition,
+ 7 => 0,
+ ];
+ } catch (Exception $exc) {
+ $this->setError($exc->getMessage());
+ $this->edebug($exc->getMessage());
+ if ($this->exceptions) {
+ throw $exc;
+ }
+
+ return false;
+ }
+
+ return true;
}
/**
* 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.
- * @param string $path Path to the attachment.
- * @param string $cid Content ID of the attachment; Use this to reference
- * the content when using an embedded image in HTML.
- * @param string $name Overrides the attachment name.
- * @param string $encoding File encoding (see $Encoding).
- * @param string $type File MIME type.
+ * Never use a user-supplied path to a file!
+ *
+ * @param string $path Path to the attachment
+ * @param string $cid Content ID of the attachment; Use this to reference
+ * the content when using an embedded image in HTML
+ * @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 boolean True on successfully adding an attachment
+ *
+ * @throws Exception
+ *
+ * @return bool True on successfully adding an attachment
*/
- public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline')
- {
- if (!@is_file($path)) {
- $this->setError($this->lang('file_access') . $path);
- return false;
- }
+ public function addEmbeddedImage(
+ $path,
+ $cid,
+ $name = '',
+ $encoding = self::ENCODING_BASE64,
+ $type = '',
+ $disposition = 'inline'
+ ) {
+ try {
+ if (!static::isPermittedPath($path) || !@is_file($path)) {
+ throw new Exception($this->lang('file_access') . $path, self::STOP_CONTINUE);
+ }
- // If a MIME type is not specified, try to work it out from the file name
- if ($type == '') {
- $type = self::filenameToType($path);
- }
+ // If a MIME type is not specified, try to work it out from the file name
+ if ('' === $type) {
+ $type = static::filenameToType($path);
+ }
+
+ if (!$this->validateEncoding($encoding)) {
+ throw new Exception($this->lang('encoding') . $encoding);
+ }
- $filename = basename($path);
- if ($name == '') {
- $name = $filename;
+ $filename = (string) static::mb_pathinfo($path, PATHINFO_BASENAME);
+ if ('' === $name) {
+ $name = $filename;
+ }
+
+ // Append to $attachment array
+ $this->attachment[] = [
+ 0 => $path,
+ 1 => $filename,
+ 2 => $name,
+ 3 => $encoding,
+ 4 => $type,
+ 5 => false, // isStringAttachment
+ 6 => $disposition,
+ 7 => $cid,
+ ];
+ } catch (Exception $exc) {
+ $this->setError($exc->getMessage());
+ $this->edebug($exc->getMessage());
+ if ($this->exceptions) {
+ throw $exc;
+ }
+
+ return false;
}
- // Append to $attachment array
- $this->attachment[] = array(
- 0 => $path,
- 1 => $filename,
- 2 => $name,
- 3 => $encoding,
- 4 => $type,
- 5 => false, // isStringAttachment
- 6 => $disposition,
- 7 => $cid
- );
return true;
}
/**
* 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
- * the content when using an embedded image in HTML.
- * @param string $name
- * @param string $encoding File encoding (see $Encoding).
- * @param string $type MIME type.
+ * If your filename doesn't contain an extension, be sure to set the $type to an appropriate MIME type.
+ *
+ * @param string $string The attachment binary data
+ * @param string $cid Content ID of the attachment; Use this to reference
+ * the content when using an embedded image in HTML
+ * @param string $name A filename for the attachment. If this contains an extension,
+ * PHPMailer will attempt to set a MIME type for the attachment.
+ * For example 'file.jpg' would get an 'image/jpeg' MIME type.
+ * @param string $encoding File encoding (see $Encoding), defaults to 'base64'
+ * @param string $type MIME type - will be used in preference to any automatically derived type
* @param string $disposition Disposition to use
- * @return boolean True on successfully adding an attachment
+ *
+ * @throws Exception
+ *
+ * @return bool True on successfully adding an attachment
*/
public function addStringEmbeddedImage(
$string,
$cid,
$name = '',
- $encoding = 'base64',
+ $encoding = self::ENCODING_BASE64,
$type = '',
$disposition = 'inline'
) {
- // If a MIME type is not specified, try to work it out from the name
- if ($type == '' and !empty($name)) {
- $type = self::filenameToType($name);
- }
-
- // Append to $attachment array
- $this->attachment[] = array(
- 0 => $string,
- 1 => $name,
- 2 => $name,
- 3 => $encoding,
- 4 => $type,
- 5 => true, // isStringAttachment
- 6 => $disposition,
- 7 => $cid
- );
+ try {
+ // If a MIME type is not specified, try to work it out from the name
+ if ('' === $type && !empty($name)) {
+ $type = static::filenameToType($name);
+ }
+
+ if (!$this->validateEncoding($encoding)) {
+ throw new Exception($this->lang('encoding') . $encoding);
+ }
+
+ // Append to $attachment array
+ $this->attachment[] = [
+ 0 => $string,
+ 1 => $name,
+ 2 => $name,
+ 3 => $encoding,
+ 4 => $type,
+ 5 => true, // isStringAttachment
+ 6 => $disposition,
+ 7 => $cid,
+ ];
+ } catch (Exception $exc) {
+ $this->setError($exc->getMessage());
+ $this->edebug($exc->getMessage());
+ if ($this->exceptions) {
+ throw $exc;
+ }
+
+ return false;
+ }
+
return true;
}
+ /**
+ * Validate encodings.
+ *
+ * @param string $encoding
+ *
+ * @return bool
+ */
+ protected function validateEncoding($encoding)
+ {
+ return in_array(
+ $encoding,
+ [
+ self::ENCODING_7BIT,
+ self::ENCODING_QUOTED_PRINTABLE,
+ self::ENCODING_BASE64,
+ self::ENCODING_8BIT,
+ self::ENCODING_BINARY,
+ ],
+ true
+ );
+ }
+
+ /**
+ * Check if an embedded attachment is present with this cid.
+ *
+ * @param string $cid
+ *
+ * @return bool
+ */
+ protected function cidExists($cid)
+ {
+ foreach ($this->attachment as $attachment) {
+ if ('inline' === $attachment[6] && $cid === $attachment[7]) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
/**
* Check if an inline attachment is present.
- * @access public
- * @return boolean
+ *
+ * @return bool
*/
public function inlineImageExists()
{
foreach ($this->attachment as $attachment) {
- if ($attachment[6] == 'inline') {
+ if ('inline' === $attachment[6]) {
return true;
}
}
+
return false;
}
/**
* Check if an attachment (non-inline) is present.
- * @return boolean
+ *
+ * @return bool
*/
public function attachmentExists()
{
foreach ($this->attachment as $attachment) {
- if ($attachment[6] == 'attachment') {
+ if ('attachment' === $attachment[6]) {
return true;
}
}
+
return false;
}
/**
* Check if this message has an alternative body set.
- * @return boolean
+ *
+ * @return bool
*/
public function alternativeExists()
{
/**
* Clear queued addresses of given kind.
- * @access protected
+ *
* @param string $kind 'to', 'cc', or 'bcc'
- * @return void
*/
public function clearQueuedAddresses($kind)
{
- $RecipientsQueue = $this->RecipientsQueue;
- foreach ($RecipientsQueue as $address => $params) {
- if ($params[0] == $kind) {
- unset($this->RecipientsQueue[$address]);
+ $this->RecipientsQueue = array_filter(
+ $this->RecipientsQueue,
+ static function ($params) use ($kind) {
+ return $params[0] !== $kind;
}
- }
+ );
}
/**
* Clear all To recipients.
- * @return void
*/
public function clearAddresses()
{
foreach ($this->to as $to) {
unset($this->all_recipients[strtolower($to[0])]);
}
- $this->to = array();
+ $this->to = [];
$this->clearQueuedAddresses('to');
}
/**
* Clear all CC recipients.
- * @return void
*/
public function clearCCs()
{
foreach ($this->cc as $cc) {
unset($this->all_recipients[strtolower($cc[0])]);
}
- $this->cc = array();
+ $this->cc = [];
$this->clearQueuedAddresses('cc');
}
/**
* Clear all BCC recipients.
- * @return void
*/
public function clearBCCs()
{
foreach ($this->bcc as $bcc) {
unset($this->all_recipients[strtolower($bcc[0])]);
}
- $this->bcc = array();
+ $this->bcc = [];
$this->clearQueuedAddresses('bcc');
}
/**
* Clear all ReplyTo recipients.
- * @return void
*/
public function clearReplyTos()
{
- $this->ReplyTo = array();
- $this->ReplyToQueue = array();
+ $this->ReplyTo = [];
+ $this->ReplyToQueue = [];
}
/**
* Clear all recipient types.
- * @return void
*/
public function clearAllRecipients()
{
- $this->to = array();
- $this->cc = array();
- $this->bcc = array();
- $this->all_recipients = array();
- $this->RecipientsQueue = array();
+ $this->to = [];
+ $this->cc = [];
+ $this->bcc = [];
+ $this->all_recipients = [];
+ $this->RecipientsQueue = [];
}
/**
* Clear all filesystem, string, and binary attachments.
- * @return void
*/
public function clearAttachments()
{
- $this->attachment = array();
+ $this->attachment = [];
}
/**
* Clear all custom headers.
- * @return void
*/
public function clearCustomHeaders()
{
- $this->CustomHeader = array();
+ $this->CustomHeader = [];
}
/**
* Add an error message to the error container.
- * @access protected
+ *
* @param string $msg
- * @return void
*/
protected function setError($msg)
{
- $this->error_count++;
- if ($this->Mailer == 'smtp' and !is_null($this->smtp)) {
+ ++$this->error_count;
+ if ('smtp' === $this->Mailer && null !== $this->smtp) {
$lasterror = $this->smtp->getError();
if (!empty($lasterror['error'])) {
$msg .= $this->lang('smtp_error') . $lasterror['error'];
if (!empty($lasterror['detail'])) {
- $msg .= ' Detail: '. $lasterror['detail'];
+ $msg .= ' Detail: ' . $lasterror['detail'];
}
if (!empty($lasterror['smtp_code'])) {
$msg .= ' SMTP code: ' . $lasterror['smtp_code'];
/**
* Return an RFC 822 formatted date.
- * @access public
+ *
* @return string
- * @static
*/
public static function rfcDate()
{
// Set the time zone to whatever the default is to avoid 500 errors
// Will default to UTC if it's not set properly in php.ini
date_default_timezone_set(@date_default_timezone_get());
+
return date('D, j M Y H:i:s O');
}
/**
* Get the server hostname.
* Returns 'localhost.localdomain' if unknown.
- * @access protected
+ *
* @return string
*/
protected function serverHostname()
{
- $result = 'localhost.localdomain';
+ $result = '';
if (!empty($this->Hostname)) {
$result = $this->Hostname;
- } elseif (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) {
+ } elseif (isset($_SERVER) && array_key_exists('SERVER_NAME', $_SERVER)) {
$result = $_SERVER['SERVER_NAME'];
} elseif (function_exists('gethostname') && gethostname() !== false) {
$result = gethostname();
} elseif (php_uname('n') !== false) {
$result = php_uname('n');
}
+ if (!static::isValidHost($result)) {
+ return 'localhost.localdomain';
+ }
+
return $result;
}
+ /**
+ * Validate whether a string contains a valid value to use as a hostname or IP address.
+ * IPv6 addresses must include [], e.g. `[::1]`, not just `::1`.
+ *
+ * @param string $host The host name or IP address to check
+ *
+ * @return bool
+ */
+ public static function isValidHost($host)
+ {
+ //Simple syntax limits
+ if (empty($host)
+ || !is_string($host)
+ || strlen($host) > 256
+ || !preg_match('/^([a-zA-Z\d.-]*|\[[a-fA-F\d:]+])$/', $host)
+ ) {
+ return false;
+ }
+ //Looks like a bracketed IPv6 address
+ if (strlen($host) > 2 && substr($host, 0, 1) === '[' && substr($host, -1, 1) === ']') {
+ return filter_var(substr($host, 1, -1), FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== false;
+ }
+ //If removing all the dots results in a numeric string, it must be an IPv4 address.
+ //Need to check this first because otherwise things like `999.0.0.0` are considered valid host names
+ if (is_numeric(str_replace('.', '', $host))) {
+ //Is it a valid IPv4 address?
+ return filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false;
+ }
+ if (filter_var('http://' . $host, FILTER_VALIDATE_URL) !== false) {
+ //Is it a syntactically valid hostname?
+ return true;
+ }
+
+ return false;
+ }
+
/**
* Get an error message in the current language.
- * @access protected
+ *
* @param string $key
+ *
* @return string
*/
protected function lang($key)
{
if (count($this->language) < 1) {
- $this->setLanguage('en'); // set the default language
+ $this->setLanguage(); // set the default language
}
if (array_key_exists($key, $this->language)) {
- if ($key == 'smtp_connect_failed') {
+ if ('smtp_connect_failed' === $key) {
//Include a link to troubleshooting docs on SMTP connection failure
//this is by far the biggest cause of support questions
//but it's usually not PHPMailer's fault.
return $this->language[$key] . ' https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting';
}
+
return $this->language[$key];
- } else {
- //Return the key as a fallback
- return $key;
}
+
+ //Return the key as a fallback
+ return $key;
}
/**
* Check if an error occurred.
- * @access public
- * @return boolean True if an error did occur.
+ *
+ * @return bool True if an error did occur
*/
public function isError()
{
- return ($this->error_count > 0);
- }
-
- /**
- * Ensure consistent line endings in a string.
- * Changes every end of line from CRLF, CR or LF to $this->LE.
- * @access public
- * @param string $str String to fixEOL
- * @return string
- */
- public function fixEOL($str)
- {
- // Normalise to \n
- $nstr = str_replace(array("\r\n", "\r"), "\n", $str);
- // Now convert LE as needed
- if ($this->LE !== "\n") {
- $nstr = str_replace("\n", $this->LE, $nstr);
- }
- return $nstr;
+ return $this->error_count > 0;
}
/**
* Add a custom header.
* $name value can be overloaded to contain
- * both header name and value (name:value)
- * @access public
- * @param string $name Custom header name
- * @param string $value Header value
- * @return void
+ * both header name and value (name:value).
+ *
+ * @param string $name Custom header name
+ * @param string|null $value Header value
*/
public function addCustomHeader($name, $value = null)
{
- if ($value === null) {
+ if (null === $value) {
// Value passed in as name:value
$this->CustomHeader[] = explode(':', $name, 2);
} else {
- $this->CustomHeader[] = array($name, $value);
+ $this->CustomHeader[] = [$name, $value];
}
}
/**
* Returns all custom headers.
+ *
* @return array
*/
public function getCustomHeaders()
}
/**
- * Create a message from an HTML string.
- * Automatically makes 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
- * @access public
- * @param string $message HTML message string
- * @param string $basedir baseline directory for path
- * @param boolean|callable $advanced Whether to use the internal HTML to text converter
- * or your own custom converter @see PHPMailer::html2text()
- * @return string $message
+ * 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. <img src="/images/a.png"> 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)
+ * Converts data-uri images into embedded attachments.
+ * If you don't want to apply these transformations to your HTML, just set Body and AltBody directly.
+ *
+ * @param string $message HTML message string
+ * @param string $basedir Absolute path to a base directory to prepend to relative paths to images
+ * @param bool|callable $advanced Whether to use the internal HTML to text converter
+ * or your own custom converter @return string $message The transformed message Body
+ *
+ * @throws Exception
+ *
+ * @see PHPMailer::html2text()
*/
public function msgHTML($message, $basedir = '', $advanced = false)
{
- preg_match_all('/(src|background)=["\'](.*)["\']/Ui', $message, $images);
+ preg_match_all('/(?<!-)(src|background)=["\'](.*)["\']/Ui', $message, $images);
if (array_key_exists(2, $images)) {
+ if (strlen($basedir) > 1 && '/' !== substr($basedir, -1)) {
+ // Ensure $basedir has a trailing /
+ $basedir .= '/';
+ }
foreach ($images[2] as $imgindex => $url) {
// Convert data URIs into embedded images
- if (preg_match('#^data:(image[^;,]*)(;base64)?,#', $url, $match)) {
- $data = substr($url, strpos($url, ','));
- if ($match[2]) {
- $data = base64_decode($data);
+ //e.g. "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
+ if (preg_match('#^data:(image/(?:jpe?g|gif|png));?(base64)?,(.+)#', $url, $match)) {
+ if (count($match) === 4 && static::ENCODING_BASE64 === $match[2]) {
+ $data = base64_decode($match[3]);
+ } elseif ('' === $match[2]) {
+ $data = rawurldecode($match[3]);
} else {
- $data = rawurldecode($data);
+ //Not recognised so leave it alone
+ continue;
}
- $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2
- if ($this->addStringEmbeddedImage($data, $cid, 'embed' . $imgindex, 'base64', $match[1])) {
- $message = str_replace(
- $images[0][$imgindex],
- $images[1][$imgindex] . '="cid:' . $cid . '"',
- $message
+ //Hash the decoded data, not the URL, so that the same data-URI image used in multiple places
+ //will only be embedded once, even if it used a different encoding
+ $cid = substr(hash('sha256', $data), 0, 32) . '@phpmailer.0'; // RFC2392 S 2
+
+ if (!$this->cidExists($cid)) {
+ $this->addStringEmbeddedImage(
+ $data,
+ $cid,
+ 'embed' . $imgindex,
+ static::ENCODING_BASE64,
+ $match[1]
);
}
- } elseif (substr($url, 0, 4) !== 'cid:' && !preg_match('#^[a-z][a-z0-9+.-]*://#i', $url)) {
- // Do not change urls for absolute images (thanks to corvuscorax)
+ $message = str_replace(
+ $images[0][$imgindex],
+ $images[1][$imgindex] . '="cid:' . $cid . '"',
+ $message
+ );
+ continue;
+ }
+ if (// Only process relative URLs if a basedir is provided (i.e. no absolute local paths)
+ !empty($basedir)
+ // Ignore URLs containing parent dir traversal (..)
+ && (strpos($url, '..') === false)
// Do not change urls that are already inline images
- $filename = basename($url);
+ && 0 !== strpos($url, 'cid:')
+ // Do not change absolute URLs, including anonymous protocol
+ && !preg_match('#^[a-z][a-z0-9+.-]*:?//#i', $url)
+ ) {
+ $filename = static::mb_pathinfo($url, PATHINFO_BASENAME);
$directory = dirname($url);
- if ($directory == '.') {
+ if ('.' === $directory) {
$directory = '';
}
- $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2
- if (strlen($basedir) > 1 && substr($basedir, -1) != '/') {
+ // RFC2392 S 2
+ $cid = substr(hash('sha256', $url), 0, 32) . '@phpmailer.0';
+ if (strlen($basedir) > 1 && '/' !== substr($basedir, -1)) {
$basedir .= '/';
}
- if (strlen($directory) > 1 && substr($directory, -1) != '/') {
+ if (strlen($directory) > 1 && '/' !== substr($directory, -1)) {
$directory .= '/';
}
if ($this->addEmbeddedImage(
$basedir . $directory . $filename,
$cid,
$filename,
- 'base64',
- self::_mime_types((string)self::mb_pathinfo($filename, PATHINFO_EXTENSION))
+ static::ENCODING_BASE64,
+ static::_mime_types((string) static::mb_pathinfo($filename, PATHINFO_EXTENSION))
)
) {
$message = preg_replace(
}
}
}
- $this->isHTML(true);
- // Convert all message body line breaks to CRLF, makes quoted-printable encoding work much better
- $this->Body = $this->normalizeBreaks($message);
- $this->AltBody = $this->normalizeBreaks($this->html2text($message, $advanced));
+ $this->isHTML();
+ // Convert all message body line breaks to LE, makes quoted-printable encoding work much better
+ $this->Body = static::normalizeBreaks($message);
+ $this->AltBody = static::normalizeBreaks($this->html2text($message, $advanced));
if (!$this->alternativeExists()) {
- $this->AltBody = 'To view this email message, open it in a program that understands HTML!' .
- self::CRLF . self::CRLF;
+ $this->AltBody = 'This is an HTML-only message. To view it, activate HTML in your email application.'
+ . static::$LE;
}
+
return $this->Body;
}
* 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
+ * which was removed for license reasons in #232.
* Example usage:
- * <code>
+ *
+ * ```php
* // Use default conversion
* $plain = $mail->html2text($html);
* // Use your own custom converter
* $converter = new MyHtml2text($html);
* return $converter->get_text();
* });
- * </code>
- * @param string $html The HTML text to convert
- * @param boolean|callable $advanced Any boolean value to use the internal converter,
- * or provide your own callable for custom conversion.
+ * ```
+ *
+ * @param string $html The HTML text to convert
+ * @param bool|callable $advanced Any boolean value to use the internal converter,
+ * or provide your own callable for custom conversion
+ *
* @return string
*/
public function html2text($html, $advanced = false)
{
if (is_callable($advanced)) {
- return call_user_func($advanced, $html);
+ return $advanced($html);
}
+
return html_entity_decode(
trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/si', '', $html))),
ENT_QUOTES,
/**
* Get the MIME type for a file extension.
+ *
* @param string $ext File extension
- * @access public
- * @return string MIME type of file.
- * @static
+ *
+ * @return string MIME type of file
*/
public static function _mime_types($ext = '')
{
- $mimes = array(
- 'xl' => 'application/excel',
- 'js' => 'application/javascript',
- 'hqx' => 'application/mac-binhex40',
- 'cpt' => 'application/mac-compactpro',
- 'bin' => 'application/macbinary',
- 'doc' => 'application/msword',
- 'word' => 'application/msword',
- 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
- 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
- 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template',
- 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
- 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
- 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide',
- 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
- 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
- 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12',
- 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
+ $mimes = [
+ 'xl' => 'application/excel',
+ 'js' => 'application/javascript',
+ 'hqx' => 'application/mac-binhex40',
+ 'cpt' => 'application/mac-compactpro',
+ 'bin' => 'application/macbinary',
+ 'doc' => 'application/msword',
+ 'word' => 'application/msword',
+ 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+ 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
+ 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template',
+ 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
+ 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
+ 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide',
+ 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
+ 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
+ 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12',
+ 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
'class' => 'application/octet-stream',
- 'dll' => 'application/octet-stream',
- 'dms' => 'application/octet-stream',
- 'exe' => 'application/octet-stream',
- 'lha' => 'application/octet-stream',
- 'lzh' => 'application/octet-stream',
- 'psd' => 'application/octet-stream',
- 'sea' => 'application/octet-stream',
- 'so' => 'application/octet-stream',
- 'oda' => 'application/oda',
- 'pdf' => 'application/pdf',
- 'ai' => 'application/postscript',
- 'eps' => 'application/postscript',
- 'ps' => 'application/postscript',
- 'smi' => 'application/smil',
- 'smil' => 'application/smil',
- 'mif' => 'application/vnd.mif',
- 'xls' => 'application/vnd.ms-excel',
- 'ppt' => 'application/vnd.ms-powerpoint',
+ 'dll' => 'application/octet-stream',
+ 'dms' => 'application/octet-stream',
+ 'exe' => 'application/octet-stream',
+ 'lha' => 'application/octet-stream',
+ 'lzh' => 'application/octet-stream',
+ 'psd' => 'application/octet-stream',
+ 'sea' => 'application/octet-stream',
+ 'so' => 'application/octet-stream',
+ 'oda' => 'application/oda',
+ 'pdf' => 'application/pdf',
+ 'ai' => 'application/postscript',
+ 'eps' => 'application/postscript',
+ 'ps' => 'application/postscript',
+ 'smi' => 'application/smil',
+ 'smil' => 'application/smil',
+ 'mif' => 'application/vnd.mif',
+ 'xls' => 'application/vnd.ms-excel',
+ 'ppt' => 'application/vnd.ms-powerpoint',
'wbxml' => 'application/vnd.wap.wbxml',
- 'wmlc' => 'application/vnd.wap.wmlc',
- 'dcr' => 'application/x-director',
- 'dir' => 'application/x-director',
- 'dxr' => 'application/x-director',
- 'dvi' => 'application/x-dvi',
- 'gtar' => 'application/x-gtar',
- 'php3' => 'application/x-httpd-php',
- 'php4' => 'application/x-httpd-php',
- 'php' => 'application/x-httpd-php',
+ 'wmlc' => 'application/vnd.wap.wmlc',
+ 'dcr' => 'application/x-director',
+ 'dir' => 'application/x-director',
+ 'dxr' => 'application/x-director',
+ 'dvi' => 'application/x-dvi',
+ 'gtar' => 'application/x-gtar',
+ 'php3' => 'application/x-httpd-php',
+ 'php4' => 'application/x-httpd-php',
+ 'php' => 'application/x-httpd-php',
'phtml' => 'application/x-httpd-php',
- 'phps' => 'application/x-httpd-php-source',
- 'swf' => 'application/x-shockwave-flash',
- 'sit' => 'application/x-stuffit',
- 'tar' => 'application/x-tar',
- 'tgz' => 'application/x-tar',
- 'xht' => 'application/xhtml+xml',
+ 'phps' => 'application/x-httpd-php-source',
+ 'swf' => 'application/x-shockwave-flash',
+ 'sit' => 'application/x-stuffit',
+ 'tar' => 'application/x-tar',
+ 'tgz' => 'application/x-tar',
+ 'xht' => 'application/xhtml+xml',
'xhtml' => 'application/xhtml+xml',
- 'zip' => 'application/zip',
- 'mid' => 'audio/midi',
- 'midi' => 'audio/midi',
- 'mp2' => 'audio/mpeg',
- 'mp3' => 'audio/mpeg',
- 'mpga' => 'audio/mpeg',
- 'aif' => 'audio/x-aiff',
- 'aifc' => 'audio/x-aiff',
- 'aiff' => 'audio/x-aiff',
- 'ram' => 'audio/x-pn-realaudio',
- 'rm' => 'audio/x-pn-realaudio',
- 'rpm' => 'audio/x-pn-realaudio-plugin',
- 'ra' => 'audio/x-realaudio',
- 'wav' => 'audio/x-wav',
- 'bmp' => 'image/bmp',
- 'gif' => 'image/gif',
- 'jpeg' => 'image/jpeg',
- 'jpe' => 'image/jpeg',
- 'jpg' => 'image/jpeg',
- 'png' => 'image/png',
- 'tiff' => 'image/tiff',
- 'tif' => 'image/tiff',
- 'eml' => 'message/rfc822',
- 'css' => 'text/css',
- 'html' => 'text/html',
- 'htm' => 'text/html',
+ 'zip' => 'application/zip',
+ 'mid' => 'audio/midi',
+ 'midi' => 'audio/midi',
+ 'mp2' => 'audio/mpeg',
+ 'mp3' => 'audio/mpeg',
+ 'm4a' => 'audio/mp4',
+ 'mpga' => 'audio/mpeg',
+ 'aif' => 'audio/x-aiff',
+ 'aifc' => 'audio/x-aiff',
+ 'aiff' => 'audio/x-aiff',
+ 'ram' => 'audio/x-pn-realaudio',
+ 'rm' => 'audio/x-pn-realaudio',
+ 'rpm' => 'audio/x-pn-realaudio-plugin',
+ 'ra' => 'audio/x-realaudio',
+ 'wav' => 'audio/x-wav',
+ 'mka' => 'audio/x-matroska',
+ 'bmp' => 'image/bmp',
+ 'gif' => 'image/gif',
+ 'jpeg' => 'image/jpeg',
+ 'jpe' => 'image/jpeg',
+ 'jpg' => 'image/jpeg',
+ 'png' => 'image/png',
+ 'tiff' => 'image/tiff',
+ 'tif' => 'image/tiff',
+ 'webp' => 'image/webp',
+ 'heif' => 'image/heif',
+ 'heifs' => 'image/heif-sequence',
+ 'heic' => 'image/heic',
+ 'heics' => 'image/heic-sequence',
+ 'eml' => 'message/rfc822',
+ 'css' => 'text/css',
+ 'html' => 'text/html',
+ 'htm' => 'text/html',
'shtml' => 'text/html',
- 'log' => 'text/plain',
- 'text' => 'text/plain',
- 'txt' => 'text/plain',
- 'rtx' => 'text/richtext',
- 'rtf' => 'text/rtf',
- 'vcf' => 'text/vcard',
+ 'log' => 'text/plain',
+ 'text' => 'text/plain',
+ 'txt' => 'text/plain',
+ 'rtx' => 'text/richtext',
+ 'rtf' => 'text/rtf',
+ 'vcf' => 'text/vcard',
'vcard' => 'text/vcard',
- 'xml' => 'text/xml',
- 'xsl' => 'text/xml',
- 'mpeg' => 'video/mpeg',
- 'mpe' => 'video/mpeg',
- 'mpg' => 'video/mpeg',
- 'mov' => 'video/quicktime',
- 'qt' => 'video/quicktime',
- 'rv' => 'video/vnd.rn-realvideo',
- 'avi' => 'video/x-msvideo',
- 'movie' => 'video/x-sgi-movie'
- );
- if (array_key_exists(strtolower($ext), $mimes)) {
- return $mimes[strtolower($ext)];
+ 'ics' => 'text/calendar',
+ 'xml' => 'text/xml',
+ 'xsl' => 'text/xml',
+ 'wmv' => 'video/x-ms-wmv',
+ 'mpeg' => 'video/mpeg',
+ 'mpe' => 'video/mpeg',
+ 'mpg' => 'video/mpeg',
+ 'mp4' => 'video/mp4',
+ 'm4v' => 'video/mp4',
+ 'mov' => 'video/quicktime',
+ 'qt' => 'video/quicktime',
+ 'rv' => 'video/vnd.rn-realvideo',
+ 'avi' => 'video/x-msvideo',
+ 'movie' => 'video/x-sgi-movie',
+ 'webm' => 'video/webm',
+ 'mkv' => 'video/x-matroska',
+ ];
+ $ext = strtolower($ext);
+ if (array_key_exists($ext, $mimes)) {
+ return $mimes[$ext];
}
+
return 'application/octet-stream';
}
/**
* Map a file name to a MIME type.
* Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
+ *
* @param string $filename A file name or full path, does not need to exist as a file
+ *
* @return string
- * @static
*/
public static function filenameToType($filename)
{
if (false !== $qpos) {
$filename = substr($filename, 0, $qpos);
}
- $pathinfo = self::mb_pathinfo($filename);
- return self::_mime_types($pathinfo['extension']);
+ $ext = static::mb_pathinfo($filename, PATHINFO_EXTENSION);
+
+ return static::_mime_types($ext);
}
/**
* 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
- * @link http://www.php.net/manual/en/function.pathinfo.php#107461
- * @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
+ * Drop-in replacement for pathinfo(), but multibyte- and cross-platform-safe.
+ *
+ * @see http://www.php.net/manual/en/function.pathinfo.php#107461
+ *
+ * @param string $path A filename or path, does not need to exist as a file
+ * @param int|string $options Either a PATHINFO_* constant,
+ * or a string name to return only the specified piece
+ *
* @return string|array
- * @static
*/
public static function mb_pathinfo($path, $options = null)
{
- $ret = array('dirname' => '', 'basename' => '', 'extension' => '', 'filename' => '');
- $pathinfo = array();
- if (preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im', $path, $pathinfo)) {
+ $ret = ['dirname' => '', 'basename' => '', 'extension' => '', 'filename' => ''];
+ $pathinfo = [];
+ if (preg_match('#^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^.\\\\/]+?)|))[\\\\/.]*$#m', $path, $pathinfo)) {
if (array_key_exists(1, $pathinfo)) {
$ret['dirname'] = $pathinfo[1];
}
* 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');`
+ * `$mail->set('SMTPSecure', static::ENCRYPTION_STARTTLS);`
* is the same as:
- * `$mail->SMTPSecure = 'tls';`
- * @access public
- * @param string $name The property name to set
- * @param mixed $value The value to set the property to
- * @return boolean
- * @TODO Should this not be using the __set() magic function?
+ * `$mail->SMTPSecure = static::ENCRYPTION_STARTTLS;`.
+ *
+ * @param string $name The property name to set
+ * @param mixed $value The value to set the property to
+ *
+ * @return bool
*/
public function set($name, $value = '')
{
if (property_exists($this, $name)) {
$this->$name = $value;
+
return true;
- } else {
- $this->setError($this->lang('variable_set') . $name);
- return false;
}
+ $this->setError($this->lang('variable_set') . $name);
+
+ return false;
}
/**
* Strip newlines to prevent header injection.
- * @access public
+ *
* @param string $str
+ *
* @return string
*/
public function secureHeader($str)
{
- return trim(str_replace(array("\r", "\n"), '', $str));
+ return trim(str_replace(["\r", "\n"], '', $str));
}
/**
* 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 string $text
- * @param string $breaktype What kind of line break to use, defaults to CRLF
+ * @param string $breaktype What kind of line break to use; defaults to static::$LE
+ *
* @return string
- * @access public
- * @static
*/
- public static function normalizeBreaks($text, $breaktype = "\r\n")
+ public static function normalizeBreaks($text, $breaktype = null)
{
- return preg_replace('/(\r\n|\r|\n)/ms', $breaktype, $text);
+ if (null === $breaktype) {
+ $breaktype = static::$LE;
+ }
+ // Normalise to \n
+ $text = str_replace(["\r\n", "\r"], "\n", $text);
+ // Now convert LE as needed
+ if ("\n" !== $breaktype) {
+ $text = str_replace("\n", $breaktype, $text);
+ }
+
+ return $text;
+ }
+
+ /**
+ * Return the current line break format string.
+ *
+ * @return string
+ */
+ public static function getLE()
+ {
+ return static::$LE;
+ }
+
+ /**
+ * Set the line break format string, e.g. "\r\n".
+ *
+ * @param string $le
+ */
+ protected static function setLE($le)
+ {
+ static::$LE = $le;
}
/**
* Set the public and private key files and password for S/MIME signing.
- * @access public
+ *
* @param string $cert_filename
* @param string $key_filename
- * @param string $key_pass Password for private key
+ * @param string $key_pass Password for private key
* @param string $extracerts_filename Optional path to chain certificate
*/
public function sign($cert_filename, $key_filename, $key_pass, $extracerts_filename = '')
/**
* Quoted-Printable-encode a DKIM header.
- * @access public
+ *
* @param string $txt
+ *
* @return string
*/
public function DKIM_QP($txt)
{
$line = '';
- for ($i = 0; $i < strlen($txt); $i++) {
+ $len = strlen($txt);
+ for ($i = 0; $i < $len; ++$i) {
$ord = ord($txt[$i]);
- if (((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E))) {
+ if (((0x21 <= $ord) && ($ord <= 0x3A)) || $ord === 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E))) {
$line .= $txt[$i];
} else {
$line .= '=' . sprintf('%02X', $ord);
}
}
+
return $line;
}
/**
* Generate a DKIM signature.
- * @access public
+ *
* @param string $signHeader
- * @throws phpmailerException
+ *
+ * @throws Exception
+ *
* @return string The DKIM signature value
*/
public function DKIM_Sign($signHeader)
{
if (!defined('PKCS7_TEXT')) {
if ($this->exceptions) {
- throw new phpmailerException($this->lang('extension_missing') . 'openssl');
+ throw new Exception($this->lang('extension_missing') . 'openssl');
}
+
return '';
}
- $privKeyStr = file_get_contents($this->DKIM_private);
- if ('' != $this->DKIM_passphrase) {
+ $privKeyStr = !empty($this->DKIM_private_string) ?
+ $this->DKIM_private_string :
+ file_get_contents($this->DKIM_private);
+ if ('' !== $this->DKIM_passphrase) {
$privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
} else {
$privKey = openssl_pkey_get_private($privKeyStr);
}
- //Workaround for missing digest algorithms in old PHP & OpenSSL versions
- //@link http://stackoverflow.com/a/11117338/333340
- if (version_compare(PHP_VERSION, '5.3.0') >= 0 and
- in_array('sha256WithRSAEncryption', openssl_get_md_methods(true))) {
- if (openssl_sign($signHeader, $signature, $privKey, 'sha256WithRSAEncryption')) {
- openssl_pkey_free($privKey);
- return base64_encode($signature);
- }
- } else {
- $pinfo = openssl_pkey_get_details($privKey);
- $hash = hash('sha256', $signHeader);
- //'Magic' constant for SHA256 from RFC3447
- //@link https://tools.ietf.org/html/rfc3447#page-43
- $t = '3031300d060960864801650304020105000420' . $hash;
- $pslen = $pinfo['bits'] / 8 - (strlen($t) / 2 + 3);
- $eb = pack('H*', '0001' . str_repeat('FF', $pslen) . '00' . $t);
+ if (openssl_sign($signHeader, $signature, $privKey, 'sha256WithRSAEncryption')) {
+ openssl_pkey_free($privKey);
- if (openssl_private_encrypt($eb, $signature, $privKey, OPENSSL_NO_PADDING)) {
- openssl_pkey_free($privKey);
- return base64_encode($signature);
- }
+ return base64_encode($signature);
}
openssl_pkey_free($privKey);
+
return '';
}
/**
* Generate a DKIM canonicalization header.
- * @access public
+ * Uses the 'relaxed' algorithm from RFC6376 section 3.4.2.
+ * Canonicalized headers should *always* use CRLF, regardless of mailer setting.
+ *
+ * @see https://tools.ietf.org/html/rfc6376#section-3.4.2
+ *
* @param string $signHeader Header
+ *
* @return string
*/
public function DKIM_HeaderC($signHeader)
{
- $signHeader = preg_replace('/\r\n\s+/', ' ', $signHeader);
+ //Note PCRE \s is too broad a definition of whitespace; RFC5322 defines it as `[ \t]`
+ //@see https://tools.ietf.org/html/rfc5322#section-2.2
+ //That means this may break if you do something daft like put vertical tabs in your headers.
+ //Unfold header lines
+ $signHeader = preg_replace('/\r\n[ \t]+/', ' ', $signHeader);
+ //Break headers out into an array
$lines = explode("\r\n", $signHeader);
foreach ($lines as $key => $line) {
+ //If the header is missing a :, skip it as it's invalid
+ //This is likely to happen because the explode() above will also split
+ //on the trailing LE, leaving an empty line
+ if (strpos($line, ':') === false) {
+ continue;
+ }
list($heading, $value) = explode(':', $line, 2);
+ //Lower-case header name
$heading = strtolower($heading);
- $value = preg_replace('/\s{2,}/', ' ', $value); // Compress useless spaces
- $lines[$key] = $heading . ':' . trim($value); // Don't forget to remove WSP around the value
+ //Collapse white space within the value, also convert WSP to space
+ $value = preg_replace('/[ \t]+/', ' ', $value);
+ //RFC6376 is slightly unclear here - it says to delete space at the *end* of each value
+ //But then says to delete space before and after the colon.
+ //Net result is the same as trimming both ends of the value.
+ //By elimination, the same applies to the field name
+ $lines[$key] = trim($heading, " \t") . ':' . trim($value, " \t");
}
- $signHeader = implode("\r\n", $lines);
- return $signHeader;
+
+ return implode("\r\n", $lines);
}
/**
* Generate a DKIM canonicalization body.
- * @access public
+ * Uses the 'simple' algorithm from RFC6376 section 3.4.3.
+ * Canonicalized bodies should *always* use CRLF, regardless of mailer setting.
+ *
+ * @see https://tools.ietf.org/html/rfc6376#section-3.4.3
+ *
* @param string $body Message Body
+ *
* @return string
*/
public function DKIM_BodyC($body)
{
- if ($body == '') {
+ if (empty($body)) {
return "\r\n";
}
- // stabilize line endings
- $body = str_replace("\r\n", "\n", $body);
- $body = str_replace("\n", "\r\n", $body);
- // END stabilize line endings
- while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") {
- $body = substr($body, 0, strlen($body) - 2);
- }
- return $body;
+ // Normalize line endings to CRLF
+ $body = static::normalizeBreaks($body, "\r\n");
+
+ //Reduce multiple trailing line breaks to a single one
+ return rtrim($body, "\r\n") . "\r\n";
}
/**
* Create the DKIM header and body in a new message header.
- * @access public
+ *
* @param string $headers_line Header lines
- * @param string $subject Subject
- * @param string $body Body
+ * @param string $subject Subject
+ * @param string $body Body
+ *
+ * @throws Exception
+ *
* @return string
*/
public function DKIM_Add($headers_line, $subject, $body)
{
$DKIMsignatureType = 'rsa-sha256'; // Signature & hash algorithms
- $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body
+ $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization methods of header & body
$DKIMquery = 'dns/txt'; // Query method
- $DKIMtime = time(); // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)
- $subject_header = "Subject: $subject";
- $headers = explode($this->LE, $headers_line);
- $from_header = '';
- $to_header = '';
- $date_header = '';
- $current = '';
- foreach ($headers as $header) {
- if (strpos($header, 'From:') === 0) {
- $from_header = $header;
- $current = 'from_header';
- } elseif (strpos($header, 'To:') === 0) {
- $to_header = $header;
- $current = 'to_header';
- } elseif (strpos($header, 'Date:') === 0) {
- $date_header = $header;
- $current = 'date_header';
- } else {
- if (!empty($$current) && strpos($header, ' =?') === 0) {
- $$current .= $header;
+ $DKIMtime = time();
+ //Always sign these headers without being asked
+ $autoSignHeaders = [
+ 'From',
+ 'To',
+ 'CC',
+ 'Date',
+ 'Subject',
+ 'Reply-To',
+ 'Message-ID',
+ 'Content-Type',
+ 'Mime-Version',
+ 'X-Mailer',
+ ];
+ if (stripos($headers_line, 'Subject') === false) {
+ $headers_line .= 'Subject: ' . $subject . static::$LE;
+ }
+ $headerLines = explode(static::$LE, $headers_line);
+ $currentHeaderLabel = '';
+ $currentHeaderValue = '';
+ $parsedHeaders = [];
+ $headerLineIndex = 0;
+ $headerLineCount = count($headerLines);
+ foreach ($headerLines as $headerLine) {
+ $matches = [];
+ if (preg_match('/^([^ \t]*?)(?::[ \t]*)(.*)$/', $headerLine, $matches)) {
+ if ($currentHeaderLabel !== '') {
+ //We were previously in another header; This is the start of a new header, so save the previous one
+ $parsedHeaders[] = ['label' => $currentHeaderLabel, 'value' => $currentHeaderValue];
+ }
+ $currentHeaderLabel = $matches[1];
+ $currentHeaderValue = $matches[2];
+ } elseif (preg_match('/^[ \t]+(.*)$/', $headerLine, $matches)) {
+ //This is a folded continuation of the current header, so unfold it
+ $currentHeaderValue .= ' ' . $matches[1];
+ }
+ ++$headerLineIndex;
+ if ($headerLineIndex >= $headerLineCount) {
+ //This was the last line, so finish off this header
+ $parsedHeaders[] = ['label' => $currentHeaderLabel, 'value' => $currentHeaderValue];
+ }
+ }
+ $copiedHeaders = [];
+ $headersToSignKeys = [];
+ $headersToSign = [];
+ foreach ($parsedHeaders as $header) {
+ //Is this header one that must be included in the DKIM signature?
+ if (in_array($header['label'], $autoSignHeaders, true)) {
+ $headersToSignKeys[] = $header['label'];
+ $headersToSign[] = $header['label'] . ': ' . $header['value'];
+ if ($this->DKIM_copyHeaderFields) {
+ $copiedHeaders[] = $header['label'] . ':' . //Note no space after this, as per RFC
+ str_replace('|', '=7C', $this->DKIM_QP($header['value']));
+ }
+ continue;
+ }
+ //Is this an extra custom header we've been asked to sign?
+ if (in_array($header['label'], $this->DKIM_extraHeaders, true)) {
+ //Find its value in custom headers
+ foreach ($this->CustomHeader as $customHeader) {
+ if ($customHeader[0] === $header['label']) {
+ $headersToSignKeys[] = $header['label'];
+ $headersToSign[] = $header['label'] . ': ' . $header['value'];
+ if ($this->DKIM_copyHeaderFields) {
+ $copiedHeaders[] = $header['label'] . ':' . //Note no space after this, as per RFC
+ str_replace('|', '=7C', $this->DKIM_QP($header['value']));
+ }
+ //Skip straight to the next header
+ continue 2;
+ }
+ }
+ }
+ }
+ $copiedHeaderFields = '';
+ if ($this->DKIM_copyHeaderFields && count($copiedHeaders) > 0) {
+ //Assemble a DKIM 'z' tag
+ $copiedHeaderFields = ' z=';
+ $first = true;
+ foreach ($copiedHeaders as $copiedHeader) {
+ if (!$first) {
+ $copiedHeaderFields .= static::$LE . ' |';
+ }
+ //Fold long values
+ if (strlen($copiedHeader) > self::STD_LINE_LENGTH - 3) {
+ $copiedHeaderFields .= substr(
+ chunk_split($copiedHeader, self::STD_LINE_LENGTH - 3, static::$LE . ' '),
+ 0,
+ -strlen(static::$LE . ' ')
+ );
} else {
- $current = '';
+ $copiedHeaderFields .= $copiedHeader;
}
+ $first = false;
}
+ $copiedHeaderFields .= ';' . static::$LE;
}
- $from = str_replace('|', '=7C', $this->DKIM_QP($from_header));
- $to = str_replace('|', '=7C', $this->DKIM_QP($to_header));
- $date = str_replace('|', '=7C', $this->DKIM_QP($date_header));
- $subject = str_replace(
- '|',
- '=7C',
- $this->DKIM_QP($subject_header)
- ); // Copied header fields (dkim-quoted-printable)
+ $headerKeys = ' h=' . implode(':', $headersToSignKeys) . ';' . static::$LE;
+ $headerValues = implode(static::$LE, $headersToSign);
$body = $this->DKIM_BodyC($body);
$DKIMlen = strlen($body); // Length of body
$DKIMb64 = base64_encode(pack('H*', hash('sha256', $body))); // Base64 of packed binary SHA-256 hash of body
- if ('' == $this->DKIM_identity) {
- $ident = '';
- } else {
- $ident = ' i=' . $this->DKIM_identity . ';';
- }
- $dkimhdrs = 'DKIM-Signature: v=1; a=' .
- $DKIMsignatureType . '; q=' .
- $DKIMquery . '; l=' .
- $DKIMlen . '; s=' .
- $this->DKIM_selector .
- ";\r\n" .
- "\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" .
- "\th=From:To:Date:Subject;\r\n" .
- "\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" .
- "\tz=$from\r\n" .
- "\t|$to\r\n" .
- "\t|$date\r\n" .
- "\t|$subject;\r\n" .
- "\tbh=" . $DKIMb64 . ";\r\n" .
- "\tb=";
- $toSign = $this->DKIM_HeaderC(
- $from_header . "\r\n" .
- $to_header . "\r\n" .
- $date_header . "\r\n" .
- $subject_header . "\r\n" .
- $dkimhdrs
+ $ident = '';
+ if ('' !== $this->DKIM_identity) {
+ $ident = ' i=' . $this->DKIM_identity . ';' . static::$LE;
+ }
+ //The DKIM-Signature header is included in the signature *except for* the value of the `b` tag
+ //which is appended after calculating the signature
+ //https://tools.ietf.org/html/rfc6376#section-3.5
+ $dkimSignatureHeader = 'DKIM-Signature: v=1;' .
+ ' d=' . $this->DKIM_domain . ';' .
+ ' s=' . $this->DKIM_selector . ';' . static::$LE .
+ ' a=' . $DKIMsignatureType . ';' .
+ ' q=' . $DKIMquery . ';' .
+ ' l=' . $DKIMlen . ';' .
+ ' t=' . $DKIMtime . ';' .
+ ' c=' . $DKIMcanonicalization . ';' . static::$LE .
+ $headerKeys .
+ $ident .
+ $copiedHeaderFields .
+ ' bh=' . $DKIMb64 . ';' . static::$LE .
+ ' b=';
+ //Canonicalize the set of headers
+ $canonicalizedHeaders = $this->DKIM_HeaderC(
+ $headerValues . static::$LE . $dkimSignatureHeader
);
- $signed = $this->DKIM_Sign($toSign);
- return $dkimhdrs . $signed . "\r\n";
+ $signature = $this->DKIM_Sign($canonicalizedHeaders);
+ $signature = trim(chunk_split($signature, self::STD_LINE_LENGTH - 3, static::$LE . ' '));
+
+ return static::normalizeBreaks($dkimSignatureHeader . $signature) . static::$LE;
}
/**
- * Detect if a string contains a line longer than the maximum line length allowed.
+ * Detect if a string contains a line longer than the maximum line length
+ * allowed by RFC 2822 section 2.1.1.
+ *
* @param string $str
- * @return boolean
- * @static
+ *
+ * @return bool
*/
public static function hasLineLongerThanMax($str)
{
- //+2 to include CRLF line break for a 1000 total
- return (boolean)preg_match('/^(.{'.(self::MAX_LINE_LENGTH + 2).',})/m', $str);
+ return (bool) preg_match('/^(.{' . (self::MAX_LINE_LENGTH + strlen(static::$LE)) . ',})/m', $str);
}
/**
* Allows for public read access to 'to' property.
- * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included.
- * @access public
+ * Before the send() call, queued addresses (i.e. with IDN) are not yet included.
+ *
* @return array
*/
public function getToAddresses()
/**
* Allows for public read access to 'cc' property.
- * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included.
- * @access public
+ * Before the send() call, queued addresses (i.e. with IDN) are not yet included.
+ *
* @return array
*/
public function getCcAddresses()
/**
* Allows for public read access to 'bcc' property.
- * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included.
- * @access public
+ * Before the send() call, queued addresses (i.e. with IDN) are not yet included.
+ *
* @return array
*/
public function getBccAddresses()
/**
* Allows for public read access to 'ReplyTo' property.
- * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included.
- * @access public
+ * Before the send() call, queued addresses (i.e. with IDN) are not yet included.
+ *
* @return array
*/
public function getReplyToAddresses()
/**
* Allows for public read access to 'all_recipients' property.
- * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included.
- * @access public
+ * Before the send() call, queued addresses (i.e. with IDN) are not yet included.
+ *
* @return array
*/
public function getAllRecipientAddresses()
/**
* Perform a callback.
- * @param boolean $isSent
- * @param array $to
- * @param array $cc
- * @param array $bcc
+ *
+ * @param bool $isSent
+ * @param array $to
+ * @param array $cc
+ * @param array $bcc
* @param string $subject
* @param string $body
* @param string $from
+ * @param array $extra
*/
- protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from)
+ protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from, $extra)
{
if (!empty($this->action_function) && is_callable($this->action_function)) {
- $params = array($isSent, $to, $cc, $bcc, $subject, $body, $from);
- call_user_func_array($this->action_function, $params);
+ call_user_func($this->action_function, $isSent, $to, $cc, $bcc, $subject, $body, $from, $extra);
}
}
-}
-/**
- * PHPMailer exception handler
- * @package PHPMailer
- */
-class phpmailerException extends Exception
-{
/**
- * Prettify error message output
- * @return string
+ * Get the OAuth instance.
+ *
+ * @return OAuth
+ */
+ public function getOAuth()
+ {
+ return $this->oauth;
+ }
+
+ /**
+ * Set an OAuth instance.
*/
- public function errorMessage()
+ public function setOAuth(OAuth $oauth)
{
- $errorMsg = '<strong>' . $this->getMessage() . "</strong><br />\n";
- return $errorMsg;
+ $this->oauth = $oauth;
}
}
<?php
/**
* PHPMailer POP-Before-SMTP Authentication Class.
- * PHP Version 5
- * @package PHPMailer
- * @link https://github.com/PHPMailer/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)
- * @copyright 2012 - 2014 Marcus Bointon
+ * PHP Version 5.5.
+ *
+ * @see 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 - 2019 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
+ * @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.
*/
+namespace PHPMailer\PHPMailer;
+
/**
* PHPMailer POP-Before-SMTP Authentication Class.
* Specifically for PHPMailer to use for RFC1939 POP-before-SMTP authentication.
- * Does not support APOP.
- * @package PHPMailer
+ * 1) This class does not support APOP authentication.
+ * 2) Opening and closing lots of POP3 connections can be quite slow. If you need
+ * to send a batch of emails then just perform the authentication once at the start,
+ * and then loop through your mail sending script. Providing this process doesn't
+ * take longer than the verification period lasts on your POP3 server, you should be fine.
+ * 3) This is really ancient technology; you should only need to use it to talk to very old systems.
+ * 4) This POP3 class is deliberately lightweight and incomplete, implementing just
+ * enough to do authentication.
+ * If you want a more complete class there are other POP3 classes for PHP available.
+ *
* @author Richard Davey (original author) <rich@corephp.co.uk>
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
{
/**
* The POP3 PHPMailer Version number.
+ *
* @var string
- * @access public
*/
- public $Version = '5.2.16';
+ const VERSION = '6.1.4';
/**
* Default POP3 port number.
- * @var integer
- * @access public
+ *
+ * @var int
*/
- public $POP3_PORT = 110;
+ const DEFAULT_PORT = 110;
/**
* Default timeout in seconds.
- * @var integer
- * @access public
- */
- public $POP3_TIMEOUT = 30;
-
- /**
- * POP3 Carriage Return + Line Feed.
- * @var string
- * @access public
- * @deprecated Use the constant instead
+ *
+ * @var int
*/
- public $CRLF = "\r\n";
+ const DEFAULT_TIMEOUT = 30;
/**
* Debug display level.
- * Options: 0 = no, 1+ = yes
- * @var integer
- * @access public
+ * Options: 0 = no, 1+ = yes.
+ *
+ * @var int
*/
public $do_debug = 0;
/**
* POP3 mail server hostname.
+ *
* @var string
- * @access public
*/
public $host;
/**
* POP3 port number.
- * @var integer
- * @access public
+ *
+ * @var int
*/
public $port;
/**
* POP3 Timeout Value in seconds.
- * @var integer
- * @access public
+ *
+ * @var int
*/
public $tval;
/**
- * POP3 username
+ * POP3 username.
+ *
* @var string
- * @access public
*/
public $username;
/**
* POP3 password.
+ *
* @var string
- * @access public
*/
public $password;
/**
* Resource handle for the POP3 connection socket.
+ *
* @var resource
- * @access protected
*/
protected $pop_conn;
/**
* Are we connected?
- * @var boolean
- * @access protected
+ *
+ * @var bool
*/
protected $connected = false;
/**
* Error container.
+ *
* @var array
- * @access protected
*/
- protected $errors = array();
+ protected $errors = [];
/**
- * Line break constant
+ * Line break constant.
*/
- const CRLF = "\r\n";
+ const LE = "\r\n";
/**
- * Simple static wrapper for all-in-one POP before SMTP
- * @param $host
- * @param integer|boolean $port The port number to connect to
- * @param integer|boolean $timeout The timeout value
- * @param string $username
- * @param string $password
- * @param integer $debug_level
- * @return boolean
+ * Simple static wrapper for all-in-one POP before SMTP.
+ *
+ * @param string $host The hostname to connect to
+ * @param int|bool $port The port number to connect to
+ * @param int|bool $timeout The timeout value
+ * @param string $username
+ * @param string $password
+ * @param int $debug_level
+ *
+ * @return bool
*/
public static function popBeforeSmtp(
$host,
$password = '',
$debug_level = 0
) {
- $pop = new POP3;
+ $pop = new self();
+
return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level);
}
* Authenticate with a POP3 server.
* A connect, login, disconnect sequence
* appropriate for POP-before SMTP authorisation.
- * @access public
- * @param string $host The hostname to connect to
- * @param integer|boolean $port The port number to connect to
- * @param integer|boolean $timeout The timeout value
- * @param string $username
- * @param string $password
- * @param integer $debug_level
- * @return boolean
+ *
+ * @param string $host The hostname to connect to
+ * @param int|bool $port The port number to connect to
+ * @param int|bool $timeout The timeout value
+ * @param string $username
+ * @param string $password
+ * @param int $debug_level
+ *
+ * @return bool
*/
public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0)
{
$this->host = $host;
// If no port value provided, use default
if (false === $port) {
- $this->port = $this->POP3_PORT;
+ $this->port = static::DEFAULT_PORT;
} else {
- $this->port = (integer)$port;
+ $this->port = (int) $port;
}
// If no timeout value provided, use default
if (false === $timeout) {
- $this->tval = $this->POP3_TIMEOUT;
+ $this->tval = static::DEFAULT_TIMEOUT;
} else {
- $this->tval = (integer)$timeout;
+ $this->tval = (int) $timeout;
}
$this->do_debug = $debug_level;
$this->username = $username;
$this->password = $password;
// Reset the error log
- $this->errors = array();
+ $this->errors = [];
// connect
$result = $this->connect($this->host, $this->port, $this->tval);
if ($result) {
$login_result = $this->login($this->username, $this->password);
if ($login_result) {
$this->disconnect();
+
return true;
}
}
// We need to disconnect regardless of whether the login succeeded
$this->disconnect();
+
return false;
}
/**
* Connect to a POP3 server.
- * @access public
- * @param string $host
- * @param integer|boolean $port
- * @param integer $tval
- * @return boolean
+ *
+ * @param string $host
+ * @param int|bool $port
+ * @param int $tval
+ *
+ * @return bool
*/
public function connect($host, $port = false, $tval = 30)
{
//On Windows this will raise a PHP Warning error if the hostname doesn't exist.
//Rather than suppress it with @fsockopen, capture it cleanly instead
- set_error_handler(array($this, 'catchWarning'));
+ set_error_handler([$this, 'catchWarning']);
if (false === $port) {
- $port = $this->POP3_PORT;
+ $port = static::DEFAULT_PORT;
}
// connect to the POP3 server
// Did we connect?
if (false === $this->pop_conn) {
// It would appear not...
- $this->setError(array(
- 'error' => "Failed to connect to server $host on port $port",
- 'errno' => $errno,
- 'errstr' => $errstr
- ));
+ $this->setError(
+ "Failed to connect to server $host on port $port. errno: $errno; errstr: $errstr"
+ );
+
return false;
}
if ($this->checkResponse($pop3_response)) {
// The connection is established and the POP3 server is talking
$this->connected = true;
+
return true;
}
+
return false;
}
/**
* Log in to the POP3 server.
* Does not support APOP (RFC 2828, 4949).
- * @access public
+ *
* @param string $username
* @param string $password
- * @return boolean
+ *
+ * @return bool
*/
public function login($username = '', $password = '')
{
}
// Send the Username
- $this->sendString("USER $username" . self::CRLF);
+ $this->sendString("USER $username" . static::LE);
$pop3_response = $this->getResponse();
if ($this->checkResponse($pop3_response)) {
// Send the Password
- $this->sendString("PASS $password" . self::CRLF);
+ $this->sendString("PASS $password" . static::LE);
$pop3_response = $this->getResponse();
if ($this->checkResponse($pop3_response)) {
return true;
}
}
+
return false;
}
/**
* Disconnect from the POP3 server.
- * @access public
*/
public function disconnect()
{
@fclose($this->pop_conn);
} catch (Exception $e) {
//Do nothing
- };
+ }
}
/**
* Get a response from the POP3 server.
- * $size is the maximum number of bytes to retrieve
- * @param integer $size
+ *
+ * @param int $size The maximum number of bytes to retrieve
+ *
* @return string
- * @access protected
*/
protected function getResponse($size = 128)
{
$response = fgets($this->pop_conn, $size);
if ($this->do_debug >= 1) {
- echo "Server -> Client: $response";
+ echo 'Server -> Client: ', $response;
}
+
return $response;
}
/**
* Send raw data to the POP3 server.
+ *
* @param string $string
- * @return integer
- * @access protected
+ *
+ * @return int
*/
protected function sendString($string)
{
if ($this->pop_conn) {
if ($this->do_debug >= 2) { //Show client messages when debug >= 2
- echo "Client -> Server: $string";
+ echo 'Client -> Server: ', $string;
}
+
return fwrite($this->pop_conn, $string, strlen($string));
}
+
return 0;
}
/**
* Checks the POP3 server response.
* Looks for for +OK or -ERR.
+ *
* @param string $string
- * @return boolean
- * @access protected
+ *
+ * @return bool
*/
protected function checkResponse($string)
{
- if (substr($string, 0, 3) !== '+OK') {
- $this->setError(array(
- 'error' => "Server reported an error: $string",
- 'errno' => 0,
- 'errstr' => ''
- ));
+ if (strpos($string, '+OK') !== 0) {
+ $this->setError("Server reported an error: $string");
+
return false;
- } else {
- return true;
}
+
+ return true;
}
/**
* Add an error to the internal error store.
* Also display debug output if it's enabled.
- * @param $error
- * @access protected
+ *
+ * @param string $error
*/
protected function setError($error)
{
$this->errors[] = $error;
if ($this->do_debug >= 1) {
echo '<pre>';
- foreach ($this->errors as $error) {
- print_r($error);
+ foreach ($this->errors as $e) {
+ print_r($e);
}
echo '</pre>';
}
/**
* Get an array of error messages, if any.
+ *
* @return array
*/
public function getErrors()
/**
* POP3 connection error handler.
- * @param integer $errno
+ *
+ * @param int $errno
* @param string $errstr
* @param string $errfile
- * @param integer $errline
- * @access protected
+ * @param int $errline
*/
protected function catchWarning($errno, $errstr, $errfile, $errline)
{
- $this->setError(array(
- 'error' => "Connecting to the POP3 server raised a PHP warning: ",
- 'errno' => $errno,
- 'errstr' => $errstr,
- 'errfile' => $errfile,
- 'errline' => $errline
- ));
+ $this->setError(
+ 'Connecting to the POP3 server raised a PHP warning:' .
+ "errno: $errno errstr: $errstr; errfile: $errfile; errline: $errline"
+ );
}
}
<?php
/**
* PHPMailer RFC821 SMTP email 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 2014 Marcus Bointon
+ * PHP Version 5.5.
+ *
+ * @see 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 - 2019 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
+ * @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.
*/
+namespace PHPMailer\PHPMailer;
+
/**
* PHPMailer RFC821 SMTP email transport class.
* Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server.
- * @package PHPMailer
+ *
* @author Chris Ryan
* @author Marcus Bointon <phpmailer@synchromedia.co.uk>
*/
{
/**
* The PHPMailer SMTP version number.
+ *
* @var string
*/
- const VERSION = '5.2.16';
+ const VERSION = '6.1.4';
/**
* SMTP line break constant.
+ *
* @var string
*/
- const CRLF = "\r\n";
+ const LE = "\r\n";
/**
* The SMTP port to use if one is not specified.
- * @var integer
+ *
+ * @var int
*/
- const DEFAULT_SMTP_PORT = 25;
+ const DEFAULT_PORT = 25;
/**
- * The maximum line length allowed by RFC 2822 section 2.1.1
- * @var integer
+ * The maximum line length allowed by RFC 5321 section 4.5.3.1.6,
+ * *excluding* a trailing CRLF break.
+ *
+ * @see https://tools.ietf.org/html/rfc5321#section-4.5.3.1.6
+ *
+ * @var int
*/
const MAX_LINE_LENGTH = 998;
/**
- * Debug level for no output
+ * The maximum line length allowed for replies in RFC 5321 section 4.5.3.1.5,
+ * *including* a trailing CRLF line break.
+ *
+ * @see https://tools.ietf.org/html/rfc5321#section-4.5.3.1.5
+ *
+ * @var int
+ */
+ const MAX_REPLY_LENGTH = 512;
+
+ /**
+ * Debug level for no output.
+ *
+ * @var int
*/
const DEBUG_OFF = 0;
/**
- * Debug level to show client -> server messages
+ * Debug level to show client -> server messages.
+ *
+ * @var int
*/
const DEBUG_CLIENT = 1;
/**
- * Debug level to show client -> server and server -> client messages
+ * Debug level to show client -> server and server -> client messages.
+ *
+ * @var int
*/
const DEBUG_SERVER = 2;
/**
- * Debug level to show connection status, client -> server and server -> client messages
+ * Debug level to show connection status, client -> server and server -> client messages.
+ *
+ * @var int
*/
const DEBUG_CONNECTION = 3;
/**
- * Debug level to show all messages
+ * Debug level to show all messages.
+ *
+ * @var int
*/
const DEBUG_LOWLEVEL = 4;
- /**
- * The PHPMailer SMTP Version number.
- * @var string
- * @deprecated Use the `VERSION` constant instead
- * @see SMTP::VERSION
- */
- public $Version = '5.2.16';
-
- /**
- * SMTP server port number.
- * @var integer
- * @deprecated This is only ever used as a default value, so use the `DEFAULT_SMTP_PORT` constant instead
- * @see SMTP::DEFAULT_SMTP_PORT
- */
- public $SMTP_PORT = 25;
-
- /**
- * SMTP reply line ending.
- * @var string
- * @deprecated Use the `CRLF` constant instead
- * @see SMTP::CRLF
- */
- public $CRLF = "\r\n";
-
/**
* Debug output level.
* Options:
* * self::DEBUG_CLIENT (`1`) Client commands
* * self::DEBUG_SERVER (`2`) Client commands and server responses
* * self::DEBUG_CONNECTION (`3`) As DEBUG_SERVER plus connection status
- * * self::DEBUG_LOWLEVEL (`4`) Low-level data output, all messages
- * @var integer
+ * * self::DEBUG_LOWLEVEL (`4`) Low-level data output, all messages.
+ *
+ * @var int
*/
public $do_debug = self::DEBUG_OFF;
* * `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>
+ *
+ * ```php
* $smtp->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
- * </code>
- * @var string|callable
+ * ```
+ *
+ * Alternatively, you can pass in an instance of a PSR-3 compatible logger, though only `debug`
+ * level output is used:
+ *
+ * ```php
+ * $mail->Debugoutput = new myPsr3Logger;
+ * ```
+ *
+ * @var string|callable|\Psr\Log\LoggerInterface
*/
public $Debugoutput = 'echo';
/**
* Whether to use VERP.
- * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
- * @link http://www.postfix.org/VERP_README.html Info on VERP
- * @var boolean
+ *
+ * @see http://en.wikipedia.org/wiki/Variable_envelope_return_path
+ * @see http://www.postfix.org/VERP_README.html Info on VERP
+ *
+ * @var bool
*/
public $do_verp = false;
/**
* The timeout value for connection, in seconds.
- * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
+ * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2.
* This needs to be quite high to function correctly with hosts using greetdelay as an anti-spam measure.
- * @link http://tools.ietf.org/html/rfc2821#section-4.5.3.2
- * @var integer
+ *
+ * @see http://tools.ietf.org/html/rfc2821#section-4.5.3.2
+ *
+ * @var int
*/
public $Timeout = 300;
/**
* How long to wait for commands to complete, in seconds.
- * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
- * @var integer
+ * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2.
+ *
+ * @var int
*/
public $Timelimit = 300;
+ /**
+ * Patterns to extract an SMTP transaction id from reply to a DATA command.
+ * The first capture group in each regex will be used as the ID.
+ * MS ESMTP returns the message ID, which may not be correct for internal tracking.
+ *
+ * @var string[]
+ */
+ protected $smtp_transaction_id_patterns = [
+ 'exim' => '/[\d]{3} OK id=(.*)/',
+ 'sendmail' => '/[\d]{3} 2.0.0 (.*) Message/',
+ 'postfix' => '/[\d]{3} 2.0.0 Ok: queued as (.*)/',
+ 'Microsoft_ESMTP' => '/[0-9]{3} 2.[\d].0 (.*)@(?:.*) Queued mail for delivery/',
+ 'Amazon_SES' => '/[\d]{3} Ok (.*)/',
+ 'SendGrid' => '/[\d]{3} Ok: queued as (.*)/',
+ 'CampaignMonitor' => '/[\d]{3} 2.0.0 OK:([a-zA-Z\d]{48})/',
+ ];
+
+ /**
+ * The last transaction ID issued in response to a DATA command,
+ * if one was detected.
+ *
+ * @var string|bool|null
+ */
+ protected $last_smtp_transaction_id;
+
/**
* The socket for the server connection.
- * @var resource
+ *
+ * @var ?resource
*/
protected $smtp_conn;
/**
* Error information, if any, for the last SMTP command.
+ *
* @var array
*/
- protected $error = array(
+ protected $error = [
'error' => '',
'detail' => '',
'smtp_code' => '',
- 'smtp_code_ex' => ''
- );
+ 'smtp_code_ex' => '',
+ ];
/**
* The reply the server sent to us for HELO.
* If null, no HELO string has yet been received.
+ *
* @var string|null
*/
- protected $helo_rply = null;
+ protected $helo_rply;
/**
* The set of SMTP extensions sent in reply to EHLO command.
* represents the server name. In case of HELO it is the only element of the array.
* Other values can be boolean TRUE or an array containing extension options.
* If null, no HELO/EHLO string has yet been received.
+ *
* @var array|null
*/
- protected $server_caps = null;
+ protected $server_caps;
/**
* The most recent reply received from the server.
+ *
* @var string
*/
protected $last_reply = '';
/**
* Output debugging info via a user-selected method.
+ *
+ * @param string $str Debug string to output
+ * @param int $level The debug level of this message; see DEBUG_* constants
+ *
* @see SMTP::$Debugoutput
* @see SMTP::$do_debug
- * @param string $str Debug string to output
- * @param integer $level The debug level of this message; see DEBUG_* constants
- * @return void
*/
protected function edebug($str, $level = 0)
{
if ($level > $this->do_debug) {
return;
}
+ //Is this a PSR-3 logger?
+ if ($this->Debugoutput instanceof \Psr\Log\LoggerInterface) {
+ $this->Debugoutput->debug($str);
+
+ return;
+ }
//Avoid clash with built-in function names
- if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
- call_user_func($this->Debugoutput, $str, $this->do_debug);
+ if (is_callable($this->Debugoutput) && !in_array($this->Debugoutput, ['error_log', 'html', 'echo'])) {
+ call_user_func($this->Debugoutput, $str, $level);
+
return;
}
switch ($this->Debugoutput) {
break;
case 'html':
//Cleans up output a bit for a better looking, HTML-safe output
- echo htmlentities(
+ echo gmdate('Y-m-d H:i:s'), ' ', htmlentities(
preg_replace('/[\r\n]+/', '', $str),
ENT_QUOTES,
'UTF-8'
- )
- . "<br>\n";
+ ), "<br>\n";
break;
case 'echo':
default:
//Normalize line breaks
- $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
- echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
- "\n",
- "\n \t ",
- trim($str)
- )."\n";
+ $str = preg_replace('/\r\n|\r/m', "\n", $str);
+ echo gmdate('Y-m-d H:i:s'),
+ "\t",
+ //Trim trailing space
+ trim(
+ //Indent for readability, except for trailing break
+ str_replace(
+ "\n",
+ "\n \t ",
+ trim($str)
+ )
+ ),
+ "\n";
}
}
/**
* Connect to an SMTP server.
- * @param string $host SMTP server IP or host name
- * @param integer $port The port number to connect to
- * @param integer $timeout How long to wait for the connection to open
- * @param array $options An array of options for stream_context_create()
- * @access public
- * @return boolean
+ *
+ * @param string $host SMTP server IP or host name
+ * @param int $port The port number to connect to
+ * @param int $timeout How long to wait for the connection to open
+ * @param array $options An array of options for stream_context_create()
+ *
+ * @return bool
*/
- public function connect($host, $port = null, $timeout = 30, $options = array())
+ public function connect($host, $port = null, $timeout = 30, $options = [])
{
static $streamok;
//This is enabled by default since 5.0.0 but some providers disable it
//Check this once and cache the result
- if (is_null($streamok)) {
+ if (null === $streamok) {
$streamok = function_exists('stream_socket_client');
}
// Clear errors to avoid confusion
if ($this->connected()) {
// Already connected, generate error
$this->setError('Already connected to a server');
+
return false;
}
if (empty($port)) {
- $port = self::DEFAULT_SMTP_PORT;
+ $port = self::DEFAULT_PORT;
}
// Connect to the SMTP server
$this->edebug(
- "Connection: opening to $host:$port, timeout=$timeout, options=".var_export($options, true),
+ "Connection: opening to $host:$port, timeout=$timeout, options=" .
+ (count($options) > 0 ? var_export($options, true) : 'array()'),
self::DEBUG_CONNECTION
);
$errno = 0;
$errstr = '';
if ($streamok) {
$socket_context = stream_context_create($options);
- //Suppress errors; connection failures are handled at a higher level
- $this->smtp_conn = @stream_socket_client(
- $host . ":" . $port,
+ set_error_handler([$this, 'errorHandler']);
+ $this->smtp_conn = stream_socket_client(
+ $host . ':' . $port,
$errno,
$errstr,
$timeout,
STREAM_CLIENT_CONNECT,
$socket_context
);
+ restore_error_handler();
} else {
//Fall back to fsockopen which should work in more places, but is missing some features
$this->edebug(
- "Connection: stream_socket_client not available, falling back to fsockopen",
+ 'Connection: stream_socket_client not available, falling back to fsockopen',
self::DEBUG_CONNECTION
);
+ set_error_handler([$this, 'errorHandler']);
$this->smtp_conn = fsockopen(
$host,
$port,
$errstr,
$timeout
);
+ restore_error_handler();
}
// Verify we connected properly
if (!is_resource($this->smtp_conn)) {
$this->setError(
'Failed to connect to server',
- $errno,
+ '',
+ (string) $errno,
$errstr
);
$this->edebug(
. ": $errstr ($errno)",
self::DEBUG_CLIENT
);
+
return false;
}
$this->edebug('Connection: opened', self::DEBUG_CONNECTION);
// SMTP server can take longer to respond, give longer timeout for first read
// Windows does not have support for this timeout function
- if (substr(PHP_OS, 0, 3) != 'WIN') {
- $max = ini_get('max_execution_time');
+ if (strpos(PHP_OS, 'WIN') !== 0) {
+ $max = (int) ini_get('max_execution_time');
// Don't bother if unlimited
- if ($max != 0 && $timeout > $max) {
+ if (0 !== $max && $timeout > $max) {
@set_time_limit($timeout);
}
stream_set_timeout($this->smtp_conn, $timeout, 0);
// Get any announcement
$announce = $this->get_lines();
$this->edebug('SERVER -> CLIENT: ' . $announce, self::DEBUG_SERVER);
+
return true;
}
/**
* Initiate a TLS (encrypted) session.
- * @access public
- * @return boolean
+ *
+ * @return bool
*/
public function startTLS()
{
}
// Begin encrypted connection
- if (!stream_socket_enable_crypto(
+ set_error_handler([$this, 'errorHandler']);
+ $crypto_ok = stream_socket_enable_crypto(
$this->smtp_conn,
true,
$crypto_method
- )) {
- return false;
- }
- return true;
+ );
+ restore_error_handler();
+
+ return (bool) $crypto_ok;
}
/**
* Perform SMTP authentication.
* Must be run after hello().
- * @see hello()
+ *
+ * @see hello()
+ *
* @param string $username The user name
* @param string $password The password
- * @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5, XOAUTH2)
- * @param string $realm The auth realm for NTLM
- * @param string $workstation The auth workstation for NTLM
- * @param null|OAuth $OAuth An optional OAuth instance (@see PHPMailerOAuth)
- * @return bool True if successfully authenticated.* @access public
+ * @param string $authtype The auth type (CRAM-MD5, PLAIN, LOGIN, XOAUTH2)
+ * @param OAuth $OAuth An optional OAuth instance for XOAUTH2 authentication
+ *
+ * @return bool True if successfully authenticated
*/
public function authenticate(
$username,
$password,
$authtype = null,
- $realm = '',
- $workstation = '',
$OAuth = null
) {
if (!$this->server_caps) {
$this->setError('Authentication is not allowed before HELO/EHLO');
+
return false;
}
if (array_key_exists('EHLO', $this->server_caps)) {
- // SMTP extensions are available. Let's try to find a proper authentication method
-
+ // SMTP extensions are available; try to find a proper authentication method
if (!array_key_exists('AUTH', $this->server_caps)) {
$this->setError('Authentication is not allowed at this stage');
// 'at this stage' means that auth may be allowed after the stage changes
// e.g. after STARTTLS
+
return false;
}
- self::edebug('Auth method requested: ' . ($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL);
- self::edebug(
+ $this->edebug('Auth method requested: ' . ($authtype ?: 'UNSPECIFIED'), self::DEBUG_LOWLEVEL);
+ $this->edebug(
'Auth methods available on the server: ' . implode(',', $this->server_caps['AUTH']),
self::DEBUG_LOWLEVEL
);
+ //If we have requested a specific auth type, check the server supports it before trying others
+ if (null !== $authtype && !in_array($authtype, $this->server_caps['AUTH'], true)) {
+ $this->edebug('Requested auth method not available: ' . $authtype, self::DEBUG_LOWLEVEL);
+ $authtype = null;
+ }
+
if (empty($authtype)) {
- foreach (array('CRAM-MD5', 'LOGIN', 'PLAIN', 'NTLM', 'XOAUTH2') as $method) {
- if (in_array($method, $this->server_caps['AUTH'])) {
+ //If no auth mechanism is specified, attempt to use these, in this order
+ //Try CRAM-MD5 first as it's more secure than the others
+ foreach (['CRAM-MD5', 'LOGIN', 'PLAIN', 'XOAUTH2'] as $method) {
+ if (in_array($method, $this->server_caps['AUTH'], true)) {
$authtype = $method;
break;
}
}
if (empty($authtype)) {
$this->setError('No supported authentication methods found');
+
return false;
}
- self::edebug('Auth method selected: '.$authtype, self::DEBUG_LOWLEVEL);
+ $this->edebug('Auth method selected: ' . $authtype, self::DEBUG_LOWLEVEL);
}
- if (!in_array($authtype, $this->server_caps['AUTH'])) {
+ if (!in_array($authtype, $this->server_caps['AUTH'], true)) {
$this->setError("The requested authentication method \"$authtype\" is not supported by the server");
+
return false;
}
} elseif (empty($authtype)) {
if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) {
return false;
}
- if (!$this->sendCommand("Username", base64_encode($username), 334)) {
- return false;
- }
- if (!$this->sendCommand("Password", base64_encode($password), 235)) {
+ if (!$this->sendCommand('Username', base64_encode($username), 334)) {
return false;
}
- break;
- case 'XOAUTH2':
- //If the OAuth Instance is not set. Can be a case when PHPMailer is used
- //instead of PHPMailerOAuth
- if (is_null($OAuth)) {
- return false;
- }
- $oauth = $OAuth->getOauth64();
-
- // Start authentication
- if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) {
+ if (!$this->sendCommand('Password', base64_encode($password), 235)) {
return false;
}
break;
- case 'NTLM':
- /*
- * ntlm_sasl_client.php
- * Bundled with Permission
- *
- * How to telnet in windows:
- * http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx
- * PROTOCOL Docs http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication
- */
- require_once 'extras/ntlm_sasl_client.php';
- $temp = new stdClass;
- $ntlm_client = new ntlm_sasl_client_class;
- //Check that functions are available
- if (!$ntlm_client->Initialize($temp)) {
- $this->setError($temp->error);
- $this->edebug(
- 'You need to enable some modules in your php.ini file: '
- . $this->error['error'],
- self::DEBUG_CLIENT
- );
- return false;
- }
- //msg1
- $msg1 = $ntlm_client->TypeMsg1($realm, $workstation); //msg1
-
- if (!$this->sendCommand(
- 'AUTH NTLM',
- 'AUTH NTLM ' . base64_encode($msg1),
- 334
- )
- ) {
- return false;
- }
- //Though 0 based, there is a white space after the 3 digit number
- //msg2
- $challenge = substr($this->last_reply, 3);
- $challenge = base64_decode($challenge);
- $ntlm_res = $ntlm_client->NTLMResponse(
- substr($challenge, 24, 8),
- $password
- );
- //msg3
- $msg3 = $ntlm_client->TypeMsg3(
- $ntlm_res,
- $username,
- $realm,
- $workstation
- );
- // send encoded username
- return $this->sendCommand('Username', base64_encode($msg3), 235);
case 'CRAM-MD5':
// Start authentication
if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) {
// send encoded credentials
return $this->sendCommand('Username', base64_encode($response), 235);
+ case 'XOAUTH2':
+ //The OAuth instance must be set up prior to requesting auth.
+ if (null === $OAuth) {
+ return false;
+ }
+ $oauth = $OAuth->getOauth64();
+
+ // Start authentication
+ if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) {
+ return false;
+ }
+ break;
default:
$this->setError("Authentication method \"$authtype\" is not supported");
+
return false;
}
+
return true;
}
/**
* Calculate an MD5 HMAC hash.
* Works like hash_hmac('md5', $data, $key)
- * in case that function is not available
+ * in case that function is not available.
+ *
* @param string $data The data to hash
* @param string $key The key to hash with
- * @access protected
+ *
* @return string
*/
protected function hmac($data, $key)
/**
* Check connection state.
- * @access public
- * @return boolean True if connected.
+ *
+ * @return bool True if connected
*/
public function connected()
{
self::DEBUG_CLIENT
);
$this->close();
+
return false;
}
+
return true; // everything looks good
}
+
return false;
}
/**
* Close the socket and clean up the state of the class.
* Don't use this function without first trying to use QUIT.
+ *
* @see quit()
- * @access public
- * @return void
*/
public function close()
{
* finializing the mail transaction. $msg_data is the message
* that is to be send with the headers. Each header needs to be
* on a single line followed by a <CRLF> with the message headers
- * and the message body being separated by and additional <CRLF>.
- * Implements rfc 821: DATA <CRLF>
+ * and the message body being separated by an additional <CRLF>.
+ * Implements RFC 821: DATA <CRLF>.
+ *
* @param string $msg_data Message data to send
- * @access public
- * @return boolean
+ *
+ * @return bool
*/
public function data($msg_data)
{
}
/* The server is ready to accept data!
- * According to rfc821 we should not send more than 1000 characters on a single line (including the CRLF)
+ * According to rfc821 we should not send more than 1000 characters on a single line (including the LE)
* so we will break the data up into lines by \r and/or \n then if needed we will break each of those into
* smaller lines to fit within the limit.
* We will also look for lines that start with a '.' and prepend an additional '.'.
*/
// Normalize line breaks before exploding
- $lines = explode("\n", str_replace(array("\r\n", "\r"), "\n", $msg_data));
+ $lines = explode("\n", str_replace(["\r\n", "\r"], "\n", $msg_data));
/* To distinguish between a complete RFC822 message and a plain message body, we check if the first field
* of the first line (':' separated) does not contain a space then it _should_ be a header and we will
}
foreach ($lines as $line) {
- $lines_out = array();
- if ($in_headers and $line == '') {
+ $lines_out = [];
+ if ($in_headers && $line === '') {
$in_headers = false;
}
//Break this line up into several smaller lines if it's too long
//Send the lines to the server
foreach ($lines_out as $line_out) {
//RFC2821 section 4.5.2
- if (!empty($line_out) and $line_out[0] == '.') {
+ if (!empty($line_out) && $line_out[0] === '.') {
$line_out = '.' . $line_out;
}
- $this->client_send($line_out . self::CRLF);
+ $this->client_send($line_out . static::LE, 'DATA');
}
}
//Message data has been sent, complete the command
//Increase timelimit for end of DATA command
$savetimelimit = $this->Timelimit;
- $this->Timelimit = $this->Timelimit * 2;
+ $this->Timelimit *= 2;
$result = $this->sendCommand('DATA END', '.', 250);
+ $this->recordLastTransactionID();
//Restore timelimit
$this->Timelimit = $savetimelimit;
+
return $result;
}
* This makes sure that client and server are in a known state.
* Implements RFC 821: HELO <SP> <domain> <CRLF>
* and RFC 2821 EHLO.
+ *
* @param string $host The host name or IP to connect to
- * @access public
- * @return boolean
+ *
+ * @return bool
*/
public function hello($host = '')
{
//Try extended hello first (RFC 2821)
- return (boolean)($this->sendHello('EHLO', $host) or $this->sendHello('HELO', $host));
+ return $this->sendHello('EHLO', $host) or $this->sendHello('HELO', $host);
}
/**
* Send an SMTP HELO or EHLO command.
- * Low-level implementation used by hello()
- * @see hello()
+ * Low-level implementation used by hello().
+ *
* @param string $hello The HELO string
- * @param string $host The hostname to say we are
- * @access protected
- * @return boolean
+ * @param string $host The hostname to say we are
+ *
+ * @return bool
+ *
+ * @see hello()
*/
protected function sendHello($hello, $host)
{
} else {
$this->server_caps = null;
}
+
return $noerror;
}
/**
* Parse a reply to HELO/EHLO command to discover server extensions.
* In case of HELO, the only parameter that can be discovered is a server name.
- * @access protected
- * @param string $type - 'HELO' or 'EHLO'
+ *
+ * @param string $type `HELO` or `EHLO`
*/
protected function parseHelloFields($type)
{
- $this->server_caps = array();
+ $this->server_caps = [];
$lines = explode("\n", $this->helo_rply);
foreach ($lines as $n => $s) {
break;
case 'AUTH':
if (!is_array($fields)) {
- $fields = array();
+ $fields = [];
}
break;
default:
* $from. Returns true if successful or false otherwise. If True
* the mail transaction is started and then one or more recipient
* commands may be called followed by a data command.
- * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
+ * Implements RFC 821: MAIL <SP> FROM:<reverse-path> <CRLF>.
+ *
* @param string $from Source address of this message
- * @access public
- * @return boolean
+ *
+ * @return bool
*/
public function mail($from)
{
$useVerp = ($this->do_verp ? ' XVERP' : '');
+
return $this->sendCommand(
'MAIL FROM',
'MAIL FROM:<' . $from . '>' . $useVerp,
/**
* Send an SMTP QUIT command.
* Closes the socket if there is no error or the $close_on_error argument is true.
- * Implements from rfc 821: QUIT <CRLF>
- * @param boolean $close_on_error Should the connection close if an error occurs?
- * @access public
- * @return boolean
+ * Implements from RFC 821: QUIT <CRLF>.
+ *
+ * @param bool $close_on_error Should the connection close if an error occurs?
+ *
+ * @return bool
*/
public function quit($close_on_error = true)
{
$noerror = $this->sendCommand('QUIT', 'QUIT', 221);
$err = $this->error; //Save any error
- if ($noerror or $close_on_error) {
+ if ($noerror || $close_on_error) {
$this->close();
$this->error = $err; //Restore any error from the quit command
}
+
return $noerror;
}
* Send an SMTP RCPT command.
* Sets the TO argument to $toaddr.
* Returns true if the recipient was accepted false if it was rejected.
- * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
+ * Implements from RFC 821: RCPT <SP> TO:<forward-path> <CRLF>.
+ *
* @param string $address The address the message is being sent to
- * @access public
- * @return boolean
+ * @param string $dsn Comma separated list of DSN notifications. NEVER, SUCCESS, FAILURE
+ * or DELAY. If you specify NEVER all other notifications are ignored.
+ *
+ * @return bool
*/
- public function recipient($address)
+ public function recipient($address, $dsn = '')
{
+ if (empty($dsn)) {
+ $rcpt = 'RCPT TO:<' . $address . '>';
+ } else {
+ $dsn = strtoupper($dsn);
+ $notify = [];
+
+ if (strpos($dsn, 'NEVER') !== false) {
+ $notify[] = 'NEVER';
+ } else {
+ foreach (['SUCCESS', 'FAILURE', 'DELAY'] as $value) {
+ if (strpos($dsn, $value) !== false) {
+ $notify[] = $value;
+ }
+ }
+ }
+
+ $rcpt = 'RCPT TO:<' . $address . '> NOTIFY=' . implode(',', $notify);
+ }
+
return $this->sendCommand(
'RCPT TO',
- 'RCPT TO:<' . $address . '>',
- array(250, 251)
+ $rcpt,
+ [250, 251]
);
}
/**
* Send an SMTP RSET command.
* Abort any transaction that is currently in progress.
- * Implements rfc 821: RSET <CRLF>
- * @access public
- * @return boolean True on success.
+ * Implements RFC 821: RSET <CRLF>.
+ *
+ * @return bool True on success
*/
public function reset()
{
/**
* Send a command to an SMTP server and check its return code.
- * @param string $command The command name - not sent to the server
- * @param string $commandstring The actual command to send
- * @param integer|array $expect One or more expected integer success codes
- * @access protected
- * @return boolean True on success.
+ *
+ * @param string $command The command name - not sent to the server
+ * @param string $commandstring The actual command to send
+ * @param int|array $expect One or more expected integer success codes
+ *
+ * @return bool True on success
*/
protected function sendCommand($command, $commandstring, $expect)
{
if (!$this->connected()) {
$this->setError("Called $command without being connected");
+
return false;
}
//Reject line breaks in all commands
- if (strpos($commandstring, "\n") !== false or strpos($commandstring, "\r") !== false) {
+ if ((strpos($commandstring, "\n") !== false) || (strpos($commandstring, "\r") !== false)) {
$this->setError("Command '$command' contained line breaks");
+
return false;
}
- $this->client_send($commandstring . self::CRLF);
+ $this->client_send($commandstring . static::LE, $command);
$this->last_reply = $this->get_lines();
// Fetch SMTP code and possible error code explanation
- $matches = array();
- if (preg_match("/^([0-9]{3})[ -](?:([0-9]\\.[0-9]\\.[0-9]) )?/", $this->last_reply, $matches)) {
- $code = $matches[1];
+ $matches = [];
+ if (preg_match('/^([\d]{3})[ -](?:([\d]\\.[\d]\\.[\d]{1,2}) )?/', $this->last_reply, $matches)) {
+ $code = (int) $matches[1];
$code_ex = (count($matches) > 2 ? $matches[2] : null);
// Cut off error code from each response line
$detail = preg_replace(
- "/{$code}[ -]".($code_ex ? str_replace('.', '\\.', $code_ex).' ' : '')."/m",
+ "/{$code}[ -]" .
+ ($code_ex ? str_replace('.', '\\.', $code_ex) . ' ' : '') . '/m',
'',
$this->last_reply
);
} else {
// Fall back to simple parsing if regex fails
- $code = substr($this->last_reply, 0, 3);
+ $code = (int) substr($this->last_reply, 0, 3);
$code_ex = null;
$detail = substr($this->last_reply, 4);
}
$this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER);
- if (!in_array($code, (array)$expect)) {
+ if (!in_array($code, (array) $expect, true)) {
$this->setError(
"$command command failed",
$detail,
'SMTP ERROR: ' . $this->error['error'] . ': ' . $this->last_reply,
self::DEBUG_CLIENT
);
+
return false;
}
$this->setError('');
+
return true;
}
* commands may be called followed by a data command. This command
* will send the message to the users terminal if they are logged
* in and send them an email.
- * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
+ * Implements RFC 821: SAML <SP> FROM:<reverse-path> <CRLF>.
+ *
* @param string $from The address the message is from
- * @access public
- * @return boolean
+ *
+ * @return bool
*/
public function sendAndMail($from)
{
/**
* Send an SMTP VRFY command.
+ *
* @param string $name The name to verify
- * @access public
- * @return boolean
+ *
+ * @return bool
*/
public function verify($name)
{
- return $this->sendCommand('VRFY', "VRFY $name", array(250, 251));
+ return $this->sendCommand('VRFY', "VRFY $name", [250, 251]);
}
/**
* Send an SMTP NOOP command.
- * Used to keep keep-alives alive, doesn't actually do anything
- * @access public
- * @return boolean
+ * Used to keep keep-alives alive, doesn't actually do anything.
+ *
+ * @return bool
*/
public function noop()
{
* Send an SMTP TURN command.
* This is an optional command for SMTP that this class does not support.
* This method is here to make the RFC821 Definition complete for this class
- * and _may_ be implemented in future
- * Implements from rfc 821: TURN <CRLF>
- * @access public
- * @return boolean
+ * and _may_ be implemented in future.
+ * Implements from RFC 821: TURN <CRLF>.
+ *
+ * @return bool
*/
public function turn()
{
$this->setError('The SMTP TURN command is not implemented');
$this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT);
+
return false;
}
/**
* Send raw data to the server.
- * @param string $data The data to send
- * @access public
- * @return integer|boolean The number of bytes sent to the server or false on error
+ *
+ * @param string $data The data to send
+ * @param string $command Optionally, the command this is part of, used only for controlling debug output
+ *
+ * @return int|bool The number of bytes sent to the server or false on error
*/
- public function client_send($data)
+ public function client_send($data, $command = '')
{
- $this->edebug("CLIENT -> SERVER: $data", self::DEBUG_CLIENT);
- return fwrite($this->smtp_conn, $data);
+ //If SMTP transcripts are left enabled, or debug output is posted online
+ //it can leak credentials, so hide credentials in all but lowest level
+ if (self::DEBUG_LOWLEVEL > $this->do_debug &&
+ in_array($command, ['User & Password', 'Username', 'Password'], true)) {
+ $this->edebug('CLIENT -> SERVER: [credentials hidden]', self::DEBUG_CLIENT);
+ } else {
+ $this->edebug('CLIENT -> SERVER: ' . $data, self::DEBUG_CLIENT);
+ }
+ set_error_handler([$this, 'errorHandler']);
+ $result = fwrite($this->smtp_conn, $data);
+ restore_error_handler();
+
+ return $result;
}
/**
* Get the latest error.
- * @access public
+ *
* @return array
*/
public function getError()
}
/**
- * Get SMTP extensions available on the server
- * @access public
+ * Get SMTP extensions available on the server.
+ *
* @return array|null
*/
public function getServerExtList()
}
/**
- * A multipurpose method
- * The method works in three ways, dependent on argument value and current state
- * 1. HELO/EHLO was not sent - returns null and set up $this->error
- * 2. HELO was sent
- * $name = 'HELO': returns server name
- * $name = 'EHLO': returns boolean false
- * $name = any string: returns null and set up $this->error
- * 3. EHLO was sent
- * $name = 'HELO'|'EHLO': returns server name
- * $name = any string: if extension $name exists, returns boolean True
- * or its options. Otherwise returns boolean False
- * In other words, one can use this method to detect 3 conditions:
- * - null returned: handshake was not or we don't know about ext (refer to $this->error)
- * - false returned: the requested feature exactly not exists
- * - positive value returned: the requested feature exists
+ * Get metadata about the SMTP server from its HELO/EHLO response.
+ * The method works in three ways, dependent on argument value and current state:
+ * 1. HELO/EHLO has not been sent - returns null and populates $this->error.
+ * 2. HELO has been sent -
+ * $name == 'HELO': returns server name
+ * $name == 'EHLO': returns boolean false
+ * $name == any other string: returns null and populates $this->error
+ * 3. EHLO has been sent -
+ * $name == 'HELO'|'EHLO': returns the server name
+ * $name == any other string: if extension $name exists, returns True
+ * or its options (e.g. AUTH mechanisms supported). Otherwise returns False.
+ *
* @param string $name Name of SMTP extension or 'HELO'|'EHLO'
- * @return mixed
+ *
+ * @return string|bool|null
*/
public function getServerExt($name)
{
if (!$this->server_caps) {
$this->setError('No HELO/EHLO was sent');
- return null;
+
+ return;
}
- // the tight logic knot ;)
if (!array_key_exists($name, $this->server_caps)) {
- if ($name == 'HELO') {
+ if ('HELO' === $name) {
return $this->server_caps['EHLO'];
}
- if ($name == 'EHLO' || array_key_exists('EHLO', $this->server_caps)) {
+ if ('EHLO' === $name || array_key_exists('EHLO', $this->server_caps)) {
return false;
}
- $this->setError('HELO handshake was used. Client knows nothing about server extensions');
- return null;
+ $this->setError('HELO handshake was used; No information about server extensions available');
+
+ return;
}
return $this->server_caps[$name];
/**
* Get the last reply from the server.
- * @access public
+ *
* @return string
*/
public function getLastReply()
* With SMTP we can tell if we have more lines to read if the
* 4th character is '-' symbol. If it is a space then we don't
* need to read anything else.
- * @access protected
+ *
* @return string
*/
protected function get_lines()
if ($this->Timelimit > 0) {
$endtime = time() + $this->Timelimit;
}
+ $selR = [$this->smtp_conn];
+ $selW = null;
while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) {
- $str = @fgets($this->smtp_conn, 515);
- $this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL);
- $this->edebug("SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL);
+ //Must pass vars in here as params are by reference
+ if (!stream_select($selR, $selW, $selW, $this->Timelimit)) {
+ $this->edebug(
+ 'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)',
+ self::DEBUG_LOWLEVEL
+ );
+ break;
+ }
+ //Deliberate noise suppression - errors are handled afterwards
+ $str = @fgets($this->smtp_conn, self::MAX_REPLY_LENGTH);
+ $this->edebug('SMTP INBOUND: "' . trim($str) . '"', self::DEBUG_LOWLEVEL);
$data .= $str;
- // If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen
- if ((isset($str[3]) and $str[3] == ' ')) {
+ // If response is only 3 chars (not valid, but RFC5321 S4.2 says it must be handled),
+ // or 4th character is a space or a line break char, we are done reading, break the loop.
+ // String array access is a significant micro-optimisation over strlen
+ if (!isset($str[3]) || $str[3] === ' ' || $str[3] === "\r" || $str[3] === "\n") {
break;
}
// Timed-out? Log and break
break;
}
// Now check if reads took too long
- if ($endtime and time() > $endtime) {
+ if ($endtime && time() > $endtime) {
$this->edebug(
- 'SMTP -> get_lines(): timelimit reached ('.
+ 'SMTP -> get_lines(): timelimit reached (' .
$this->Timelimit . ' sec)',
self::DEBUG_LOWLEVEL
);
break;
}
}
+
return $data;
}
/**
* Enable or disable VERP address generation.
- * @param boolean $enabled
+ *
+ * @param bool $enabled
*/
public function setVerp($enabled = false)
{
/**
* Get VERP address generation mode.
- * @return boolean
+ *
+ * @return bool
*/
public function getVerp()
{
/**
* Set error messages and codes.
- * @param string $message The error message
- * @param string $detail Further detail on the error
- * @param string $smtp_code An associated SMTP error code
+ *
+ * @param string $message The error message
+ * @param string $detail Further detail on the error
+ * @param string $smtp_code An associated SMTP error code
* @param string $smtp_code_ex Extended SMTP code
*/
protected function setError($message, $detail = '', $smtp_code = '', $smtp_code_ex = '')
{
- $this->error = array(
+ $this->error = [
'error' => $message,
'detail' => $detail,
'smtp_code' => $smtp_code,
- 'smtp_code_ex' => $smtp_code_ex
- );
+ 'smtp_code_ex' => $smtp_code_ex,
+ ];
}
/**
* Set debug output method.
- * @param string|callable $method The name of the mechanism to use for debugging output, or a callable to handle it.
+ *
+ * @param string|callable $method The name of the mechanism to use for debugging output, or a callable to handle it
*/
public function setDebugOutput($method = 'echo')
{
/**
* Get debug output method.
+ *
* @return string
*/
public function getDebugOutput()
/**
* Set debug output level.
- * @param integer $level
+ *
+ * @param int $level
*/
public function setDebugLevel($level = 0)
{
/**
* Get debug output level.
- * @return integer
+ *
+ * @return int
*/
public function getDebugLevel()
{
/**
* Set SMTP timeout.
- * @param integer $timeout
+ *
+ * @param int $timeout The timeout duration in seconds
*/
public function setTimeout($timeout = 0)
{
/**
* Get SMTP timeout.
- * @return integer
+ *
+ * @return int
*/
public function getTimeout()
{
return $this->Timeout;
}
+
+ /**
+ * Reports an error number and string.
+ *
+ * @param int $errno The error number returned by PHP
+ * @param string $errmsg The error message returned by PHP
+ * @param string $errfile The file the error occurred in
+ * @param int $errline The line number the error occurred on
+ */
+ protected function errorHandler($errno, $errmsg, $errfile = '', $errline = 0)
+ {
+ $notice = 'Connection failed.';
+ $this->setError(
+ $notice,
+ $errmsg,
+ (string) $errno
+ );
+ $this->edebug(
+ "$notice Error #$errno: $errmsg [$errfile line $errline]",
+ self::DEBUG_CONNECTION
+ );
+ }
+
+ /**
+ * Extract and return the ID of the last SMTP transaction based on
+ * a list of patterns provided in SMTP::$smtp_transaction_id_patterns.
+ * Relies on the host providing the ID in response to a DATA command.
+ * If no reply has been received yet, it will return null.
+ * If no pattern was matched, it will return false.
+ *
+ * @return bool|string|null
+ */
+ protected function recordLastTransactionID()
+ {
+ $reply = $this->getLastReply();
+
+ if (empty($reply)) {
+ $this->last_smtp_transaction_id = null;
+ } else {
+ $this->last_smtp_transaction_id = false;
+ foreach ($this->smtp_transaction_id_patterns as $smtp_transaction_id_pattern) {
+ if (preg_match($smtp_transaction_id_pattern, $reply, $matches)) {
+ $this->last_smtp_transaction_id = trim($matches[1]);
+ break;
+ }
+ }
+ }
+
+ return $this->last_smtp_transaction_id;
+ }
+
+ /**
+ * Get the queue/transaction ID of the last SMTP transaction
+ * If no reply has been received yet, it will return null.
+ * If no pattern was matched, it will return false.
+ *
+ * @return bool|string|null
+ *
+ * @see recordLastTransactionID()
+ */
+ public function getLastTransactionID()
+ {
+ return $this->last_smtp_transaction_id;
+ }
}
+++ /dev/null
-<?php
-require_once 'vendor/autoload.php';
-spl_autoload_register(function ($class) {
- require_once strtr($class, '\\_', '//').'.php';
-});
+++ /dev/null
-#!/usr/bin/env bash
-
-# Fake POP3 server
-# By Marcus Bointon <phpmailer@synchromedia.co.uk>
-# Based on code by 'Frater' found at http://www.linuxquestions.org/questions/programming-9/fake-pop3-server-to-capture-pop3-passwords-933733
-# Does not actually serve any mail, but supports commands sufficient to test POP-before SMTP
-# Can be run directly from a shell like this:
-# mkfifo fifo; nc -l 1100 <fifo |./fakepopserver.sh >fifo; rm fifo
-# It will accept any user name and will return a positive response for the password 'test'
-
-# Licensed under the GNU Lesser General Public License: http://www.gnu.org/copyleft/lesser.html
-
-# Enable debug output
-#set -xv
-export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
-
-LOGFOLDER=/tmp
-
-LOGFILE=${LOGFOLDER}/fakepop.log
-
-LOGGING=1
-DEBUG=1
-TIMEOUT=60
-
-POP_USER=
-POP_PASSWRD=test
-
-LINES=1
-BREAK=0
-
-write_log () {
- if [ ${LINES} -eq 1 ] ; then
- echo '---' >>${LOGFILE}
- fi
- let LINES+=1
- [ ${LOGGING} = 0 ] || echo -e "`date '+%b %d %H:%M'` pop3 $*" >>${LOGFILE}
-}
-
-ANSWER="+OK Fake POP3 Service Ready"
-
-while [ ${BREAK} -eq 0 ] ; do
- echo -en "${ANSWER}\r\n"
-
- REPLY=""
-
- #Input appears in $REPLY
- read -t ${TIMEOUT}
-
- ANSWER="+OK "
- COMMAND=""
- ARGS=""
- TIMEOUT=30
-
- if [ "$REPLY" ] ; then
- write_log "RAW input: '`echo "${REPLY}" | tr -cd '[ -~]'`'"
-
- COMMAND="`echo "${REPLY}" | awk '{print $1}' | tr -cd '\40-\176' | tr 'a-z' 'A-Z'`"
- ARGS="`echo "${REPLY}" | tr -cd '\40-\176' | awk '{for(i=2;i<=NF;i++){printf "%s ", $i};printf "\n"}' | sed 's/ $//'`"
-
- write_log "Command: \"${COMMAND}\""
- write_log "Arguments: \"${ARGS}\""
-
- case "$COMMAND" in
- QUIT)
- break
- ;;
- USER)
- if [ -n "${ARGS}" ] ; then
- POP_USER="${ARGS}"
- ANSWER="+OK Please send PASS command"
- fi
- ;;
- AUTH)
- ANSWER="+OK \r\n."
- ;;
- CAPA)
- ANSWER="+OK Capabilities include\r\nUSER\r\nCAPA\r\n."
- ;;
- PASS)
- if [ "${POP_PASSWRD}" == "${ARGS}" ] ; then
- ANSWER="+OK Logged in."
- AUTH=1
- else
- ANSWER="-ERR Login failed."
- fi
- ;;
- LIST)
- if [ "${AUTH}" = 0 ] ; then
- ANSWER="-ERR Not authenticated"
- else
- if [ -z "${ARGS}" ] ; then
- ANSWER="+OK No messages, really\r\n."
- else
- ANSWER="-ERR No messages, no list, no status"
- fi
- fi
- ;;
- RSET)
- ANSWER="+OK Resetting or whatever\r\n."
- ;;
- LAST)
- if [ "${AUTH}" = 0 ] ; then
- ANSWER="-ERR Not authenticated"
- else
- ANSWER="+OK 0"
- fi
- ;;
- STAT)
- if [ "${AUTH}" = 0 ] ; then
- ANSWER="-ERR Not authenticated"
- else
- ANSWER="+OK 0 0"
- fi
- ;;
- NOOP)
- ANSWER="+OK Hang on, doing nothing"
- ;;
- esac
- else
- echo "+OK Connection timed out"
- break
- fi
-done
-
-echo "+OK Bye!\r\n"
+++ /dev/null
-#!/usr/bin/env bash
-#Fake sendmail script, adapted from:
-#https://github.com/mrded/MNPP/blob/ee64fb2a88efc70ba523b78e9ce61f9f1ed3b4a9/init/fake-sendmail.sh
-
-#Create a temp folder to put messages in
-numPath="${TMPDIR-/tmp/}fakemail"
-umask 037
-mkdir -p $numPath
-
-if [ ! -f $numPath/num ]; then
- echo "0" > $numPath/num
-fi
-num=`cat $numPath/num`
-num=$(($num + 1))
-echo $num > $numPath/num
-
-name="$numPath/message_$num.eml"
-while read line
-do
- echo $line >> $name
-done
-exit 0
+++ /dev/null
-<?php
-/**
- * PHPMailer - language file tests
- * Requires PHPUnit 3.3 or later.
- *
- * PHP version 5.0.0
- *
- * @package PHPMailer
- * @author Andy Prevost
- * @author Marcus Bointon <phpmailer@synchromedia.co.uk>
- * @copyright 2004 - 2009 Andy Prevost
- * @copyright 2010 Marcus Bointon
- * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
- */
-
-require_once '../PHPMailerAutoload.php';
-
-/**
- * PHPMailer - PHP email transport unit test class
- * Performs authentication tests
- */
-class PHPMailerLangTest extends PHPUnit_Framework_TestCase
-{
- /**
- * Holds a phpmailer instance.
- * @private
- * @var PHPMailer
- */
- public $Mail;
-
- /**
- * @var string Default include path
- */
- public $INCLUDE_DIR = '../';
-
- /**
- * Run before each test is started.
- */
- public function setUp()
- {
- $this->Mail = new PHPMailer;
- }
-
- /**
- * Test language files for missing and excess translations
- * All languages are compared with English
- * @group languages
- */
- public function testTranslations()
- {
- $this->Mail->setLanguage('en');
- $definedStrings = $this->Mail->getTranslations();
- $err = '';
- foreach (new DirectoryIterator('../language') as $fileInfo) {
- if ($fileInfo->isDot()) {
- continue;
- }
- $matches = array();
- //Only look at language files, ignore anything else in there
- if (preg_match('/^phpmailer\.lang-([a-z_]{2,})\.php$/', $fileInfo->getFilename(), $matches)) {
- $lang = $matches[1]; //Extract language code
- $PHPMAILER_LANG = array(); //Language strings get put in here
- include $fileInfo->getPathname(); //Get language strings
- $missing = array_diff(array_keys($definedStrings), array_keys($PHPMAILER_LANG));
- $extra = array_diff(array_keys($PHPMAILER_LANG), array_keys($definedStrings));
- if (!empty($missing)) {
- $err .= "\nMissing translations in $lang: " . implode(', ', $missing);
- }
- if (!empty($extra)) {
- $err .= "\nExtra translations in $lang: " . implode(', ', $extra);
- }
- }
- }
- $this->assertEmpty($err, $err);
- }
-}
+++ /dev/null
-<?php
-/**
- * PHPMailer - PHP email transport unit tests
- * Requires PHPUnit 3.3 or later.
- *
- * PHP version 5.0.0
- *
- * @package PHPMailer
- * @author Andy Prevost
- * @author Marcus Bointon <phpmailer@synchromedia.co.uk>
- * @copyright 2004 - 2009 Andy Prevost
- * @copyright 2010 Marcus Bointon
- * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
- */
-
-require_once realpath('../PHPMailerAutoload.php');
-
-/**
- * PHPMailer - PHP email transport unit test class
- * Performs authentication tests
- */
-class PHPMailerTest extends PHPUnit_Framework_TestCase
-{
- /**
- * Holds the default phpmailer instance.
- * @private
- * @var PHPMailer
- */
- public $Mail;
-
- /**
- * Holds the SMTP mail host.
- * @public
- * @var string
- */
- public $Host = '';
-
- /**
- * Holds the change log.
- * @private
- * @var string[]
- */
- public $ChangeLog = array();
-
- /**
- * Holds the note log.
- * @private
- * @var string[]
- */
- public $NoteLog = array();
-
- /**
- * PIDs of any processes we need to kill
- * @var array
- * @access private
- */
- private $pids = array();
-
- /**
- * Default include path
- * @var string
- */
- const INCLUDE_DIR = '../';
-
- /**
- * Run before each test is started.
- */
- public function setUp()
- {
- if (file_exists('testbootstrap.php')) {
- include 'testbootstrap.php'; //Overrides go in here
- }
- $this->Mail = new PHPMailer;
- $this->Mail->SMTPDebug = 3; //Full debug output
- $this->Mail->Priority = 3;
- $this->Mail->Encoding = '8bit';
- $this->Mail->CharSet = 'iso-8859-1';
- if (array_key_exists('mail_from', $_REQUEST)) {
- $this->Mail->From = $_REQUEST['mail_from'];
- } else {
- $this->Mail->From = 'unit_test@phpmailer.example.com';
- }
- $this->Mail->FromName = 'Unit Tester';
- $this->Mail->Sender = '';
- $this->Mail->Subject = 'Unit Test';
- $this->Mail->Body = '';
- $this->Mail->AltBody = '';
- $this->Mail->WordWrap = 0;
- if (array_key_exists('mail_host', $_REQUEST)) {
- $this->Mail->Host = $_REQUEST['mail_host'];
- } else {
- $this->Mail->Host = 'mail.example.com';
- }
- if (array_key_exists('mail_port', $_REQUEST)) {
- $this->Mail->Port = $_REQUEST['mail_port'];
- } else {
- $this->Mail->Port = 25;
- }
- $this->Mail->Helo = 'localhost.localdomain';
- $this->Mail->SMTPAuth = false;
- $this->Mail->Username = '';
- $this->Mail->Password = '';
- $this->Mail->addReplyTo('no_reply@phpmailer.example.com', 'Reply Guy');
- $this->Mail->Sender = 'unit_test@phpmailer.example.com';
- if (strlen($this->Mail->Host) > 0) {
- $this->Mail->Mailer = 'smtp';
- } else {
- $this->Mail->Mailer = 'mail';
- }
- if (array_key_exists('mail_to', $_REQUEST)) {
- $this->setAddress($_REQUEST['mail_to'], 'Test User', 'to');
- }
- if (array_key_exists('mail_cc', $_REQUEST) and strlen($_REQUEST['mail_cc']) > 0) {
- $this->setAddress($_REQUEST['mail_cc'], 'Carbon User', 'cc');
- }
- }
-
- /**
- * Run after each test is completed.
- */
- public function tearDown()
- {
- // Clean global variables
- $this->Mail = null;
- $this->ChangeLog = array();
- $this->NoteLog = array();
-
- foreach ($this->pids as $pid) {
- $p = escapeshellarg($pid);
- shell_exec("ps $p && kill -TERM $p");
- }
- }
-
-
- /**
- * Build the body of the message in the appropriate format.
- *
- * @private
- * @return void
- */
- public function buildBody()
- {
- $this->checkChanges();
-
- // Determine line endings for message
- if ($this->Mail->ContentType == 'text/html' || strlen($this->Mail->AltBody) > 0) {
- $eol = "<br>\r\n";
- $bullet_start = '<li>';
- $bullet_end = "</li>\r\n";
- $list_start = "<ul>\r\n";
- $list_end = "</ul>\r\n";
- } else {
- $eol = "\r\n";
- $bullet_start = ' - ';
- $bullet_end = "\r\n";
- $list_start = '';
- $list_end = '';
- }
-
- $ReportBody = '';
-
- $ReportBody .= '---------------------' . $eol;
- $ReportBody .= 'Unit Test Information' . $eol;
- $ReportBody .= '---------------------' . $eol;
- $ReportBody .= 'phpmailer version: ' . $this->Mail->Version . $eol;
- $ReportBody .= 'Content Type: ' . $this->Mail->ContentType . $eol;
- $ReportBody .= 'CharSet: ' . $this->Mail->CharSet . $eol;
-
- if (strlen($this->Mail->Host) > 0) {
- $ReportBody .= 'Host: ' . $this->Mail->Host . $eol;
- }
-
- // If attachments then create an attachment list
- $attachments = $this->Mail->getAttachments();
- if (count($attachments) > 0) {
- $ReportBody .= 'Attachments:' . $eol;
- $ReportBody .= $list_start;
- foreach ($attachments as $attachment) {
- $ReportBody .= $bullet_start . 'Name: ' . $attachment[1] . ', ';
- $ReportBody .= 'Encoding: ' . $attachment[3] . ', ';
- $ReportBody .= 'Type: ' . $attachment[4] . $bullet_end;
- }
- $ReportBody .= $list_end . $eol;
- }
-
- // If there are changes then list them
- if (count($this->ChangeLog) > 0) {
- $ReportBody .= 'Changes' . $eol;
- $ReportBody .= '-------' . $eol;
-
- $ReportBody .= $list_start;
- for ($i = 0; $i < count($this->ChangeLog); $i++) {
- $ReportBody .= $bullet_start . $this->ChangeLog[$i][0] . ' was changed to [' .
- $this->ChangeLog[$i][1] . ']' . $bullet_end;
- }
- $ReportBody .= $list_end . $eol . $eol;
- }
-
- // If there are notes then list them
- if (count($this->NoteLog) > 0) {
- $ReportBody .= 'Notes' . $eol;
- $ReportBody .= '-----' . $eol;
-
- $ReportBody .= $list_start;
- for ($i = 0; $i < count($this->NoteLog); $i++) {
- $ReportBody .= $bullet_start . $this->NoteLog[$i] . $bullet_end;
- }
- $ReportBody .= $list_end;
- }
-
- // Re-attach the original body
- $this->Mail->Body .= $eol . $ReportBody;
- }
-
- /**
- * Check which default settings have been changed for the report.
- * @private
- * @return void
- */
- public function checkChanges()
- {
- if ($this->Mail->Priority != 3) {
- $this->addChange('Priority', $this->Mail->Priority);
- }
- if ($this->Mail->Encoding != '8bit') {
- $this->addChange('Encoding', $this->Mail->Encoding);
- }
- if ($this->Mail->CharSet != 'iso-8859-1') {
- $this->addChange('CharSet', $this->Mail->CharSet);
- }
- if ($this->Mail->Sender != '') {
- $this->addChange('Sender', $this->Mail->Sender);
- }
- if ($this->Mail->WordWrap != 0) {
- $this->addChange('WordWrap', $this->Mail->WordWrap);
- }
- if ($this->Mail->Mailer != 'mail') {
- $this->addChange('Mailer', $this->Mail->Mailer);
- }
- if ($this->Mail->Port != 25) {
- $this->addChange('Port', $this->Mail->Port);
- }
- if ($this->Mail->Helo != 'localhost.localdomain') {
- $this->addChange('Helo', $this->Mail->Helo);
- }
- if ($this->Mail->SMTPAuth) {
- $this->addChange('SMTPAuth', 'true');
- }
- }
-
- /**
- * Add a changelog entry.
- * @access private
- * @param string $sName
- * @param string $sNewValue
- * @return void
- */
- public function addChange($sName, $sNewValue)
- {
- $this->ChangeLog[] = array($sName, $sNewValue);
- }
-
- /**
- * Adds a simple note to the message.
- * @public
- * @param string $sValue
- * @return void
- */
- public function addNote($sValue)
- {
- $this->NoteLog[] = $sValue;
- }
-
- /**
- * Adds all of the addresses
- * @access public
- * @param string $sAddress
- * @param string $sName
- * @param string $sType
- * @return boolean
- */
- public function setAddress($sAddress, $sName = '', $sType = 'to')
- {
- switch ($sType) {
- case 'to':
- return $this->Mail->addAddress($sAddress, $sName);
- case 'cc':
- return $this->Mail->addCC($sAddress, $sName);
- case 'bcc':
- return $this->Mail->addBCC($sAddress, $sName);
- }
- return false;
- }
-
- /**
- * Check that we have loaded default test params.
- * Pretty much everything will fail due to unset recipient if this is not done.
- */
- public function testBootstrap()
- {
- $this->assertTrue(
- file_exists('testbootstrap.php'),
- 'Test config params missing - copy testbootstrap.php to testbootstrap-dist.php and change as appropriate'
- );
- }
-
- /**
- * Test CRAM-MD5 authentication.
- * Needs a connection to a server that supports this auth mechanism, so commented out by default
- */
- public function testAuthCRAMMD5()
- {
- $this->Mail->Host = 'hostname';
- $this->Mail->Port = 587;
- $this->Mail->SMTPAuth = true;
- $this->Mail->SMTPSecure = 'tls';
- $this->Mail->AuthType = 'CRAM-MD5';
- $this->Mail->Username = 'username';
- $this->Mail->Password = 'password';
- $this->Mail->Body = 'Test body';
- $this->Mail->Subject .= ': Auth CRAM-MD5';
- $this->Mail->From = 'from@example.com';
- $this->Mail->Sender = 'from@example.com';
- $this->Mail->clearAllRecipients();
- $this->Mail->addAddress('user@example.com');
- //$this->assertTrue($this->mail->send(), $this->mail->ErrorInfo);
- }
-
- /**
- * Test email address validation.
- * Test addresses obtained from http://isemail.info
- * Some failing cases commented out that are apparently up for debate!
- */
- public function testValidate()
- {
- $validaddresses = array(
- 'first@iana.org',
- 'first.last@iana.org',
- '1234567890123456789012345678901234567890123456789012345678901234@iana.org',
- '"first\"last"@iana.org',
- '"first@last"@iana.org',
- '"first\last"@iana.org',
- 'first.last@[12.34.56.78]',
- 'first.last@[IPv6:::12.34.56.78]',
- 'first.last@[IPv6:1111:2222:3333::4444:12.34.56.78]',
- 'first.last@[IPv6:1111:2222:3333:4444:5555:6666:12.34.56.78]',
- 'first.last@[IPv6:::1111:2222:3333:4444:5555:6666]',
- 'first.last@[IPv6:1111:2222:3333::4444:5555:6666]',
- 'first.last@[IPv6:1111:2222:3333:4444:5555:6666::]',
- 'first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888]',
- 'first.last@x23456789012345678901234567890123456789012345678901234567890123.iana.org',
- 'first.last@3com.com',
- 'first.last@123.iana.org',
- '"first\last"@iana.org',
- 'first.last@[IPv6:1111:2222:3333::4444:5555:12.34.56.78]',
- 'first.last@[IPv6:1111:2222:3333::4444:5555:6666:7777]',
- 'first.last@example.123',
- 'first.last@com',
- '"Abc\@def"@iana.org',
- '"Fred\ Bloggs"@iana.org',
- '"Joe.\Blow"@iana.org',
- '"Abc@def"@iana.org',
- 'user+mailbox@iana.org',
- 'customer/department=shipping@iana.org',
- '$A12345@iana.org',
- '!def!xyz%abc@iana.org',
- '_somename@iana.org',
- 'dclo@us.ibm.com',
- 'peter.piper@iana.org',
- '"Doug \"Ace\" L."@iana.org',
- 'test@iana.org',
- 'TEST@iana.org',
- '1234567890@iana.org',
- 'test+test@iana.org',
- 'test-test@iana.org',
- 't*est@iana.org',
- '+1~1+@iana.org',
- '{_test_}@iana.org',
- '"[[ test ]]"@iana.org',
- 'test.test@iana.org',
- '"test.test"@iana.org',
- 'test."test"@iana.org',
- '"test@test"@iana.org',
- 'test@123.123.123.x123',
- 'test@123.123.123.123',
- 'test@[123.123.123.123]',
- 'test@example.iana.org',
- 'test@example.example.iana.org',
- '"test\test"@iana.org',
- 'test@example',
- '"test\blah"@iana.org',
- '"test\blah"@iana.org',
- '"test\"blah"@iana.org',
- 'customer/department@iana.org',
- '_Yosemite.Sam@iana.org',
- '~@iana.org',
- '"Austin@Powers"@iana.org',
- 'Ima.Fool@iana.org',
- '"Ima.Fool"@iana.org',
- '"Ima Fool"@iana.org',
- '"first"."last"@iana.org',
- '"first".middle."last"@iana.org',
- '"first".last@iana.org',
- 'first."last"@iana.org',
- '"first"."middle"."last"@iana.org',
- '"first.middle"."last"@iana.org',
- '"first.middle.last"@iana.org',
- '"first..last"@iana.org',
- '"first\"last"@iana.org',
- 'first."mid\dle"."last"@iana.org',
- '"test blah"@iana.org',
- '(foo)cal(bar)@(baz)iamcal.com(quux)',
- 'cal@iamcal(woo).(yay)com',
- 'cal(woo(yay)hoopla)@iamcal.com',
- 'cal(foo\@bar)@iamcal.com',
- 'cal(foo\)bar)@iamcal.com',
- 'first().last@iana.org',
- 'pete(his account)@silly.test(his host)',
- 'c@(Chris\'s host.)public.example',
- 'jdoe@machine(comment). example',
- '1234 @ local(blah) .machine .example',
- 'first(abc.def).last@iana.org',
- 'first(a"bc.def).last@iana.org',
- 'first.(")middle.last(")@iana.org',
- 'first(abc\(def)@iana.org',
- 'first.last@x(1234567890123456789012345678901234567890123456789012345678901234567890).com',
- 'a(a(b(c)d(e(f))g)h(i)j)@iana.org',
- 'name.lastname@domain.com',
- 'a@b',
- 'a@bar.com',
- 'aaa@[123.123.123.123]',
- 'a@bar',
- 'a-b@bar.com',
- '+@b.c',
- '+@b.com',
- 'a@b.co-foo.uk',
- '"hello my name is"@stutter.com',
- '"Test \"Fail\" Ing"@iana.org',
- 'valid@about.museum',
- 'shaitan@my-domain.thisisminekthx',
- 'foobar@192.168.0.1',
- '"Joe\Blow"@iana.org',
- 'HM2Kinsists@(that comments are allowed)this.is.ok',
- 'user%uucp!path@berkeley.edu',
- 'first.last @iana.org',
- 'cdburgess+!#$%&\'*-/=?+_{}|~test@gmail.com',
- 'first.last@[IPv6:::a2:a3:a4:b1:b2:b3:b4]',
- 'first.last@[IPv6:a1:a2:a3:a4:b1:b2:b3::]',
- 'first.last@[IPv6:::]',
- 'first.last@[IPv6:::b4]',
- 'first.last@[IPv6:::b3:b4]',
- 'first.last@[IPv6:a1::b4]',
- 'first.last@[IPv6:a1::]',
- 'first.last@[IPv6:a1:a2::]',
- 'first.last@[IPv6:0123:4567:89ab:cdef::]',
- 'first.last@[IPv6:0123:4567:89ab:CDEF::]',
- 'first.last@[IPv6:::a3:a4:b1:ffff:11.22.33.44]',
- 'first.last@[IPv6:::a2:a3:a4:b1:ffff:11.22.33.44]',
- 'first.last@[IPv6:a1:a2:a3:a4::11.22.33.44]',
- 'first.last@[IPv6:a1:a2:a3:a4:b1::11.22.33.44]',
- 'first.last@[IPv6:a1::11.22.33.44]',
- 'first.last@[IPv6:a1:a2::11.22.33.44]',
- 'first.last@[IPv6:0123:4567:89ab:cdef::11.22.33.44]',
- 'first.last@[IPv6:0123:4567:89ab:CDEF::11.22.33.44]',
- 'first.last@[IPv6:a1::b2:11.22.33.44]',
- 'test@test.com',
- 'test@xn--example.com',
- 'test@example.com'
- );
- $invalidaddresses = array(
- 'first.last@sub.do,com',
- 'first\@last@iana.org',
- '123456789012345678901234567890123456789012345678901234567890' .
- '@12345678901234567890123456789012345678901234 [...]',
- 'first.last',
- '12345678901234567890123456789012345678901234567890123456789012345@iana.org',
- '.first.last@iana.org',
- 'first.last.@iana.org',
- 'first..last@iana.org',
- '"first"last"@iana.org',
- '"""@iana.org',
- '"\"@iana.org',
- //'""@iana.org',
- 'first\@last@iana.org',
- 'first.last@',
- 'x@x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.' .
- 'x23456789.x23456789.x23456789.x23 [...]',
- 'first.last@[.12.34.56.78]',
- 'first.last@[12.34.56.789]',
- 'first.last@[::12.34.56.78]',
- 'first.last@[IPv5:::12.34.56.78]',
- 'first.last@[IPv6:1111:2222:3333:4444:5555:12.34.56.78]',
- 'first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:12.34.56.78]',
- 'first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777]',
- 'first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888:9999]',
- 'first.last@[IPv6:1111:2222::3333::4444:5555:6666]',
- 'first.last@[IPv6:1111:2222:333x::4444:5555]',
- 'first.last@[IPv6:1111:2222:33333::4444:5555]',
- 'first.last@-xample.com',
- 'first.last@exampl-.com',
- 'first.last@x234567890123456789012345678901234567890123456789012345678901234.iana.org',
- 'abc\@def@iana.org',
- 'abc\@iana.org',
- 'Doug\ \"Ace\"\ Lovell@iana.org',
- 'abc@def@iana.org',
- 'abc\@def@iana.org',
- 'abc\@iana.org',
- '@iana.org',
- 'doug@',
- '"qu@iana.org',
- 'ote"@iana.org',
- '.dot@iana.org',
- 'dot.@iana.org',
- 'two..dot@iana.org',
- '"Doug "Ace" L."@iana.org',
- 'Doug\ \"Ace\"\ L\.@iana.org',
- 'hello world@iana.org',
- //'helloworld@iana .org',
- 'gatsby@f.sc.ot.t.f.i.tzg.era.l.d.',
- 'test.iana.org',
- 'test.@iana.org',
- 'test..test@iana.org',
- '.test@iana.org',
- 'test@test@iana.org',
- 'test@@iana.org',
- '-- test --@iana.org',
- '[test]@iana.org',
- '"test"test"@iana.org',
- '()[]\;:,><@iana.org',
- 'test@.',
- 'test@example.',
- 'test@.org',
- 'test@12345678901234567890123456789012345678901234567890123456789012345678901234567890' .
- '12345678901234567890 [...]',
- 'test@[123.123.123.123',
- 'test@123.123.123.123]',
- 'NotAnEmail',
- '@NotAnEmail',
- '"test"blah"@iana.org',
- '.wooly@iana.org',
- 'wo..oly@iana.org',
- 'pootietang.@iana.org',
- '.@iana.org',
- 'Ima Fool@iana.org',
- 'phil.h\@\@ck@haacked.com',
- 'foo@[\1.2.3.4]',
- //'first."".last@iana.org',
- 'first\last@iana.org',
- 'Abc\@def@iana.org',
- 'Fred\ Bloggs@iana.org',
- 'Joe.\Blow@iana.org',
- 'first.last@[IPv6:1111:2222:3333:4444:5555:6666:12.34.567.89]',
- '{^c\@**Dog^}@cartoon.com',
- //'"foo"(yay)@(hoopla)[1.2.3.4]',
- 'cal(foo(bar)@iamcal.com',
- 'cal(foo)bar)@iamcal.com',
- 'cal(foo\)@iamcal.com',
- 'first(12345678901234567890123456789012345678901234567890)last@(1234567890123456789' .
- '01234567890123456789012 [...]',
- 'first(middle)last@iana.org',
- 'first(abc("def".ghi).mno)middle(abc("def".ghi).mno).last@(abc("def".ghi).mno)example' .
- '(abc("def".ghi).mno). [...]',
- 'a(a(b(c)d(e(f))g)(h(i)j)@iana.org',
- '.@',
- '@bar.com',
- '@@bar.com',
- 'aaa.com',
- 'aaa@.com',
- 'aaa@.123',
- 'aaa@[123.123.123.123]a',
- 'aaa@[123.123.123.333]',
- 'a@bar.com.',
- 'a@-b.com',
- 'a@b-.com',
- '-@..com',
- '-@a..com',
- 'invalid@about.museum-',
- 'test@...........com',
- '"Unicode NULL' . chr(0) . '"@char.com',
- 'Unicode NULL' . chr(0) . '@char.com',
- 'first.last@[IPv6::]',
- 'first.last@[IPv6::::]',
- 'first.last@[IPv6::b4]',
- 'first.last@[IPv6::::b4]',
- 'first.last@[IPv6::b3:b4]',
- 'first.last@[IPv6::::b3:b4]',
- 'first.last@[IPv6:a1:::b4]',
- 'first.last@[IPv6:a1:]',
- 'first.last@[IPv6:a1:::]',
- 'first.last@[IPv6:a1:a2:]',
- 'first.last@[IPv6:a1:a2:::]',
- 'first.last@[IPv6::11.22.33.44]',
- 'first.last@[IPv6::::11.22.33.44]',
- 'first.last@[IPv6:a1:11.22.33.44]',
- 'first.last@[IPv6:a1:::11.22.33.44]',
- 'first.last@[IPv6:a1:a2:::11.22.33.44]',
- 'first.last@[IPv6:0123:4567:89ab:cdef::11.22.33.xx]',
- 'first.last@[IPv6:0123:4567:89ab:CDEFF::11.22.33.44]',
- 'first.last@[IPv6:a1::a4:b1::b4:11.22.33.44]',
- 'first.last@[IPv6:a1::11.22.33]',
- 'first.last@[IPv6:a1::11.22.33.44.55]',
- 'first.last@[IPv6:a1::b211.22.33.44]',
- 'first.last@[IPv6:a1::b2::11.22.33.44]',
- 'first.last@[IPv6:a1::b3:]',
- 'first.last@[IPv6::a2::b4]',
- 'first.last@[IPv6:a1:a2:a3:a4:b1:b2:b3:]',
- 'first.last@[IPv6::a2:a3:a4:b1:b2:b3:b4]',
- 'first.last@[IPv6:a1:a2:a3:a4::b1:b2:b3:b4]',
- //This is a valid RCC5322 address, but we don't want to allow it for obvious reasons!
- "(\r\n RCPT TO:user@example.com\r\n DATA \\\nSubject: spam10\\\n\r\n Hello,\r\n".
- " this is a spam mail.\\\n.\r\n QUIT\r\n ) a@example.net"
- );
- // IDNs in Unicode and ASCII forms.
- $unicodeaddresses = array(
- 'first.last@bücher.ch',
- 'first.last@кто.рф',
- 'first.last@phplíst.com',
- );
- $asciiaddresses = array(
- 'first.last@xn--bcher-kva.ch',
- 'first.last@xn--j1ail.xn--p1ai',
- 'first.last@xn--phplst-6va.com',
- );
- $goodfails = array();
- foreach (array_merge($validaddresses, $asciiaddresses) as $address) {
- if (!PHPMailer::validateAddress($address)) {
- $goodfails[] = $address;
- }
- }
- $badpasses = array();
- foreach (array_merge($invalidaddresses, $unicodeaddresses) as $address) {
- if (PHPMailer::validateAddress($address)) {
- $badpasses[] = $address;
- }
- }
- $err = '';
- if (count($goodfails) > 0) {
- $err .= "Good addresses that failed validation:\n";
- $err .= implode("\n", $goodfails);
- }
- if (count($badpasses) > 0) {
- if (!empty($err)) {
- $err .= "\n\n";
- }
- $err .= "Bad addresses that passed validation:\n";
- $err .= implode("\n", $badpasses);
- }
- $this->assertEmpty($err, $err);
- //For coverage
- $this->assertTrue(PHPMailer::validateAddress('test@example.com', 'auto'));
- $this->assertFalse(PHPMailer::validateAddress('test@example.com.', 'auto'));
- $this->assertTrue(PHPMailer::validateAddress('test@example.com', 'pcre'));
- $this->assertFalse(PHPMailer::validateAddress('test@example.com.', 'pcre'));
- $this->assertTrue(PHPMailer::validateAddress('test@example.com', 'pcre8'));
- $this->assertFalse(PHPMailer::validateAddress('test@example.com.', 'pcre8'));
- $this->assertTrue(PHPMailer::validateAddress('test@example.com', 'php'));
- $this->assertFalse(PHPMailer::validateAddress('test@example.com.', 'php'));
- $this->assertTrue(PHPMailer::validateAddress('test@example.com', 'noregex'));
- $this->assertFalse(PHPMailer::validateAddress('bad', 'noregex'));
- }
-
- /**
- * Test injecting a custom validator.
- */
- public function testCustomValidator()
- {
- //Inject a one-off custom validator
- $this->assertTrue(
- PHPMailer::validateAddress(
- 'user@example.com',
- function ($address) {
- return (strpos($address, '@') !== false);
- }
- ),
- 'Custom validator false negative'
- );
- $this->assertFalse(
- PHPMailer::validateAddress(
- 'userexample.com',
- function ($address) {
- return (strpos($address, '@') !== false);
- }
- ),
- 'Custom validator false positive'
- );
- //Set the default validator to an injected function
- PHPMailer::$validator = function ($address) {
- return ('user@example.com' === $address);
- };
- $this->assertTrue(
- $this->Mail->addAddress('user@example.com'),
- 'Custom default validator false negative'
- );
- $this->assertFalse(
- //Need to pick a failing value which would pass all other validators
- //to be sure we're using our custom one
- $this->Mail->addAddress('bananas@example.com'),
- 'Custom default validator false positive'
- );
- //Set default validator to PHP built-in
- PHPMailer::$validator = 'php';
- $this->assertFalse(
- //This is a valid address that FILTER_VALIDATE_EMAIL thinks is invalid
- $this->Mail->addAddress('first.last@example.123'),
- 'PHP validator not behaving as expected'
- );
- }
-
- /**
- * Word-wrap an ASCII message.
- */
- public function testWordWrap()
- {
- $this->Mail->WordWrap = 40;
- $my_body = str_repeat(
- 'Here is the main body of this message. It should ' .
- 'be quite a few lines. It should be wrapped at ' .
- '40 characters. Make sure that it is. ',
- 10
- );
- $nBodyLen = strlen($my_body);
- $my_body .= "\n\nThis is the above body length: " . $nBodyLen;
-
- $this->Mail->Body = $my_body;
- $this->Mail->Subject .= ': Wordwrap';
-
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Word-wrap a multibyte message.
- */
- public function testWordWrapMultibyte()
- {
- $this->Mail->WordWrap = 40;
- $my_body = str_repeat(
- '飛兒樂 團光茫 飛兒樂 團光茫 飛兒樂 團光茫 飛兒樂 團光茫 ' .
- '飛飛兒樂 團光茫兒樂 團光茫飛兒樂 團光飛兒樂 團光茫飛兒樂 團光茫兒樂 團光茫 ' .
- '飛兒樂 團光茫飛兒樂 團飛兒樂 團光茫光茫飛兒樂 團光茫. ',
- 10
- );
- $nBodyLen = strlen($my_body);
- $my_body .= "\n\nThis is the above body length: " . $nBodyLen;
-
- $this->Mail->Body = $my_body;
- $this->Mail->Subject .= ': Wordwrap multibyte';
-
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Test low priority.
- */
- public function testLowPriority()
- {
- $this->Mail->Priority = 5;
- $this->Mail->Body = 'Here is the main body. There should be ' .
- 'a reply to address in this message.';
- $this->Mail->Subject .= ': Low Priority';
- $this->Mail->addReplyTo('nobody@nobody.com', 'Nobody (Unit Test)');
-
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Simple plain file attachment test.
- */
- public function testMultiplePlainFileAttachment()
- {
- $this->Mail->Body = 'Here is the text body';
- $this->Mail->Subject .= ': Plain + Multiple FileAttachments';
-
- if (!$this->Mail->addAttachment(realpath(self::INCLUDE_DIR . 'examples/images/phpmailer.png'))) {
- $this->assertTrue(false, $this->Mail->ErrorInfo);
- return;
- }
-
- if (!$this->Mail->addAttachment(__FILE__, 'test.txt')) {
- $this->assertTrue(false, $this->Mail->ErrorInfo);
- return;
- }
-
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Simple plain string attachment test.
- */
- public function testPlainStringAttachment()
- {
- $this->Mail->Body = 'Here is the text body';
- $this->Mail->Subject .= ': Plain + StringAttachment';
-
- $sAttachment = 'These characters are the content of the ' .
- "string attachment.\nThis might be taken from a " .
- 'database or some other such thing. ';
-
- $this->Mail->addStringAttachment($sAttachment, 'string_attach.txt');
-
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Plain quoted-printable message.
- */
- public function testQuotedPrintable()
- {
- $this->Mail->Body = 'Here is the main body';
- $this->Mail->Subject .= ': Plain + Quoted-printable';
- $this->Mail->Encoding = 'quoted-printable';
-
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
-
- //Check that a quoted printable encode and decode results in the same as went in
- $t = file_get_contents(__FILE__); //Use this file as test content
- //Force line breaks to UNIX-style
- $t = str_replace(array("\r\n", "\r"), "\n", $t);
- $this->assertEquals(
- $t,
- quoted_printable_decode($this->Mail->encodeQP($t)),
- 'Quoted-Printable encoding round-trip failed'
- );
- $this->assertEquals(
- $this->Mail->encodeQP($t),
- $this->Mail->encodeQPphp($t),
- 'Quoted-Printable BC wrapper failed'
- );
- //Force line breaks to Windows-style
- $t = str_replace("\n", "\r\n", $t);
- $this->assertEquals(
- $t,
- quoted_printable_decode($this->Mail->encodeQP($t)),
- 'Quoted-Printable encoding round-trip failed (Windows line breaks)'
- );
- }
-
- /**
- * Send an HTML message.
- */
- public function testHtml()
- {
- $this->Mail->isHTML(true);
- $this->Mail->Subject .= ": HTML only";
-
- $this->Mail->Body = <<<EOT
-<html>
- <head>
- <title>HTML email test</title>
- </head>
- <body>
- <h1>PHPMailer does HTML!</h1>
- <p>This is a <strong>test message</strong> written in HTML.<br>
- Go to <a href="https://github.com/PHPMailer/PHPMailer/">https://github.com/PHPMailer/PHPMailer/</a>
- for new versions of PHPMailer.</p>
- <p>Thank you!</p>
- </body>
-</html>
-EOT;
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- $msg = $this->Mail->getSentMIMEMessage();
- $this->assertNotContains("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers');
- }
-
- /**
- * Send a message containing ISO-8859-1 text.
- */
- public function testHtmlIso8859()
- {
- $this->Mail->isHTML(true);
- $this->Mail->Subject .= ": ISO-8859-1 HTML";
- $this->Mail->CharSet = 'iso-8859-1';
-
- //This file is in ISO-8859-1 charset
- //Needs to be external because this file is in UTF-8
- $content = file_get_contents(realpath('../examples/contents.html'));
- // This is the string 'éèîüçÅñæß' in ISO-8859-1, base-64 encoded
- $check = base64_decode('6eju/OfF8ebf');
- //Make sure it really is in ISO-8859-1!
- $this->Mail->msgHTML(
- mb_convert_encoding(
- $content,
- "ISO-8859-1",
- mb_detect_encoding($content, "UTF-8, ISO-8859-1, ISO-8859-15", true)
- ),
- realpath(self::INCLUDE_DIR . 'examples')
- );
- $this->buildBody();
- $this->assertTrue(
- strpos($this->Mail->Body, $check) !== false,
- 'ISO message body does not contain expected text'
- );
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Send a message containing multilingual UTF-8 text.
- */
- public function testHtmlUtf8()
- {
- $this->Mail->isHTML(true);
- $this->Mail->Subject .= ": UTF-8 HTML";
- $this->Mail->CharSet = 'UTF-8';
-
- $this->Mail->Body = <<<EOT
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>HTML email test</title>
- </head>
- <body>
- <p>Chinese text: 郵件內容為空</p>
- <p>Russian text: Пустое тело сообщения</p>
- <p>Armenian text: Հաղորդագրությունը դատարկ է</p>
- <p>Czech text: Prázdné tělo zprávy</p>
- </body>
-</html>
-EOT;
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- $msg = $this->Mail->getSentMIMEMessage();
- $this->assertNotContains("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers');
- }
-
- /**
- * Send a message containing multilingual UTF-8 text with an embedded image.
- */
- public function testUtf8WithEmbeddedImage()
- {
- $this->Mail->isHTML(true);
- $this->Mail->Subject .= ": UTF-8 with embedded image";
- $this->Mail->CharSet = 'UTF-8';
-
- $this->Mail->Body = <<<EOT
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>HTML email test</title>
- </head>
- <body>
- <p>Chinese text: 郵件內容為空</p>
- <p>Russian text: Пустое тело сообщения</p>
- <p>Armenian text: Հաղորդագրությունը դատարկ է</p>
- <p>Czech text: Prázdné tělo zprávy</p>
- Embedded Image: <img alt="phpmailer" src="cid:my-attach">
- </body>
-</html>
-EOT;
- $this->Mail->addEmbeddedImage(
- realpath(self::INCLUDE_DIR . 'examples/images/phpmailer.png'),
- 'my-attach',
- 'phpmailer.png',
- 'base64',
- 'image/png'
- );
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Send a message containing multilingual UTF-8 text.
- */
- public function testPlainUtf8()
- {
- $this->Mail->isHTML(false);
- $this->Mail->Subject .= ": UTF-8 plain text";
- $this->Mail->CharSet = 'UTF-8';
-
- $this->Mail->Body = <<<EOT
-Chinese text: 郵件內容為空
-Russian text: Пустое тело сообщения
-Armenian text: Հաղորդագրությունը դատարկ է
-Czech text: Prázdné tělo zprávy
-EOT;
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- $msg = $this->Mail->getSentMIMEMessage();
- $this->assertNotContains("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers');
- }
-
- /**
- * Test simple message builder and html2text converters
- */
- public function testMsgHTML()
- {
- $message = file_get_contents(realpath(self::INCLUDE_DIR . 'examples/contentsutf8.html'));
- $this->Mail->CharSet = 'utf-8';
- $this->Mail->Body = '';
- $this->Mail->AltBody = '';
- //Uses internal HTML to text conversion
- $this->Mail->msgHTML($message, realpath(self::INCLUDE_DIR . 'examples'));
- $this->Mail->Subject .= ': msgHTML';
-
- $this->assertNotEmpty($this->Mail->Body, 'Body not set by msgHTML');
- $this->assertNotEmpty($this->Mail->AltBody, 'AltBody not set by msgHTML');
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
-
- //Again, using a custom HTML to text converter
- $this->Mail->AltBody = '';
- $this->Mail->msgHTML($message, realpath(self::INCLUDE_DIR . 'examples'), function ($html) {
- return strtoupper(strip_tags($html));
- });
- $this->Mail->Subject .= ' + custom html2text';
- $this->assertNotEmpty($this->Mail->AltBody, 'Custom AltBody not set by msgHTML');
-
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Simple HTML and attachment test
- */
- public function testHTMLAttachment()
- {
- $this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.';
- $this->Mail->Subject .= ': HTML + Attachment';
- $this->Mail->isHTML(true);
-
- if (!$this->Mail->addAttachment(
- realpath(self::INCLUDE_DIR . 'examples/images/phpmailer_mini.png'), 'phpmailer_mini.png')
- ) {
- $this->assertTrue(false, $this->Mail->ErrorInfo);
- return;
- }
-
- //Make sure that trying to attach a nonexistent file fails
- $this->assertFalse($this->Mail->addAttachment(__FILE__ . md5(microtime()), 'nonexistent_file.txt'));
-
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Test embedded image without a name
- */
- public function testHTMLStringEmbedNoName()
- {
- $this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.';
- $this->Mail->Subject .= ': HTML + unnamed embedded image';
- $this->Mail->isHTML(true);
-
- if (!$this->Mail->addStringEmbeddedImage(
- file_get_contents(realpath(self::INCLUDE_DIR . 'examples/images/phpmailer_mini.png')),
- md5('phpmailer_mini.png').'@phpmailer.0',
- '', //intentionally empty name
- 'base64',
- 'image/png',
- 'inline')
- ) {
- $this->assertTrue(false, $this->Mail->ErrorInfo);
- return;
- }
-
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Simple HTML and multiple attachment test
- */
- public function testHTMLMultiAttachment()
- {
- $this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.';
- $this->Mail->Subject .= ': HTML + multiple Attachment';
- $this->Mail->isHTML(true);
-
- if (!$this->Mail->addAttachment(realpath(self::INCLUDE_DIR . 'examples/images/phpmailer_mini.png'), 'phpmailer_mini.png')) {
- $this->assertTrue(false, $this->Mail->ErrorInfo);
- return;
- }
-
- if (!$this->Mail->addAttachment(realpath(self::INCLUDE_DIR . 'examples/images/phpmailer.png'), 'phpmailer.png')) {
- $this->assertTrue(false, $this->Mail->ErrorInfo);
- return;
- }
-
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * An embedded attachment test.
- */
- public function testEmbeddedImage()
- {
- $this->Mail->Body = 'Embedded Image: <img alt="phpmailer" src="cid:my-attach">' .
- 'Here is an image!';
- $this->Mail->Subject .= ': Embedded Image';
- $this->Mail->isHTML(true);
-
- if (!$this->Mail->addEmbeddedImage(
- realpath(self::INCLUDE_DIR . 'examples/images/phpmailer.png'),
- 'my-attach',
- 'phpmailer.png',
- 'base64',
- 'image/png'
- )
- ) {
- $this->assertTrue(false, $this->Mail->ErrorInfo);
- return;
- }
-
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- //For code coverage
- $this->Mail->addEmbeddedImage('thisfiledoesntexist', 'xyz'); //Non-existent file
- $this->Mail->addEmbeddedImage(__FILE__, '123'); //Missing name
- }
-
- /**
- * An embedded attachment test.
- */
- public function testMultiEmbeddedImage()
- {
- $this->Mail->Body = 'Embedded Image: <img alt="phpmailer" src="cid:my-attach">' .
- 'Here is an image!</a>';
- $this->Mail->Subject .= ': Embedded Image + Attachment';
- $this->Mail->isHTML(true);
-
- if (!$this->Mail->addEmbeddedImage(
- realpath(self::INCLUDE_DIR . 'examples/images/phpmailer.png'),
- 'my-attach',
- 'phpmailer.png',
- 'base64',
- 'image/png'
- )
- ) {
- $this->assertTrue(false, $this->Mail->ErrorInfo);
- return;
- }
-
- if (!$this->Mail->addAttachment(__FILE__, 'test.txt')) {
- $this->assertTrue(false, $this->Mail->ErrorInfo);
- return;
- }
-
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Simple multipart/alternative test.
- */
- public function testAltBody()
- {
- $this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.';
- $this->Mail->AltBody = 'Here is the text body of this message. ' .
- 'It should be quite a few lines. It should be wrapped at the ' .
- '40 characters. Make sure that it is.';
- $this->Mail->WordWrap = 40;
- $this->addNote('This is a mulipart alternative email');
- $this->Mail->Subject .= ': AltBody + Word Wrap';
-
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Simple HTML and attachment test
- */
- public function testAltBodyAttachment()
- {
- $this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.';
- $this->Mail->AltBody = 'This is the text part of the email.';
- $this->Mail->Subject .= ': AltBody + Attachment';
- $this->Mail->isHTML(true);
-
- if (!$this->Mail->addAttachment(__FILE__, 'test_attach.txt')) {
- $this->assertTrue(false, $this->Mail->ErrorInfo);
- return;
- }
-
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * iCal event test.
- */
- public function testIcal()
- {
- //Standalone ICS tests
- require_once realpath(self::INCLUDE_DIR . 'extras/EasyPeasyICS.php');
- $ICS = new EasyPeasyICS("PHPMailer test calendar");
- $this->assertNotEmpty(
- $ICS->addEvent(
- strtotime('tomorrow 10:00 Europe/Paris'),
- strtotime('tomorrow 11:00 Europe/Paris'),
- 'PHPMailer iCal test',
- 'A test of PHPMailer iCal support',
- 'https://github.com/PHPMailer/PHPMailer'
- ),
- 'Generated event string is empty'
- );
- $ICS->addEvent(
- strtotime('tomorrow 10:00 Europe/Paris'),
- strtotime('tomorrow 11:00 Europe/Paris'),
- 'PHPMailer iCal test',
- 'A test of PHPMailer iCal support',
- 'https://github.com/PHPMailer/PHPMailer'
- );
- $events = $ICS->getEvents();
- $this->assertEquals(2, count($events), 'Event count mismatch');
- $ICS->clearEvents();
- $events = $ICS->getEvents();
- $this->assertEquals(0, count($events), 'Event clearing failed');
- $ICS->setName('test');
- $this->assertEquals('test', $ICS->getName(), 'Setting ICS name failed');
- $this->assertNotEmpty($ICS->render(false), 'Empty calendar');
- //Need to test generated output but PHPUnit isn't playing nice
- //$rendered = $ICS->render();
-
- //Test sending an ICS
- $this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.';
- $this->Mail->AltBody = 'This is the text part of the email.';
- $this->Mail->Subject .= ': iCal';
- $this->Mail->isHTML(true);
- $this->buildBody();
- $this->Mail->Ical = $ICS->render(false);
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Test sending multiple messages with separate connections.
- */
- public function testMultipleSend()
- {
- $this->Mail->Body = 'Sending two messages without keepalive';
- $this->buildBody();
- $subject = $this->Mail->Subject;
-
- $this->Mail->Subject = $subject . ': SMTP 1';
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
-
- $this->Mail->Subject = $subject . ': SMTP 2';
- $this->Mail->Sender = 'blah@example.com';
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Test sending using SendMail.
- */
- public function testSendmailSend()
- {
- $this->Mail->Body = 'Sending via sendmail';
- $this->buildBody();
- $subject = $this->Mail->Subject;
-
- $this->Mail->Subject = $subject . ': sendmail';
- $this->Mail->isSendmail();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Test sending using Qmail.
- */
- public function testQmailSend()
- {
- //Only run if we have qmail installed
- if (file_exists('/var/qmail/bin/qmail-inject')) {
- $this->Mail->Body = 'Sending via qmail';
- $this->BuildBody();
- $subject = $this->Mail->Subject;
-
- $this->Mail->Subject = $subject . ': qmail';
- $this->Mail->IsQmail();
- $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo);
- } else {
- $this->markTestSkipped('Qmail is not installed');
- }
- }
-
- /**
- * Test sending using PHP mail() function.
- */
- public function testMailSend()
- {
- $sendmail = ini_get('sendmail_path');
- //No path in sendmail_path
- if (strpos($sendmail, '/') === false) {
- ini_set('sendmail_path', '/usr/sbin/sendmail -t -i ');
- }
- $this->Mail->Body = 'Sending via mail()';
- $this->buildBody();
-
- $this->Mail->Subject = $this->Mail->Subject . ': mail()';
- $this->Mail->isMail();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- $msg = $this->Mail->getSentMIMEMessage();
- $this->assertNotContains("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers');
- }
-
- /**
- * Test sending an empty body.
- */
- public function testEmptyBody()
- {
- $this->buildBody();
- $this->Mail->Body = '';
- $this->Mail->Subject = $this->Mail->Subject . ': Empty Body';
- $this->Mail->isMail();
- $this->Mail->AllowEmpty = true;
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- $this->Mail->AllowEmpty = false;
- $this->assertFalse($this->Mail->send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Test constructing a multipart message that contains lines that are too long for RFC compliance.
- */
- public function testLongBody()
- {
- $oklen = str_repeat(str_repeat('0', PHPMailer::MAX_LINE_LENGTH) . PHPMailer::CRLF, 2);
- $badlen = str_repeat(str_repeat('1', PHPMailer::MAX_LINE_LENGTH + 1) . PHPMailer::CRLF, 2);
-
- $this->Mail->Body = "This message contains lines that are too long.".
- PHPMailer::CRLF . $oklen . $badlen . $oklen;
- $this->assertTrue(
- PHPMailer::hasLineLongerThanMax($this->Mail->Body),
- 'Test content does not contain long lines!'
- );
- $this->Mail->isHTML();
- $this->buildBody();
- $this->Mail->AltBody = $this->Mail->Body;
- $this->Mail->Encoding = '8bit';
- $this->Mail->preSend();
- $message = $this->Mail->getSentMIMEMessage();
- $this->assertFalse(PHPMailer::hasLineLongerThanMax($message), 'Long line not corrected.');
- $this->assertContains(
- 'Content-Transfer-Encoding: quoted-printable',
- $message,
- 'Long line did not cause transfer encoding switch.'
- );
- }
-
- /**
- * Test constructing a message that does NOT contain lines that are too long for RFC compliance.
- */
- public function testShortBody()
- {
- $oklen = str_repeat(str_repeat('0', PHPMailer::MAX_LINE_LENGTH) . PHPMailer::CRLF, 10);
-
- $this->Mail->Body = "This message does not contain lines that are too long.".
- PHPMailer::CRLF . $oklen;
- $this->assertFalse(
- PHPMailer::hasLineLongerThanMax($this->Mail->Body),
- 'Test content contains long lines!'
- );
- $this->buildBody();
- $this->Mail->Encoding = '8bit';
- $this->Mail->preSend();
- $message = $this->Mail->getSentMIMEMessage();
- $this->assertFalse(PHPMailer::hasLineLongerThanMax($message), 'Long line not corrected.');
- $this->assertNotContains(
- 'Content-Transfer-Encoding: quoted-printable',
- $message,
- 'Short line caused transfer encoding switch.'
- );
- }
-
- /**
- * Test keepalive (sending multiple messages in a single connection).
- */
- public function testSmtpKeepAlive()
- {
- $this->Mail->Body = 'SMTP keep-alive test.';
- $this->buildBody();
- $subject = $this->Mail->Subject;
-
- $this->Mail->SMTPKeepAlive = true;
- $this->Mail->Subject = $subject . ': SMTP keep-alive 1';
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
-
- $this->Mail->Subject = $subject . ': SMTP keep-alive 2';
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- $this->Mail->smtpClose();
- }
-
- /**
- * Tests this denial of service attack:
- * @link http://www.cybsec.com/vuln/PHPMailer-DOS.pdf
- */
- public function testDenialOfServiceAttack()
- {
- $this->Mail->Body = 'This should no longer cause a denial of service.';
- $this->buildBody();
-
- $this->Mail->Subject = substr(str_repeat('0123456789', 100), 0, 998);
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Tests this denial of service attack:
- * @link https://sourceforge.net/p/phpmailer/bugs/383/
- * According to the ticket, this should get stuck in a loop, though I can't make it happen.
- * @TODO No assertions in here - how can you assert for this?
- */
- public function testDenialOfServiceAttack2()
- {
- //Encoding name longer than 68 chars
- $this->Mail->Encoding = '1234567890123456789012345678901234567890123456789012345678901234567890';
- //Call wrapText with a zero length value
- $this->Mail->wrapText(str_repeat('This should no longer cause a denial of service. ', 30), 0);
- }
-
- /**
- * Test error handling.
- */
- public function testError()
- {
- $this->Mail->Subject .= ': Error handling test - this should be sent ok';
- $this->buildBody();
- $this->Mail->clearAllRecipients(); // no addresses should cause an error
- $this->assertTrue($this->Mail->isError() == false, 'Error found');
- $this->assertTrue($this->Mail->send() == false, 'send succeeded');
- $this->assertTrue($this->Mail->isError(), 'No error found');
- $this->assertEquals('You must provide at least one recipient email address.', $this->Mail->ErrorInfo);
- $this->Mail->addAddress($_REQUEST['mail_to']);
- $this->assertTrue($this->Mail->send(), 'send failed');
- }
-
- /**
- * Test addressing.
- */
- public function testAddressing()
- {
- $this->assertFalse($this->Mail->addAddress(''), 'Empty address accepted');
- $this->assertFalse($this->Mail->addAddress('', 'Nobody'), 'Empty address with name accepted');
- $this->assertFalse($this->Mail->addAddress('a@example..com'), 'Invalid address accepted');
- $this->assertTrue($this->Mail->addAddress('a@example.com'), 'Addressing failed');
- $this->assertFalse($this->Mail->addAddress('a@example.com'), 'Duplicate addressing failed');
- $this->assertTrue($this->Mail->addCC('b@example.com'), 'CC addressing failed');
- $this->assertFalse($this->Mail->addCC('b@example.com'), 'CC duplicate addressing failed');
- $this->assertFalse($this->Mail->addCC('a@example.com'), 'CC duplicate addressing failed (2)');
- $this->assertTrue($this->Mail->addBCC('c@example.com'), 'BCC addressing failed');
- $this->assertFalse($this->Mail->addBCC('c@example.com'), 'BCC duplicate addressing failed');
- $this->assertFalse($this->Mail->addBCC('a@example.com'), 'BCC duplicate addressing failed (2)');
- $this->assertTrue($this->Mail->addReplyTo('a@example.com'), 'Replyto Addressing failed');
- $this->assertFalse($this->Mail->addReplyTo('a@example..com'), 'Invalid Replyto address accepted');
- $this->assertTrue($this->Mail->setFrom('a@example.com', 'some name'), 'setFrom failed');
- $this->assertFalse($this->Mail->setFrom('a@example.com.', 'some name'), 'setFrom accepted invalid address');
- $this->Mail->Sender = '';
- $this->Mail->setFrom('a@example.com', 'some name', true);
- $this->assertEquals($this->Mail->Sender, 'a@example.com', 'setFrom failed to set sender');
- $this->Mail->Sender = '';
- $this->Mail->setFrom('a@example.com', 'some name', false);
- $this->assertEquals($this->Mail->Sender, '', 'setFrom should not have set sender');
- $this->Mail->clearCCs();
- $this->Mail->clearBCCs();
- $this->Mail->clearReplyTos();
- }
-
- /**
- * Test RFC822 address splitting.
- */
- public function testAddressSplitting()
- {
- //Test built-in address parser
- $this->assertCount(
- 2,
- $this->Mail->parseAddresses(
- 'Joe User <joe@example.com>, Jill User <jill@example.net>'
- ),
- 'Failed to recognise address list (IMAP parser)'
- );
- $this->assertEquals(
- array(
- array("name" => 'Joe User', 'address' => 'joe@example.com'),
- array("name" => 'Jill User', 'address' => 'jill@example.net'),
- array("name" => '', 'address' => 'frank@example.com'),
- ),
- $this->Mail->parseAddresses(
- 'Joe User <joe@example.com>,'
- . 'Jill User <jill@example.net>,'
- . 'frank@example.com,'
- ),
- 'Parsed addresses'
- );
- //Test simple address parser
- $this->assertCount(
- 2,
- $this->Mail->parseAddresses(
- 'Joe User <joe@example.com>, Jill User <jill@example.net>',
- false
- ),
- 'Failed to recognise address list'
- );
- //Test single address
- $this->assertNotEmpty(
- $this->Mail->parseAddresses(
- 'Joe User <joe@example.com>',
- false
- ),
- 'Failed to recognise single address'
- );
- //Test quoted name IMAP
- $this->assertNotEmpty(
- $this->Mail->parseAddresses(
- 'Tim "The Book" O\'Reilly <foo@example.com>'
- ),
- 'Failed to recognise quoted name (IMAP)'
- );
- //Test quoted name
- $this->assertNotEmpty(
- $this->Mail->parseAddresses(
- 'Tim "The Book" O\'Reilly <foo@example.com>',
- false
- ),
- 'Failed to recognise quoted name'
- );
- //Test single address IMAP
- $this->assertNotEmpty(
- $this->Mail->parseAddresses(
- 'Joe User <joe@example.com>'
- ),
- 'Failed to recognise single address (IMAP)'
- );
- //Test unnamed address
- $this->assertNotEmpty(
- $this->Mail->parseAddresses(
- 'joe@example.com',
- false
- ),
- 'Failed to recognise unnamed address'
- );
- //Test unnamed address IMAP
- $this->assertNotEmpty(
- $this->Mail->parseAddresses(
- 'joe@example.com'
- ),
- 'Failed to recognise unnamed address (IMAP)'
- );
- //Test invalid addresses
- $this->assertEmpty(
- $this->Mail->parseAddresses(
- 'Joe User <joe@example.com.>, Jill User <jill.@example.net>'
- ),
- 'Failed to recognise invalid addresses (IMAP)'
- );
- //Test invalid addresses
- $this->assertEmpty(
- $this->Mail->parseAddresses(
- 'Joe User <joe@example.com.>, Jill User <jill.@example.net>',
- false
- ),
- 'Failed to recognise invalid addresses'
- );
- }
-
- /**
- * Test address escaping.
- */
- public function testAddressEscaping()
- {
- $this->Mail->Subject .= ': Address escaping';
- $this->Mail->clearAddresses();
- $this->Mail->addAddress('foo@example.com', 'Tim "The Book" O\'Reilly');
- $this->Mail->Body = 'Test correct escaping of quotes in addresses.';
- $this->buildBody();
- $this->Mail->preSend();
- $b = $this->Mail->getSentMIMEMessage();
- $this->assertTrue((strpos($b, 'To: "Tim \"The Book\" O\'Reilly" <foo@example.com>') !== false));
- }
-
- /**
- * Test MIME structure assembly.
- */
- public function testMIMEStructure()
- {
- $this->Mail->Subject .= ': MIME structure';
- $this->Mail->Body = '<h3>MIME structure test.</h3>';
- $this->Mail->AltBody = 'MIME structure test.';
- $this->buildBody();
- $this->Mail->preSend();
- $this->assertRegExp(
- "/Content-Transfer-Encoding: 8bit\r\n\r\n".
- "This is a multi-part message in MIME format./",
- $this->Mail->getSentMIMEMessage(),
- 'MIME structure broken'
- );
- }
-
- /**
- * Test BCC-only addressing.
- */
- public function testBCCAddressing()
- {
- $this->Mail->Subject .= ': BCC-only addressing';
- $this->buildBody();
- $this->Mail->clearAllRecipients();
- $this->assertTrue($this->Mail->addBCC('a@example.com'), 'BCC addressing failed');
- $this->assertTrue($this->Mail->send(), 'send failed');
- }
-
- /**
- * Encoding and charset tests.
- */
- public function testEncodings()
- {
- $this->Mail->CharSet = 'iso-8859-1';
- $this->assertEquals(
- '=A1Hola!_Se=F1or!',
- $this->Mail->encodeQ("\xa1Hola! Se\xf1or!", 'text'),
- 'Q Encoding (text) failed'
- );
- $this->assertEquals(
- '=A1Hola!_Se=F1or!',
- $this->Mail->encodeQ("\xa1Hola! Se\xf1or!", 'comment'),
- 'Q Encoding (comment) failed'
- );
- $this->assertEquals(
- '=A1Hola!_Se=F1or!',
- $this->Mail->encodeQ("\xa1Hola! Se\xf1or!", 'phrase'),
- 'Q Encoding (phrase) failed'
- );
- $this->Mail->CharSet = 'UTF-8';
- $this->assertEquals(
- '=C2=A1Hola!_Se=C3=B1or!',
- $this->Mail->encodeQ("\xc2\xa1Hola! Se\xc3\xb1or!", 'text'),
- 'Q Encoding (text) failed'
- );
- //Strings containing '=' are a special case
- $this->assertEquals(
- 'Nov=C3=A1=3D',
- $this->Mail->encodeQ("Nov\xc3\xa1=", 'text'),
- 'Q Encoding (text) failed 2'
- );
- }
-
- /**
- * Test base-64 encoding.
- */
- public function testBase64()
- {
- $this->Mail->Subject .= ': Base-64 encoding';
- $this->Mail->Encoding = 'base64';
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), 'Base64 encoding failed');
- }
- /**
- * S/MIME Signing tests (self-signed).
- * @requires extension openssl
- */
- public function testSigning()
- {
- $this->Mail->Subject .= ': S/MIME signing';
- $this->Mail->Body = 'This message is S/MIME signed.';
- $this->buildBody();
-
- $dn = array(
- 'countryName' => 'UK',
- 'stateOrProvinceName' => 'Here',
- 'localityName' => 'There',
- 'organizationName' => 'PHP',
- 'organizationalUnitName' => 'PHPMailer',
- 'commonName' => 'PHPMailer Test',
- 'emailAddress' => 'phpmailer@example.com'
- );
- $keyconfig = array(
- "digest_alg" => "sha256",
- "private_key_bits" => 2048,
- "private_key_type" => OPENSSL_KEYTYPE_RSA,
- );
- $password = 'password';
- $certfile = 'certfile.pem';
- $keyfile = 'keyfile.pem';
-
- //Make a new key pair
- $pk = openssl_pkey_new($keyconfig);
- //Create a certificate signing request
- $csr = openssl_csr_new($dn, $pk);
- //Create a self-signed cert
- $cert = openssl_csr_sign($csr, null, $pk, 1);
- //Save the cert
- openssl_x509_export($cert, $certout);
- file_put_contents($certfile, $certout);
- //Save the key
- openssl_pkey_export($pk, $pkeyout, $password);
- file_put_contents($keyfile, $pkeyout);
-
- $this->Mail->sign(
- $certfile,
- $keyfile,
- $password
- );
- $this->assertTrue($this->Mail->send(), 'S/MIME signing failed');
-
- $msg = $this->Mail->getSentMIMEMessage();
- $this->assertNotContains("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers');
- unlink($certfile);
- unlink($keyfile);
- }
-
- /**
- * S/MIME Signing tests using a CA chain cert.
- * To test that a generated message is signed correctly, save the message in a file
- * and use openssl along with the certs generated by this script:
- * `openssl smime -verify -in signed.eml -signer certfile.pem -CAfile cacertfile.pem`
- * @requires extension openssl
- */
- public function testSigningWithCA()
- {
- $this->Mail->Subject .= ': S/MIME signing with CA';
- $this->Mail->Body = 'This message is S/MIME signed with an extra CA cert.';
- $this->buildBody();
-
- $certprops = array(
- 'countryName' => 'UK',
- 'stateOrProvinceName' => 'Here',
- 'localityName' => 'There',
- 'organizationName' => 'PHP',
- 'organizationalUnitName' => 'PHPMailer',
- 'commonName' => 'PHPMailer Test',
- 'emailAddress' => 'phpmailer@example.com'
- );
- $cacertprops = array(
- 'countryName' => 'UK',
- 'stateOrProvinceName' => 'Here',
- 'localityName' => 'There',
- 'organizationName' => 'PHP',
- 'organizationalUnitName' => 'PHPMailer CA',
- 'commonName' => 'PHPMailer Test CA',
- 'emailAddress' => 'phpmailer@example.com'
- );
- $keyconfig = array(
- "digest_alg" => "sha256",
- "private_key_bits" => 2048,
- "private_key_type" => OPENSSL_KEYTYPE_RSA,
- );
- $password = 'password';
- $cacertfile = 'cacertfile.pem';
- $cakeyfile = 'cakeyfile.pem';
- $certfile = 'certfile.pem';
- $keyfile = 'keyfile.pem';
-
- //Create a CA cert
- //Make a new key pair
- $capk = openssl_pkey_new($keyconfig);
- //Create a certificate signing request
- $csr = openssl_csr_new($cacertprops, $capk);
- //Create a self-signed cert
- $cert = openssl_csr_sign($csr, null, $capk, 1);
- //Save the CA cert
- openssl_x509_export($cert, $certout);
- file_put_contents($cacertfile, $certout);
- //Save the CA key
- openssl_pkey_export($capk, $pkeyout, $password);
- file_put_contents($cakeyfile, $pkeyout);
-
- //Create a cert signed by our CA
- //Make a new key pair
- $pk = openssl_pkey_new($keyconfig);
- //Create a certificate signing request
- $csr = openssl_csr_new($certprops, $pk);
- //Create a self-signed cert
- $cert = openssl_csr_sign($csr, 'file://' . $cacertfile, $capk, 1);
- //Save the cert
- openssl_x509_export($cert, $certout);
- file_put_contents($certfile, $certout);
- //Save the key
- openssl_pkey_export($pk, $pkeyout, $password);
- file_put_contents($keyfile, $pkeyout);
-
- $this->Mail->sign(
- $certfile,
- $keyfile,
- $password,
- $cacertfile
- );
- $this->assertTrue($this->Mail->send(), 'S/MIME signing with CA failed');
- unlink($cacertfile);
- unlink($cakeyfile);
- unlink($certfile);
- unlink($keyfile);
- }
-
- /**
- * DKIM Signing tests.
- * @requires extension openssl
- */
- public function testDKIM()
- {
- $this->Mail->Subject .= ': DKIM signing';
- $this->Mail->Body = 'This message is DKIM signed.';
- $this->buildBody();
- $privatekeyfile = 'dkim_private.key';
- //Make a new key pair
- //(2048 bits is the recommended minimum key length -
- //gmail won't accept less than 1024 bits)
- $pk = openssl_pkey_new(
- array(
- 'private_key_bits' => 2048,
- 'private_key_type' => OPENSSL_KEYTYPE_RSA
- )
- );
- openssl_pkey_export_to_file($pk, $privatekeyfile);
- $this->Mail->DKIM_domain = 'example.com';
- $this->Mail->DKIM_private = $privatekeyfile;
- $this->Mail->DKIM_selector = 'phpmailer';
- $this->Mail->DKIM_passphrase = ''; //key is not encrypted
- $this->assertTrue($this->Mail->send(), 'DKIM signed mail failed');
- unlink($privatekeyfile);
- }
-
- /**
- * Test line break reformatting.
- */
- public function testLineBreaks()
- {
- $unixsrc = "hello\nWorld\nAgain\n";
- $macsrc = "hello\rWorld\rAgain\r";
- $windowssrc = "hello\r\nWorld\r\nAgain\r\n";
- $mixedsrc = "hello\nWorld\rAgain\r\n";
- $target = "hello\r\nWorld\r\nAgain\r\n";
- $this->assertEquals($target, PHPMailer::normalizeBreaks($unixsrc), 'UNIX break reformatting failed');
- $this->assertEquals($target, PHPMailer::normalizeBreaks($macsrc), 'Mac break reformatting failed');
- $this->assertEquals($target, PHPMailer::normalizeBreaks($windowssrc), 'Windows break reformatting failed');
- $this->assertEquals($target, PHPMailer::normalizeBreaks($mixedsrc), 'Mixed break reformatting failed');
- }
-
- /**
- * Test line length detection
- */
- public function testLineLength()
- {
- $oklen = str_repeat(str_repeat('0', PHPMailer::MAX_LINE_LENGTH)."\r\n", 2);
- $badlen = str_repeat(str_repeat('1', PHPMailer::MAX_LINE_LENGTH + 1) . "\r\n", 2);
- $this->assertTrue(PHPMailer::hasLineLongerThanMax($badlen), 'Long line not detected (only)');
- $this->assertTrue(PHPMailer::hasLineLongerThanMax($oklen . $badlen), 'Long line not detected (first)');
- $this->assertTrue(PHPMailer::hasLineLongerThanMax($badlen . $oklen), 'Long line not detected (last)');
- $this->assertTrue(
- PHPMailer::hasLineLongerThanMax($oklen . $badlen . $oklen),
- 'Long line not detected (middle)'
- );
- $this->assertFalse(PHPMailer::hasLineLongerThanMax($oklen), 'Long line false positive');
- $this->Mail->isHTML(false);
- $this->Mail->Subject .= ": Line length test";
- $this->Mail->CharSet = 'UTF-8';
- $this->Mail->Encoding = '8bit';
- $this->Mail->Body = $oklen . $badlen . $oklen . $badlen;
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- $this->assertEquals('quoted-printable', $this->Mail->Encoding, 'Long line did not override transfer encoding');
- }
-
- /**
- * Test setting and retrieving message ID.
- */
- public function testMessageID()
- {
- $this->Mail->Body = 'Test message ID.';
- $id = md5(12345);
- $this->Mail->MessageID = $id;
- $this->buildBody();
- $this->Mail->preSend();
- $lastid = $this->Mail->getLastMessageID();
- $this->assertNotEquals($lastid, $id, 'Invalid Message ID allowed');
- $id = '<'.md5(12345).'@example.com>';
- $this->Mail->MessageID = $id;
- $this->buildBody();
- $this->Mail->preSend();
- $lastid = $this->Mail->getLastMessageID();
- $this->assertEquals($lastid, $id, 'Custom Message ID not used');
- $this->Mail->MessageID = '';
- $this->buildBody();
- $this->Mail->preSend();
- $lastid = $this->Mail->getLastMessageID();
- $this->assertRegExp('/^<.*@.*>$/', $lastid, 'Invalid default Message ID');
- }
-
- /**
- * Miscellaneous calls to improve test coverage and some small tests.
- */
- public function testMiscellaneous()
- {
- $this->assertEquals('application/pdf', PHPMailer::_mime_types('pdf'), 'MIME TYPE lookup failed');
- $this->Mail->addCustomHeader('SomeHeader: Some Value');
- $this->Mail->clearCustomHeaders();
- $this->Mail->clearAttachments();
- $this->Mail->isHTML(false);
- $this->Mail->isSMTP();
- $this->Mail->isMail();
- $this->Mail->isSendmail();
- $this->Mail->isQmail();
- $this->Mail->setLanguage('fr');
- $this->Mail->Sender = '';
- $this->Mail->createHeader();
- $this->assertFalse($this->Mail->set('x', 'y'), 'Invalid property set succeeded');
- $this->assertTrue($this->Mail->set('Timeout', 11), 'Valid property set failed');
- $this->assertTrue($this->Mail->set('AllowEmpty', null), 'Null property set failed');
- $this->assertTrue($this->Mail->set('AllowEmpty', false), 'Valid property set of null property failed');
- //Test pathinfo
- $a = '/mnt/files/飛兒樂 團光茫.mp3';
- $q = PHPMailer::mb_pathinfo($a);
- $this->assertEquals($q['dirname'], '/mnt/files', 'UNIX dirname not matched');
- $this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'UNIX basename not matched');
- $this->assertEquals($q['extension'], 'mp3', 'UNIX extension not matched');
- $this->assertEquals($q['filename'], '飛兒樂 團光茫', 'UNIX filename not matched');
- $this->assertEquals(
- PHPMailer::mb_pathinfo($a, PATHINFO_DIRNAME),
- '/mnt/files',
- 'Dirname path element not matched'
- );
- $this->assertEquals(PHPMailer::mb_pathinfo($a, 'filename'), '飛兒樂 團光茫', 'Filename path element not matched');
- $a = 'c:\mnt\files\飛兒樂 團光茫.mp3';
- $q = PHPMailer::mb_pathinfo($a);
- $this->assertEquals($q['dirname'], 'c:\mnt\files', 'Windows dirname not matched');
- $this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'Windows basename not matched');
- $this->assertEquals($q['extension'], 'mp3', 'Windows extension not matched');
- $this->assertEquals($q['filename'], '飛兒樂 團光茫', 'Windows filename not matched');
- }
- public function testBadSMTP()
- {
- $this->Mail->smtpConnect();
- $smtp = $this->Mail->getSMTPInstance();
- $this->assertFalse($smtp->mail("somewhere\nbad"), 'Bad SMTP command containing breaks accepted');
- }
-
- /**
- * Tests the Custom header getter
- */
- public function testCustomHeaderGetter()
- {
- $this->Mail->addCustomHeader('foo', 'bar');
- $this->assertEquals(array(array('foo', 'bar')), $this->Mail->getCustomHeaders());
-
- $this->Mail->addCustomHeader('foo', 'baz');
- $this->assertEquals(array(
- array('foo', 'bar'),
- array('foo', 'baz')
- ), $this->Mail->getCustomHeaders());
-
- $this->Mail->clearCustomHeaders();
- $this->assertEmpty($this->Mail->getCustomHeaders());
-
- $this->Mail->addCustomHeader('yux');
- $this->assertEquals(array(array('yux')), $this->Mail->getCustomHeaders());
-
- $this->Mail->addCustomHeader('Content-Type: application/json');
- $this->assertEquals(array(
- array('yux'),
- array('Content-Type', ' application/json')
- ), $this->Mail->getCustomHeaders());
- }
-
- /**
- * Tests setting and retrieving ConfirmReadingTo address, also known as "read receipt" address.
- */
- public function testConfirmReadingTo()
- {
- $this->Mail->CharSet = 'utf-8';
- $this->buildBody();
-
- $this->Mail->ConfirmReadingTo = 'test@example..com'; //Invalid address
- $this->assertFalse($this->Mail->send(), $this->Mail->ErrorInfo);
-
- $this->Mail->ConfirmReadingTo = ' test@example.com'; //Extra space to trim
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- $this->assertEquals(
- 'test@example.com',
- $this->Mail->ConfirmReadingTo,
- 'Unexpected read receipt address');
-
- $this->Mail->ConfirmReadingTo = 'test@françois.ch'; //Address with IDN
- if ($this->Mail->idnSupported()) {
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
- $this->assertEquals(
- 'test@xn--franois-xxa.ch',
- $this->Mail->ConfirmReadingTo,
- 'IDN address not converted to punycode');
- } else {
- $this->assertFalse($this->Mail->send(), $this->Mail->ErrorInfo);
- }
- }
-
- /**
- * Tests CharSet and Unicode -> ASCII conversions for addresses with IDN.
- */
- public function testConvertEncoding()
- {
- if (!$this->Mail->idnSupported()) {
- $this->markTestSkipped('intl and/or mbstring extensions are not available');
- }
-
- $this->Mail->clearAllRecipients();
- $this->Mail->clearReplyTos();
-
- // This file is UTF-8 encoded. Create a domain encoded in "iso-8859-1".
- $domain = '@' . mb_convert_encoding('françois.ch', 'ISO-8859-1', 'UTF-8');
- $this->Mail->addAddress('test' . $domain);
- $this->Mail->addCC('test+cc' . $domain);
- $this->Mail->addBCC('test+bcc' . $domain);
- $this->Mail->addReplyTo('test+replyto' . $domain);
-
- // Queued addresses are not returned by get*Addresses() before send() call.
- $this->assertEmpty($this->Mail->getToAddresses(), 'Bad "to" recipients');
- $this->assertEmpty($this->Mail->getCcAddresses(), 'Bad "cc" recipients');
- $this->assertEmpty($this->Mail->getBccAddresses(), 'Bad "bcc" recipients');
- $this->assertEmpty($this->Mail->getReplyToAddresses(), 'Bad "reply-to" recipients');
-
- // Clear queued BCC recipient.
- $this->Mail->clearBCCs();
-
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
-
- // Addresses with IDN are returned by get*Addresses() after send() call.
- $domain = $this->Mail->punyencodeAddress($domain);
- $this->assertEquals(
- array(array('test' . $domain, '')),
- $this->Mail->getToAddresses(),
- 'Bad "to" recipients');
- $this->assertEquals(
- array(array('test+cc' . $domain, '')),
- $this->Mail->getCcAddresses(),
- 'Bad "cc" recipients');
- $this->assertEmpty($this->Mail->getBccAddresses(), 'Bad "bcc" recipients');
- $this->assertEquals(
- array('test+replyto' . $domain => array('test+replyto' . $domain, '')),
- $this->Mail->getReplyToAddresses(),
- 'Bad "reply-to" addresses');
- }
-
- /**
- * Tests removal of duplicate recipients and reply-tos.
- */
- public function testDuplicateIDNRemoved()
- {
- if (!$this->Mail->idnSupported()) {
- $this->markTestSkipped('intl and/or mbstring extensions are not available');
- }
-
- $this->Mail->clearAllRecipients();
- $this->Mail->clearReplyTos();
-
- $this->Mail->CharSet = 'utf-8';
-
- $this->assertTrue($this->Mail->addAddress('test@françois.ch'));
- $this->assertFalse($this->Mail->addAddress('test@françois.ch'));
- $this->assertTrue($this->Mail->addAddress('test@FRANÇOIS.CH'));
- $this->assertFalse($this->Mail->addAddress('test@FRANÇOIS.CH'));
- $this->assertTrue($this->Mail->addAddress('test@xn--franois-xxa.ch'));
- $this->assertFalse($this->Mail->addAddress('test@xn--franois-xxa.ch'));
- $this->assertFalse($this->Mail->addAddress('test@XN--FRANOIS-XXA.CH'));
-
- $this->assertTrue($this->Mail->addReplyTo('test+replyto@françois.ch'));
- $this->assertFalse($this->Mail->addReplyTo('test+replyto@françois.ch'));
- $this->assertTrue($this->Mail->addReplyTo('test+replyto@FRANÇOIS.CH'));
- $this->assertFalse($this->Mail->addReplyTo('test+replyto@FRANÇOIS.CH'));
- $this->assertTrue($this->Mail->addReplyTo('test+replyto@xn--franois-xxa.ch'));
- $this->assertFalse($this->Mail->addReplyTo('test+replyto@xn--franois-xxa.ch'));
- $this->assertFalse($this->Mail->addReplyTo('test+replyto@XN--FRANOIS-XXA.CH'));
-
- $this->buildBody();
- $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
-
- // There should be only one "To" address and one "Reply-To" address.
- $this->assertEquals(
- 1,
- count($this->Mail->getToAddresses()),
- 'Bad count of "to" recipients');
- $this->assertEquals(
- 1,
- count($this->Mail->getReplyToAddresses()),
- 'Bad count of "reply-to" addresses');
- }
-
- /**
- * Use a fake POP3 server to test POP-before-SMTP auth.
- * With a known-good login
- */
- public function testPopBeforeSmtpGood()
- {
- //Start a fake POP server
- $pid = shell_exec('nohup ./runfakepopserver.sh >/dev/null 2>/dev/null & printf "%u" $!');
- $this->pids[] = $pid;
-
- sleep(2);
- //Test a known-good login
- $this->assertTrue(
- POP3::popBeforeSmtp('localhost', 1100, 10, 'user', 'test', $this->Mail->SMTPDebug),
- 'POP before SMTP failed'
- );
- //Kill the fake server
- shell_exec('kill -TERM ' . escapeshellarg($pid));
- sleep(2);
- }
-
- /**
- * Use a fake POP3 server to test POP-before-SMTP auth
- * with a known-bad login.
- */
- public function testPopBeforeSmtpBad()
- {
- //Start a fake POP server on a different port
- //so we don't inadvertently connect to the previous instance
- $pid = shell_exec('nohup ./runfakepopserver.sh 1101 >/dev/null 2>/dev/null & printf "%u" $!');
- $this->pids[] = $pid;
-
- sleep(2);
- //Test a known-bad login
- $this->assertFalse(
- POP3::popBeforeSmtp('localhost', 1101, 10, 'user', 'xxx', $this->Mail->SMTPDebug),
- 'POP before SMTP should have failed'
- );
- shell_exec('kill -TERM ' . escapeshellarg($pid));
- sleep(2);
- }
-
- /**
- * Test SMTP host connections.
- * This test can take a long time, so run it last
- */
- public function testSmtpConnect()
- {
- $this->Mail->SMTPDebug = 4; //Show connection-level errors
- $this->assertTrue($this->Mail->smtpConnect(), 'SMTP single connect failed');
- $this->Mail->smtpClose();
- $this->Mail->Host = "ssl://localhost:12345;tls://localhost:587;10.10.10.10:54321;localhost:12345;10.10.10.10";
- $this->assertFalse($this->Mail->smtpConnect(), 'SMTP bad multi-connect succeeded');
- $this->Mail->smtpClose();
- $this->Mail->Host = "localhost:12345;10.10.10.10:54321;" . $_REQUEST['mail_host'];
- $this->assertTrue($this->Mail->smtpConnect(), 'SMTP multi-connect failed');
- $this->Mail->smtpClose();
- $this->Mail->Host = " localhost:12345 ; " . $_REQUEST['mail_host'] . ' ';
- $this->assertTrue($this->Mail->smtpConnect(), 'SMTP hosts with stray spaces failed');
- $this->Mail->smtpClose();
- $this->Mail->Host = $_REQUEST['mail_host'];
- //Need to pick a harmless option so as not cause problems of its own! socket:bind doesn't work with Travis-CI
- $this->assertTrue(
- $this->Mail->smtpConnect(array('ssl' => array('verify_depth' => 10))),
- 'SMTP connect with options failed'
- );
- }
-}
-
-/**
- * This is a sample form for setting appropriate test values through a browser
- * These values can also be set using a file called testbootstrap.php (not in repo) in the same folder as this script
- * which is probably more useful if you run these tests a lot
- * <html>
- * <body>
- * <h3>phpmailer Unit Test</h3>
- * By entering a SMTP hostname it will automatically perform tests with SMTP.
- *
- * <form name="phpmailer_unit" action=__FILE__ method="get">
- * <input type="hidden" name="submitted" value="1"/>
- * From Address: <input type="text" size="50" name="mail_from" value="<?php echo get("mail_from"); ?>"/>
- * <br/>
- * To Address: <input type="text" size="50" name="mail_to" value="<?php echo get("mail_to"); ?>"/>
- * <br/>
- * Cc Address: <input type="text" size="50" name="mail_cc" value="<?php echo get("mail_cc"); ?>"/>
- * <br/>
- * SMTP Hostname: <input type="text" size="50" name="mail_host" value="<?php echo get("mail_host"); ?>"/>
- * <p/>
- * <input type="submit" value="Run Test"/>
- *
- * </form>
- * </body>
- * </html>
- */
+++ /dev/null
-#!/usr/bin/env bash
-
-# Run the fake pop server from bash
-# Idea from http://blog.ale-re.net/2007/09/ipersimple-remote-shell-with-netcat.html
-# Defaults to port 1100 so it can be run by unpriv users and not clash with a real server
-# Optionally, pass in a port number as the first arg
-
-mkfifo fifo
-nc -l ${1:-1100} <fifo |bash ./fakepopserver.sh >fifo
-rm fifo
+++ /dev/null
-<html>
-<head>
- <title>PHPMailer Lite - DKIM and Callback Function test</title>
-</head>
-<body>
-
-<?php
-/* This is a sample callback function for PHPMailer Lite.
- * This callback function will echo the results of PHPMailer processing.
- */
-
-/* Callback (action) function
- * 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
- * @return boolean
- */
-function callbackAction($result, $to, $cc, $bcc, $subject, $body)
-{
- /*
- this callback example echos the results to the screen - implement to
- post to databases, build CSV log files, etc., with minor changes
- */
- $to = cleanEmails($to, 'to');
- $cc = cleanEmails($cc[0], 'cc');
- $bcc = cleanEmails($bcc[0], 'cc');
- echo $result . "\tTo: " . $to['Name'] . "\tTo: " . $to['Email'] . "\tCc: " . $cc['Name'] .
- "\tCc: " . $cc['Email'] . "\tBcc: " . $bcc['Name'] . "\tBcc: " . $bcc['Email'] .
- "\t" . $subject . "\n\n". $body . "\n";
- return true;
-}
-
-require_once '../PHPMailerAutoload.php';
-$mail = new PHPMailer();
-
-try {
- $mail->isMail();
- $mail->setFrom('you@example.com', 'Your Name');
- $mail->addAddress('another@example.com', 'John Doe');
- $mail->Subject = 'PHPMailer Test Subject';
- $mail->msgHTML(file_get_contents('../examples/contents.html'));
- // optional - msgHTML will create an alternate automatically
- $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
- $mail->addAttachment('../examples/images/phpmailer.png'); // attachment
- $mail->addAttachment('../examples/images/phpmailer_mini.png'); // attachment
- $mail->action_function = 'callbackAction';
- $mail->send();
- echo "Message Sent OK</p>\n";
-} catch (phpmailerException $e) {
- echo $e->errorMessage(); //Pretty error messages from PHPMailer
-} catch (Exception $e) {
- echo $e->getMessage(); //Boring error messages from anything else!
-}
-
-function cleanEmails($str, $type)
-{
- if ($type == 'cc') {
- $addy['Email'] = $str[0];
- $addy['Name'] = $str[1];
- return $addy;
- }
- if (!strstr($str, ' <')) {
- $addy['Name'] = '';
- $addy['Email'] = $addy;
- return $addy;
- }
- $addyArr = explode(' <', $str);
- if (substr($addyArr[1], -1) == '>') {
- $addyArr[1] = substr($addyArr[1], 0, -1);
- }
- $addy['Name'] = $addyArr[0];
- $addy['Email'] = $addyArr[1];
- $addy['Email'] = str_replace('@', '@', $addy['Email']);
- return $addy;
-}
-?>
-</body>
-</html>
+++ /dev/null
-<?php
-$_REQUEST['submitted'] = 1;
-$_REQUEST['mail_to'] = 'somebody@example.com';
-$_REQUEST['mail_from'] = 'phpunit@example.com';
-$_REQUEST['mail_cc'] = 'cc@example.com';
-$_REQUEST['mail_host'] = 'localhost';
-$_REQUEST['mail_port'] = 2500;
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<phpunit
- verbose="false"
- stopOnError="false"
- stopOnFailure="false"
- stopOnIncomplete="false"
- stopOnSkipped="false"
- convertErrorsToExceptions="true"
- convertNoticesToExceptions="true"
- convertWarningsToExceptions="true"
- colors="false"
- forceCoversAnnotation="false"
- processIsolation="false">
- <testsuites>
- <testsuite name="PHPMailer Tests">
- <directory>./test/</directory>
- </testsuite>
- </testsuites>
- <filter>
- <blacklist>
- <directory suffix=".php">./extras</directory>
- </blacklist>
- </filter>
- <groups>
- <exclude>
- <group>languages</group>
- </exclude>
- </groups>
- <logging>
- <log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/>
- <log type="coverage-clover" target="build/logs/clover.xml"/>
- <log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
- </logging>
-</phpunit>
<?php
-$version = "1.8rc1";
+$version = "1.8rc2";
?>
*/
?>
<?php
+// EFFACER REQUIRE INUTILES
+// require '../PHPMailer-master/PHPMailerAutoload.php'; VERSION 5.2 PHPmailer
+use PHPMailer\PHPMailer\PHPMailer;
+use PHPMailer\PHPMailer\Exception;
+use PHPMailer\PHPMailer\SMTP;
+
+require '../PHPMailer-master/src/PHPMailer.php';
+require '../PHPMailer-master/src/Exception.php';
+require '../PHPMailer-master/src/SMTP.php';
-// EFFACER REQUIRE INUTILES
-require '../PHPMailer-master/PHPMailerAutoload.php';
require '../inc/config.inc.php';
require '../inc/common.inc.php';
require '../inc/localise.inc.php';