-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating PHPMailer to version 5.2.8.
- Loading branch information
1 parent
ce8cdd4
commit 954a500
Showing
29 changed files
with
983 additions
and
588 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
A CodeIgniter compatible email-library powered by PHPMailer | ||
=========================================================== | ||
|
||
Version: 1.1.2 | ||
Version: 1.1.3 | ||
Author: Ivan Tcholakov <[email protected]>, 2012-2014. | ||
License: The MIT License (MIT), http://opensource.org/licenses/MIT | ||
|
||
Tested on CodeIgniter 3.0-dev (February 12th, 2014) and with PHPMailer Version 5.2.7 (September 12th, 2013). | ||
Tested on CodeIgniter 3.0-dev (May 24th, 2014) and with PHPMailer Version 5.2.8 (May 14th, 2014). | ||
|
||
Installation | ||
------------ | ||
|
@@ -35,7 +35,7 @@ $config['smtp_pass'] = 'yourpassword'; | |
$config['smtp_port'] = 465; | ||
$config['smtp_timeout'] = 5; // (in seconds) | ||
$config['smtp_crypto'] = 'ssl'; // '' or 'tls' or 'ssl' | ||
$config['smtp_debug'] = 0; // PHPMailer's SMTP debug info level: 0 = off, 1 = commands, 2 = commands and data | ||
$config['smtp_debug'] = 0; // PHPMailer's SMTP debug info level: 0 = off, 1 = commands, 2 = commands and data, 3 = as 2 plus connection status, 4 = low level data output. | ||
$config['wordwrap'] = true; | ||
$config['wrapchars'] = 76; | ||
$config['mailtype'] = 'html'; // 'text' or 'html' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,13 @@ | |
|
||
/** | ||
* CodeIgniter compatible email-library powered by PHPMailer. | ||
* Version: 1.1.2 | ||
* Version: 1.1.3 | ||
* @author Ivan Tcholakov <[email protected]>, 2012-2014. | ||
* @license The MIT License (MIT), http://opensource.org/licenses/MIT | ||
* @link https://github.com/ivantcholakov/codeigniter-phpmailer | ||
* | ||
* Tested on production sites with CodeIgniter 3.0-dev (February 12th, 2014) and | ||
* PHPMailer Version 5.2.7 (September 12th, 2013). | ||
* Tested on production sites with CodeIgniter 3.0-dev (May 24th, 2014) and | ||
* PHPMailer Version 5.2.8 (May 14th, 2014). | ||
*/ | ||
|
||
class MY_Email extends CI_Email { | ||
|
@@ -96,7 +96,7 @@ public function __construct($config = array()) { | |
} | ||
} | ||
|
||
$this->_safe_mode = ( ! is_php('5.4') && (bool) @ini_get('safe_mode')); | ||
$this->_safe_mode = ( ! is_php('5.4') && ini_get('safe_mode')); | ||
|
||
log_message('debug', 'MY_Email Class Initialized (Engine: '.$this->mailer_engine.')'); | ||
} | ||
|
@@ -612,12 +612,12 @@ public function send($auto_clear = true) { | |
// Custom methods ---------------------------------------------------------- | ||
|
||
// PHPMailer's SMTP debug info level | ||
// 0 = off, 1 = commands, 2 = commands and data | ||
// 0 = off, 1 = commands, 2 = commands and data, 3 = as 2 plus connection status, 4 = low level data output. | ||
public function set_smtp_debug($level) { | ||
|
||
$level = (int) $level; | ||
|
||
if ($level < 0 || $level > 2) { | ||
if ($level < 0) { | ||
$level = 0; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
<?php | ||
/** | ||
* PHPMailer SPL autoloader. | ||
* PHP Version 5.0.0 | ||
* PHP Version 5 | ||
* @package PHPMailer | ||
* @link https://github.com/PHPMailer/PHPMailer/ | ||
* @author Marcus Bointon (coolbru) <[email protected]> | ||
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project | ||
* @author Marcus Bointon (Synchro/coolbru) <[email protected]> | ||
* @author Jim Jagielski (jimjag) <[email protected]> | ||
* @author Andy Prevost (codeworxtech) <[email protected]> | ||
* @author Brent R. Matzelle (original founder) | ||
* @copyright 2013 Marcus Bointon | ||
* @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 | ||
|
@@ -30,4 +30,20 @@ function PHPMailerAutoload($classname) | |
} | ||
} | ||
|
||
spl_autoload_register('PHPMailerAutoload'); | ||
if (version_compare(PHP_VERSION, '5.1.2', '>=')) { | ||
//SPL autoloading was introduced in PHP 5.1.2 | ||
if (version_compare(PHP_VERSION, '5.3.0', '>=')) { | ||
spl_autoload_register('PHPMailerAutoload', true, true); | ||
} else { | ||
spl_autoload_register('PHPMailerAutoload'); | ||
} | ||
} else { | ||
/** | ||
* Fall back to traditional autoload for old PHP versions | ||
* @param string $classname The name of the class to load | ||
*/ | ||
function __autoload($classname) | ||
{ | ||
PHPMailerAutoload($classname); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
![PHPMailer](https://raw.github.com/PHPMailer/PHPMailer/master/examples/images/phpmailer.png) | ||
|
||
# PHPMailer - A full-featured email creation and transfer class for PHP | ||
|
||
Build status: [![Build Status](https://travis-ci.org/Synchro/PHPMailer.png)](https://travis-ci.org/Synchro/PHPMailer) | ||
Build status: [![Build Status](https://travis-ci.org/PHPMailer/PHPMailer.svg)](https://travis-ci.org/PHPMailer/PHPMailer) | ||
[![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/) | ||
|
||
## Class Features | ||
|
||
- Probably the world's most popular code for sending email from PHP! | ||
- Used by many open-source projects: Drupal, 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 TOs, CCs, BCCs and REPLY-TOs | ||
- Multipart/alternative emails for mail clients that do not read HTML email | ||
- Support for 8bit, base64, binary, and quoted-printable encoding | ||
- SMTP authentication with LOGIN, PLAIN, NTLM and CRAM-MD5 mechanisms | ||
- Support for UTF-8 content and 8bit, base64, binary, and quoted-printable encodings | ||
- SMTP authentication with LOGIN, PLAIN, NTLM and CRAM-MD5 mechanisms over SSL and TLS transports | ||
- Native language support | ||
- DKIM and S/MIME signing support | ||
- Compatible with PHP 5.0 and later | ||
- Much more! | ||
|
||
|
@@ -29,29 +34,35 @@ The PHP mail() function usually sends via a local mail server, typically fronted | |
This software is licenced under the [LGPL 2.1](http://www.gnu.org/licenses/lgpl-2.1.html). Please read LICENSE for information on the | ||
software availability and distribution. | ||
|
||
## Installation | ||
## Installation & loading | ||
|
||
PHPMailer is available via [Composer/Packagist](https://packagist.org/packages/phpmailer/phpmailer). Alternatively, just copy the contents of the PHPMailer folder into somewhere that's in your PHP `include_path` setting. If you don't speak git or just want a tarball, click the 'zip' button at the top of the page in GitHub. | ||
|
||
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. | ||
PHPMailer does *not* declare a namespace because namespaces were only introduced in PHP 5.3. | ||
|
||
### 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 [class.phpmailer.php](class.phpmailer.php). If you're using SMTP, you'll need [class.smtp.php](class.smtp.php), and if you're using POP-before SMTP, you'll need [class.pop3.php](class.pop3.php). For all of these, we recommend you use [the autoloader](PHPMailerAutoload.php) too. You can skip the [language](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, advanced HTML-to-text conversion and ics generation. | ||
|
||
## A Simple Example | ||
|
||
```php | ||
<?php | ||
require 'class.phpmailer.php'; | ||
require 'PHPMailerAutoload.php'; | ||
|
||
$mail = new PHPMailer; | ||
|
||
$mail->isSMTP(); // Set mailer to use SMTP | ||
$mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup server | ||
$mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers | ||
$mail->SMTPAuth = true; // Enable SMTP authentication | ||
$mail->Username = 'jswan'; // SMTP username | ||
$mail->Username = '[email protected]'; // SMTP username | ||
$mail->Password = 'secret'; // SMTP password | ||
$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted | ||
|
||
$mail->From = '[email protected]'; | ||
$mail->FromName = 'Mailer'; | ||
$mail->addAddress('josh@example.net', 'Josh Adams'); // Add a recipient | ||
$mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient | ||
$mail->addAddress('[email protected]'); // Name is optional | ||
$mail->addReplyTo('[email protected]', 'Information'); | ||
$mail->addCC('[email protected]'); | ||
|
@@ -67,35 +78,38 @@ $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; | ||
exit; | ||
echo 'Message could not be sent.'; | ||
echo 'Mailer Error: ' . $mail->ErrorInfo; | ||
} else { | ||
echo 'Message has been sent'; | ||
} | ||
|
||
echo 'Message has been sent'; | ||
``` | ||
|
||
You'll find plenty more to play with in the `examples` folder. | ||
You'll find plenty more to play with in the [examples](examples/) folder. | ||
|
||
That's it. You should now be ready to use PHPMailer! | ||
|
||
## Localization | ||
PHPMailer defaults to English, but in the `languages` folder you'll find numerous 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](language/) folder you'll find numerous (39 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: | ||
|
||
```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](test/phpmailerLangTest.php) script in the tests folder and it will show any missing translations. | ||
|
||
## Documentation | ||
|
||
You'll find some basic user-level docs in the docs folder, and you can generate complete API-level documentation using the `generatedocs.sh` shell script in the docs folder, though you'll need to install [PHPDocumentor](http://www.phpdoc.org) first. | ||
Generated 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](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](test/phpmailerTest.php) a good source of how to do various operations such as encryption. | ||
|
||
## Tests | ||
|
||
You'll find a PHPUnit test script in the `test` folder. | ||
There is a PHPUnit test script in the [test](test/) folder. | ||
|
||
Build status: [![Build Status](https://travis-ci.org/PHPMailer/PHPMailer.png)](https://travis-ci.org/PHPMailer/PHPMailer) | ||
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? | ||
|
||
|
@@ -128,7 +142,7 @@ See [changelog](changelog.md). | |
- Test suite. | ||
- Continuous integration with Travis-CI. | ||
- Composer support. | ||
- Rolling releases. | ||
- Public development. | ||
- Additional languages and language strings. | ||
- CRAM-MD5 authentication support. | ||
- Preserves full repo history of authors, commits and branches from the original SourceForge project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,47 @@ | ||
# ChangeLog | ||
|
||
* Update html2text from https://github.com/mtibben/html2text | ||
|
||
## 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 Ukranian translation from @Krezalis | ||
* Support for do_verp | ||
|
@@ -122,7 +164,7 @@ | |
#52, #31, #41, #5. #70, #69 | ||
|
||
## Version 5.2.1 (January 16, 2012) | ||
* Closed several bugs#5 | ||
* Closed several bugs #5 | ||
* Performance improvements | ||
* MsgHTML() now returns the message as required. | ||
* New method: GetSentMIMEMessage() (returns full copy of sent message) | ||
|
@@ -251,11 +293,11 @@ NOTE: WE HAVE A NEW LANGUAGE VARIABLE FOR DIGITALLY SIGNED S/MIME EMAILS. IF YOU | |
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 = America/New York | ||
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('America/Toronto');` | ||
`date_default_timezone_set('Etc/UTC');` | ||
- do not try to use | ||
`$myVar = date_default_timezone_get();` | ||
as a test, it will throw an error. | ||
|
@@ -295,31 +337,6 @@ Please note, this is BETA software | |
* included example showing how to use PHPMailer with GMAIL | ||
* fixed the missing Cc in SendMail() and Mail() | ||
|
||
****************** | ||
A note on sending bulk emails: | ||
|
||
If the email you are sending is not personalized, consider using the | ||
"undisclosed-recipient:;" strategy. That is, put all of your recipients | ||
in the Bcc field and set the To field to "undisclosed-recipients:;". | ||
It's a lot faster (only one send) and saves quite a bit on resources. | ||
Contrary to some opinions, this will not get you listed in spam engines - | ||
it's a legitimate way for you to send emails. | ||
|
||
A partial example for use with PHPMailer: | ||
|
||
``` | ||
$mail->AddAddress("undisclosed-recipients:;"); | ||
$mail->AddBCC("[email protected],[email protected],[email protected]"); | ||
``` | ||
|
||
Many email service providers restrict the number of emails that can be sent | ||
in any given time period. Often that is between 50 - 60 emails maximum | ||
per hour or per send session. | ||
|
||
If that's the case, then break up your Bcc lists into chunks that are one | ||
less than your limit, and put a pause in your script. | ||
******************* | ||
|
||
## 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 | ||
|
@@ -332,26 +349,8 @@ less than your limit, and put a pause in your script. | |
* 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. | ||
example of use: | ||
|
||
``` | ||
$mail->set('X-Priority', '3'); | ||
$mail->set('X-MSMail-Priority', 'Normal'); | ||
``` | ||
|
||
* fixed warning message in SMTP get_lines method | ||
* added TLS/SSL SMTP support. Example of use: | ||
|
||
``` | ||
$mail = new PHPMailer(); | ||
$mail->Mailer = "smtp"; | ||
$mail->Host = "smtp.example.com"; | ||
$mail->SMTPSecure = "tls"; // option | ||
//$mail->SMTPSecure = "ssl"; // option | ||
... | ||
$mail->Send(); | ||
``` | ||
|
||
* 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 | ||
|
Oops, something went wrong.