diff --git a/main/inc/lib/phpmailer/ChangeLog.txt b/main/inc/lib/phpmailer/ChangeLog.txt
deleted file mode 100755
index 5de251ee0d..0000000000
--- a/main/inc/lib/phpmailer/ChangeLog.txt
+++ /dev/null
@@ -1,330 +0,0 @@
-ChangeLog
-
-NOTE: THIS VERSION OF PHPMAILER IS DESIGNED FOR PHP5/PHP6. IT WILL NOT WORK WITH PHP4.
-
-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 = America/New York
- 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');
- - 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 :// 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()
-
-******************
-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("email1@anydomain.com,email2@anyotherdomain.com,email3@anyalternatedomain.com");
-
-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
-* 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.
- 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();
-* 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 writen 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)
-* Intial public release
diff --git a/main/inc/lib/phpmailer/README b/main/inc/lib/phpmailer/README
index f2e2b795fc..2d79f38622 100755
--- a/main/inc/lib/phpmailer/README
+++ b/main/inc/lib/phpmailer/README
@@ -9,6 +9,31 @@ PHPMailer
Full Featured Email Transfer Class for PHP
==========================================
+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.
+
+We now have available the PHPDocumentor (phpdocs) documentation. This is
+separate from the regular download to keep file sizes down. Please see the
+download area of http://phpmailer.codeworxtech.com.
+
+We also have created a new test script (see /test_script) that you can use
+right out of the box. Copy the /test_script folder directly to your server (in
+the same structure ... with class.phpmailer.php and class.smtp.php in the
+folder above it. Then launch the test script with:
+http://www.yourdomain.com/phpmailer/test_script/index.php
+from this one script, you can test your server settings for mail(), sendmail (or
+qmail), and SMTP. This will email you a sample email (using contents.html for
+the email body) and two attachments. One of the attachments is used as an inline
+image to demonstrate how PHPMailer will automatically detect if attachments are
+the same source as inline graphics and only include one version. Once you click
+the Submit button, the results will be displayed including any SMTP debug
+information and send status. We will also display a version of the script that
+you can cut and paste to include in your projects. Enjoy!
+
Version 2.3 (November 08, 2008)
We have removed the /phpdoc from the downloads. All documentation is now on
@@ -119,7 +144,7 @@ easy to use classes: AspEmail(tm) and AspMail. Both of these
programs are COM components only available on Windows. They are also a
little pricey for smaller projects.
-Since I do Linux development I’ve missed these tools for my PHP coding.
+Since I do Linux development I�ve missed these tools for my PHP coding.
So I built a version myself that implements the same methods (object
calls) that the Windows-based components do. It is open source and the
LGPL license allows you to place the class in your proprietary PHP
diff --git a/main/inc/lib/phpmailer/aboutus.html b/main/inc/lib/phpmailer/aboutus.html
new file mode 100644
index 0000000000..70f3e0fcc5
--- /dev/null
+++ b/main/inc/lib/phpmailer/aboutus.html
@@ -0,0 +1,169 @@
+
+
+
+
+
+
+
+
+
+The http://phpmailer.codeworxtech.com/ website now carries a few
+advertisements through the Google Adsense network to help offset
+some of our costs.
+Thanks ....
+
+
PHPMailer is the world's leading email transport class and downloaded an
+average of more than 32,000 each month. In March 2009, PHPMailer was downloaded
+more than 31,000 times -- that's an average of 1,000 downloads daily. Our thanks
+to our new users and loyal users. We understand you have many choices available
+to select from and we thank you for select our fast and stable tool for your
+website and projects.
+
Credits:
+PHPMailer's original founder is Brent Matzelle. The current team is:
+Project Administrator: Andy Prevost (codeworxtech),
+
+codeworxtech@users.sourceforge.net
+Author: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net
+Author: Marcus Bointon (coolbru)
+coolbru@users.sourceforge.net
+
PHPMailer is used in many projects ranging from Open Source to commercial
+packages. Our LGPL licensing terms are very flexible and allow for including
+PHPMailer to enhance projects of all types. If you discover PHPMailer being used
+in a project, please let us know about it.
+
WHY USE OUR TOOLS & WHAT'S IN IT FOR YOU?
+
A valid question. We're developers too. We've been writing software, primarily for the internet, for more than 15 years. Along the way, there are two major things that had tremendous impact of our company: PHP and Open Source. PHP is without doubt the most popular platform for the internet. There has been more progress in this area of technology because of Open Source software than in any other IT segment. We have used many open source tools, some as learning tools, some as components in projects we were working on. To us, it's not about popularity ... we're committed to robust, stable, and efficient tools you can use to get your projects in your user's hands quickly. So the shorter answer: what's in it for you? rapid development and rapid deployment without fuss and with straight forward open source licensing.
Our company, Worx International Inc., is the publisher of several Open Source applications and developer tools as well as several commercial PHP applications. The Open Source applications are ttCMS and DCP Portal. The Open Source developer tools include QuickComponents (QuickSkin and QuickCache) and now PHPMailer.
+ We have staff and offices in the United States, Caribbean, the Middle
+ East, and our primary development center in Canada. Our company is represented by
+ agents and resellers globally.
+
Worx International Inc. is at the forefront of developing PHP applications. Our staff are all Zend Certified university educated and experts at object oriented programming. While Worx International Inc. can handle any project from trouble shooting programs written by others all the way to finished mission-critical applications, we specialize in taking projects from inception all the way through to implementation - on budget, and on time. If you need help with your projects, we're the team to get it done right at a reasonable price.
+
Over the years, there have been a number of tools that have been constant favorites in all of our projects. We have become the project administrators for most of these tools.
+
Our developer tools are all Open Source. Here's a brief description:
+
+
PHPMailer. Originally authored by Brent Matzelle, PHPMailer is the leading "email transfer class" for PHP. PHPMailer is downloaded more than
+ 26000 times each and every month by developers looking for a fast, stable, simple email solution. We used it ourselves for years as our favorite tool. It's always been small (the entire footprint is
+ less than 100 Kb), stable, and as complete a solution as you can find.
+ Other tools are nowhere near as simple. Our thanks to Brent Matzelle for this superb tool - our commitment is to keep it lean, keep it focused, and compliant with standards. Visit the PHPMailer website at
+ http://phpmailer.codeworxtech.com/.
+ Please note: all of our focus is now on the PHPMailer for PHP5.
+ PS. While you are at it, please visit our sponsor's sites, click on their ads.
+ It helps offset some of our costs.
+ Want to help? We're looking for progressive developers to join our team of volunteer professionals working on PHPMailer. Our entire focus is on PHPMailer
+ for PHP5. If you are interested, let us know.
+
+
+
QuickCache. Originally authored by Jean Pierre Deckers as jpCache, QuickCache is an HTTP OpCode caching strategy that works on your entire site with only one line of code at the top of your script. The cached pages can be stored as files or as database objects. The benefits are absolutely astounding: bandwidth savings of up to 80% and screen display times increased by 8 - 10x. Visit the QuickCache website at
+ http://quickcache.codeworxtech.com/.
+
+
+
QuickSkin. Originally authored by Philipp v. Criegern and named "SmartTemplate". The project was taken over by Manuel 'EndelWar' Dalla Lana and now by "codeworxtech". QuickSkin is one of the truly outstanding templating engines available, but has always been confused with Smarty Templating Engine. QuickSkin is even more relevant today than when it was launched. It's a small footprint with big impact on your projects. It features a built in caching technology, token based substitution, and works on the concept of one single HTML file as the template. The HTML template file can contain variable information making it one small powerful tool for your developer tool kit. Visit the QuickSkin website at
+ http://quickskin.codeworxtech.com/.
+
+
+
+
We're committed to PHP and to the Open Source community.
+
Opportunities with Worx International Inc.:
+
+
Resellers/Agents: We're always interested in talking with companies that
+ want to represent
+ Worx International Inc. in their markets. We also have private label programs for our commercial products (in certain circumstances).
+
Programmers/Developers: We are usually fully staffed, however, if you would like to be considered for a career with
+ Worx International Inc., we would be pleased to hear from you.
+ A few things to note:
+
+
experience level does not matter: from fresh out of college to multi-year experience - it's your
+ creative mind and a positive attitude we want
+
if you contact us looking for employment, include a cover letter, indicate what type of work/career you are looking for and expected compensation
+
if you are representing someone else looking for work, do not contact us. We have an exclusive relationship with a recruiting partner already and not interested in altering the arrangement. We will not hire your candidate under any circumstances unless they wish to approach us individually.
+
any contact that ignores any of these points will be discarded
+
+
Affiliates/Partnerships: We are interested in partnering with other firms who are leaders in their field. We clearly understand that successful companies are built on successful relationships in all industries world-wide. We currently have innovative relationships throughout the world that are mutually beneficial. Drop us a line and let's talk.
+
+ Regards,
+ Andy Prevost (aka, codeworxtech)
+ codeworxtech@users.sourceforge.net
+
+ We now also offer website design. hosting, and remote forms processing. Visit WorxStudio.com for more information.
+
+
+
Marcus is the technical director of Synchromedia Limited, a UK-based company providing online business services. Synchromedia's main services are:
+
Smartmessages.net
+
Smartmessages.net is Synchromedia's large-scale mailing list management system, providing email delivery services for a wide range of businesses, from sole traders to corporates.
+ We pride ourselves on personal service, and realise that every one of your subscribers is a precious asset to be handled with care.
+ We provide fast, reliable, high-volume delivery (some of our customers have lists of more than 1,000,000 subscribers) with fine-grained tracking while ensuring you stay fully compliant with UK, EC and US data protection laws. Smartmessages of course uses PHPMailer at its heart!
+
info@hand
+
Synchromedia is the official UK distributor of info@hand, a class-leading open-source web-based CRM system. We provide licenses, hosting, planning, support and training for this very fully-featured system at very competitive prices. info@hand also uses PHPMailer!
+
How can we help you?
+
In addition to our headline services, we also provide consulting, development, hosting and sysadmin services, so if you just need a simple web hosting package, we can do that too. Not surprisingly, we know rather a lot about email, so you can talk to us about that too.
\n";
+ }
+ }
$this->ErrorInfo = $msg;
}
/**
* Returns the proper RFC 822 formatted date.
- * @access private
+ * @access public
* @return string
+ * @static
*/
- private static function RFCDate() {
+ public static function RFCDate() {
$tz = date('Z');
$tzs = ($tz < 0) ? '-' : '+';
$tz = abs($tz);
@@ -1653,7 +1942,7 @@ class PHPMailer {
} elseif (isset($_SERVER['SERVER_NAME'])) {
$result = $_SERVER['SERVER_NAME'];
} else {
- $result = "localhost.localdomain";
+ $result = 'localhost.localdomain';
}
return $result;
@@ -1711,19 +2000,18 @@ class PHPMailer {
* @access public
* @return $message
*/
- public function MsgHTML($message,$basedir='') {
+ public function MsgHTML($message, $basedir = '') {
preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
if(isset($images[2])) {
foreach($images[2] as $i => $url) {
// do not change urls for absolute images (thanks to corvuscorax)
- if (!preg_match('/^[A-z][A-z]*:\/\//',$url)) {
+ if (!preg_match('#^[A-z]+://#',$url)) {
$filename = basename($url);
$directory = dirname($url);
($directory == '.')?$directory='':'';
$cid = 'cid:' . md5($filename);
- $fileParts = split("\.", $filename);
- $ext = $fileParts[1];
- $mimeType = $this->_mime_types($ext);
+ $ext = pathinfo($filename, PATHINFO_EXTENSION);
+ $mimeType = self::_mime_types($ext);
if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; }
if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
@@ -1735,20 +2023,22 @@ class PHPMailer {
$this->IsHTML(true);
$this->Body = $message;
$textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
- if ( !empty($textMsg) && empty($this->AltBody) ) {
+ if (!empty($textMsg) && empty($this->AltBody)) {
$this->AltBody = html_entity_decode($textMsg);
}
- if ( empty($this->AltBody) ) {
- $this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n";
+ if (empty($this->AltBody)) {
+ $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . "\n\n";
}
}
/**
- * Gets the mime type of the embedded or inline image
+ * Gets the MIME type of the embedded or inline image
+ * @param string File extension
* @access public
- * @return mime type of ext
+ * @return string MIME type of ext
+ * @static
*/
- public function _mime_types($ext = '') {
+ public static function _mime_types($ext = '') {
$mimes = array(
'hqx' => 'application/mac-binhex40',
'cpt' => 'application/mac-compactpro',
@@ -1838,46 +2128,35 @@ class PHPMailer {
'xl' => 'application/excel',
'eml' => 'message/rfc822'
);
- return ( ! isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
- }
-
- /**
- * Set (or reset) Class Objects (variables)
- *
- * Usage Example:
- * $page->set('X-Priority', '3');
- *
- * @access public
- * @param string $name Parameter Name
- * @param mixed $value Parameter Value
- * NOTE: will not work with arrays, there are no arrays to set/reset
- */
- public function set ( $name, $value = '' ) {
- if ( isset($this->$name) ) {
- $this->$name = $value;
- } else {
- $this->SetError('Cannot set or reset variable ' . $name);
- return false;
- }
+ return (!isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
}
/**
- * Read a file from a supplied filename and return it.
- *
- * @access public
- * @param string $filename Parameter File Name
- */
- public function getFile($filename) {
- $return = '';
- if ($fp = fopen($filename, 'rb')) {
- while (!feof($fp)) {
- $return .= fread($fp, 1024);
+ * Set (or reset) Class Objects (variables)
+ *
+ * Usage Example:
+ * $page->set('X-Priority', '3');
+ *
+ * @access public
+ * @param string $name Parameter Name
+ * @param mixed $value Parameter Value
+ * NOTE: will not work with arrays, there are no arrays to set/reset
+ * @todo Should this not be using __set() magic function?
+ */
+ public function set($name, $value = '') {
+ try {
+ if (isset($this->$name) ) {
+ $this->$name = $value;
+ } else {
+ throw new phpmailerException($this->Lang('variable_set') . $name, self::STOP_CRITICAL);
+ }
+ } catch (Exception $e) {
+ $this->SetError($e->getMessage());
+ if ($e->getCode() == self::STOP_CRITICAL) {
+ return false;
}
- fclose($fp);
- return $return;
- } else {
- return false;
}
+ return true;
}
/**
@@ -1887,10 +2166,9 @@ class PHPMailer {
* @return string
*/
public function SecureHeader($str) {
- $str = trim($str);
- $str = str_replace("\r", "", $str);
- $str = str_replace("\n", "", $str);
- return $str;
+ $str = str_replace("\r", '', $str);
+ $str = str_replace("\n", '', $str);
+ return trim($str);
}
/**
@@ -1905,6 +2183,138 @@ class PHPMailer {
$this->sign_key_file = $key_filename;
$this->sign_key_pass = $key_pass;
}
+
+ /**
+ * Set the private key file and password to sign the message.
+ *
+ * @access public
+ * @param string $key_filename Parameter File Name
+ * @param string $key_pass Password for private key
+ */
+ public function DKIM_QP($txt) {
+ $tmp="";
+ $line="";
+ for ($i=0;$iDKIM_private);
+ if ($this->DKIM_passphrase!='') {
+ $privKey = openssl_pkey_get_private($privKeyStr,$this->DKIM_passphrase);
+ } else {
+ $privKey = $privKeyStr;
+ }
+ if (openssl_sign($s, $signature, $privKey)) {
+ return base64_encode($signature);
+ }
+ }
+
+ /**
+ * Generate DKIM Canonicalization Header
+ *
+ * @access public
+ * @param string $s Header
+ */
+ public function DKIM_HeaderC($s) {
+ $s=preg_replace("/\r\n\s+/"," ",$s);
+ $lines=explode("\r\n",$s);
+ foreach ($lines as $key=>$line) {
+ list($heading,$value)=explode(":",$line,2);
+ $heading=strtolower($heading);
+ $value=preg_replace("/\s+/"," ",$value) ; // Compress useless spaces
+ $lines[$key]=$heading.":".trim($value) ; // Don't forget to remove WSP around the value
+ }
+ $s=implode("\r\n",$lines);
+ return $s;
+ }
+
+ /**
+ * Generate DKIM Canonicalization Body
+ *
+ * @access public
+ * @param string $body Message Body
+ */
+ public function DKIM_BodyC($body) {
+ if ($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;
+ }
+
+ /**
+ * Create the DKIM header, body, as new header
+ *
+ * @access public
+ * @param string $headers_line Header lines
+ * @param string $subject Subject
+ * @param string $body Body
+ */
+ public function DKIM_Add($headers_line,$subject,$body) {
+ $DKIMsignatureType = 'rsa-sha1'; // Signature & hash algorithms
+ $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization 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("\r\n",$headers_line);
+ foreach($headers as $header) {
+ if (strpos($header,'From:') === 0) {
+ $from_header=$header;
+ } elseif (strpos($header,'To:') === 0) {
+ $to_header=$header;
+ }
+ }
+ $from = str_replace('|','=7C',$this->DKIM_QP($from_header));
+ $to = str_replace('|','=7C',$this->DKIM_QP($to_header));
+ $subject = str_replace('|','=7C',$this->DKIM_QP($subject_header)) ; // Copied header fields (dkim-quoted-printable
+ $body = $this->DKIM_BodyC($body);
+ $DKIMlen = strlen($body) ; // Length of body
+ $DKIMb64 = base64_encode(pack("H*", sha1($body))) ; // Base64 of packed binary SHA-1 hash of body
+ $ident = ($this->DKIM_identity == '')? '' : " 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:Subject;\r\n".
+ "\td=" . $this->DKIM_domain . ";" . $ident . "\r\n".
+ "\tz=$from\r\n".
+ "\t|$to\r\n".
+ "\t|$subject;\r\n".
+ "\tbh=" . $DKIMb64 . ";\r\n".
+ "\tb=";
+ $toSign = $this->DKIM_HeaderC($from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs);
+ $signed = $this->DKIM_Sign($toSign);
+ return "X-PHPMAILER-DKIM: phpmailer.worxware.com\r\n".$dkimhdrs.$signed."\r\n";
+ }
+
+ protected function doCallback($isSent,$to,$cc,$bcc,$subject,$body) {
+ if (!empty($this->action_function) && function_exists($this->action_function)) {
+ $params = array($isSent,$to,$cc,$bcc,$subject,$body);
+ call_user_func_array($this->action_function,$params);
+ }
+ }
}
+class phpmailerException extends Exception {
+ public function errorMessage() {
+ $errorMsg = '' . $this->getMessage() . " \n";
+ return $errorMsg;
+ }
+}
?>
\ No newline at end of file
diff --git a/main/inc/lib/phpmailer/class.pop3.php b/main/inc/lib/phpmailer/class.pop3.php
index 0884a8252a..f9fd3b2edb 100755
--- a/main/inc/lib/phpmailer/class.pop3.php
+++ b/main/inc/lib/phpmailer/class.pop3.php
@@ -2,14 +2,16 @@
/*~ class.pop3.php
.---------------------------------------------------------------------------.
| Software: PHPMailer - PHP email class |
-| Version: 2.3 |
+| Version: 5.1 |
| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
| Info: http://phpmailer.sourceforge.net |
| Support: http://sourceforge.net/projects/phpmailer/ |
| ------------------------------------------------------------------------- |
-| Author: Andy Prevost (project admininistrator) |
-| Author: Brent R. Matzelle (original founder) |
-| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. |
+| Admin: Andy Prevost (project admininistrator) |
+| Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net |
+| : Marcus Bointon (coolbru) coolbru@users.sourceforge.net |
+| Founder: Brent R. Matzelle (original founder) |
+| Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved. |
| Copyright (c) 2001-2003, Brent R. Matzelle |
| ------------------------------------------------------------------------- |
| License: Distributed under the Lesser General Public License (LGPL) |
@@ -23,20 +25,32 @@
| - Technology Consulting |
| - Oursourcing (highly qualified programmers and graphic designers) |
'---------------------------------------------------------------------------'
+*/
+
+/**
+ * PHPMailer - PHP POP Before SMTP Authentication Class
+ * NOTE: Designed for use with PHP version 5 and up
+ * @package PHPMailer
+ * @author Andy Prevost
+ * @author Marcus Bointon
+ * @copyright 2004 - 2009 Andy Prevost
+ * @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL)
+ * @version $Id: class.pop3.php 444 2009-05-05 11:22:26Z coolbru $
+ */
/**
* POP Before SMTP Authentication Class
- * Version 2.3
+ * Version 5.0.0
*
* Author: Richard Davey (rich@corephp.co.uk)
* Modifications: Andy Prevost
* License: LGPL, see PHPMailer License
*
* Specifically for PHPMailer to allow POP before SMTP authentication.
- * Does not yet work with APOP - if you have an APOP account, contact me
+ * Does not yet work with APOP - if you have an APOP account, contact Richard Davey
* and we can test changes to this script.
*
- * This class is based on the structure of the SMTP class by Chris Ryan
+ * This class is based on the structure of the SMTP class originally authored by Chris Ryan
*
* This class is rfc 1939 compliant and implements all the commands
* required for POP3 connection, authentication and disconnection.
@@ -100,13 +114,13 @@ class POP3 {
*/
public $password;
- /**#@+
- * @access private
- */
+ /////////////////////////////////////////////////
+ // PROPERTIES, PRIVATE AND PROTECTED
+ /////////////////////////////////////////////////
+
private $pop_conn;
private $connected;
private $error; // Error log array
- /**#@-*/
/**
* Constructor, sets the initial values
diff --git a/main/inc/lib/phpmailer/class.smtp.php b/main/inc/lib/phpmailer/class.smtp.php
index 360d6afdd1..c2ca1cb3b8 100755
--- a/main/inc/lib/phpmailer/class.smtp.php
+++ b/main/inc/lib/phpmailer/class.smtp.php
@@ -1,1112 +1,814 @@
-smtp_conn = 0;
- $this->error = null;
- $this->helo_rply = null;
-
- $this->do_debug = 0;
- }
-
- /*************************************************************
- * CONNECTION FUNCTIONS *
- ***********************************************************/
-
- /**
- * Connect to the server specified on the port specified.
- * If the port is not specified use the default SMTP_PORT.
- * If tval is specified then a connection will try and be
- * established with the server for that number of seconds.
- * If tval is not specified the default is 30 seconds to
- * try on the connection.
- *
- * SMTP CODE SUCCESS: 220
- * SMTP CODE FAILURE: 421
- * @access public
- * @return bool
- */
- public function Connect($host,$port=0,$tval=30) {
- /* set the error val to null so there is no confusion */
- $this->error = null;
-
- /* make sure we are __not__ connected */
- if($this->connected()) {
- /* ok we are connected! what should we do?
- * for now we will just give an error saying we
- * are already connected
- */
- $this->error = array("error" => "Already connected to a server");
- return false;
- }
-
- if(empty($port)) {
- $port = $this->SMTP_PORT;
- }
-
- /* connect to the smtp server */
- $this->smtp_conn = fsockopen($host, // the host of the server
- $port, // the port to use
- $errno, // error number if any
- $errstr, // error message if any
- $tval); // give up after ? secs
- /* verify we connected properly */
- if(empty($this->smtp_conn)) {
- $this->error = array("error" => "Failed to connect to server",
- "errno" => $errno,
- "errstr" => $errstr);
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": $errstr ($errno)" . $this->CRLF;
- }
- return false;
- }
-
- /* sometimes the SMTP server takes a little longer to respond
- * so we will give it a longer timeout for the first read
- * - Windows still does not have support for this timeout function
- */
- if(substr(PHP_OS, 0, 3) != "WIN")
- socket_set_timeout($this->smtp_conn, $tval, 0);
-
- /* get any announcement stuff */
- $announce = $this->get_lines();
-
- /* set the timeout of any socket functions at 1/10 of a second */
- //if(function_exists("socket_set_timeout"))
- // socket_set_timeout($this->smtp_conn, 0, 100000);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce;
- }
-
- return true;
- }
-
- /**
- * Initiate a TSL communication with the server.
- *
- * SMTP CODE 220 Ready to start TLS
- * SMTP CODE 501 Syntax error (no parameters allowed)
- * SMTP CODE 454 TLS not available due to temporary reason
- * @access public
- * @return bool success
- */
- public function StartTLS() {
- $this->error = null; # to avoid confusion
-
- if(!$this->connected()) {
- $this->error = array("error" => "Called StartTLS() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"STARTTLS" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 220) {
- $this->error =
- array("error" => "STARTTLS not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- //Begin encrypted connection
- if(!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
- return false;
- }
-
- return true;
- }
-
- /**
- * Performs SMTP authentication. Must be run after running the
- * Hello() method. Returns true if successfully authenticated.
- * @access public
- * @return bool
- */
- public function Authenticate($username, $password) {
- // Start authentication
- fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($code != 334) {
- $this->error =
- array("error" => "AUTH not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- // Send encoded username
- fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($code != 334) {
- $this->error =
- array("error" => "Username not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- // Send encoded password
- fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($code != 235) {
- $this->error =
- array("error" => "Password not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- return true;
- }
-
- /**
- * Returns true if connected to a server otherwise false
- * @access public
- * @return bool
- */
- public function Connected() {
- if(!empty($this->smtp_conn)) {
- $sock_status = socket_get_status($this->smtp_conn);
- if($sock_status["eof"]) {
- // hmm this is an odd situation... the socket is
- // valid but we are not connected anymore
- if($this->do_debug >= 1) {
- echo "SMTP -> NOTICE:" . $this->CRLF .
- "EOF caught while checking if connected";
- }
- $this->Close();
- return false;
- }
- return true; // everything looks good
- }
- return false;
- }
-
- /**
- * Closes the socket and cleans up the state of the class.
- * It is not considered good to use this function without
- * first trying to use QUIT.
- * @access public
- * @return void
- */
- public function Close() {
- $this->error = null; // so there is no confusion
- $this->helo_rply = null;
- if(!empty($this->smtp_conn)) {
- // close the connection and cleanup
- fclose($this->smtp_conn);
- $this->smtp_conn = 0;
- }
- }
-
- /***************************************************************
- * SMTP COMMANDS *
- *************************************************************/
-
- /**
- * Issues a data command and sends the msg_data to the server
- * 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 with the message headers
- * and the message body being seperated by and additional .
- *
- * Implements rfc 821: DATA
- *
- * SMTP CODE INTERMEDIATE: 354
- * [data]
- * .
- * SMTP CODE SUCCESS: 250
- * SMTP CODE FAILURE: 552,554,451,452
- * SMTP CODE FAILURE: 451,554
- * SMTP CODE ERROR : 500,501,503,421
- * @access public
- * @return bool
- */
- public function Data($msg_data) {
- $this->error = null; // so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Data() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"DATA" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 354) {
- $this->error =
- array("error" => "DATA command not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- /* the server is ready to accept data!
- * according to rfc 821 we should not send more than 1000
- * including the CRLF
- * characters on a single line 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.
- * in addition we will be looking for lines that start with
- * a period '.' and append and additional period '.' to that
- * line. NOTE: this does not count towards are limit.
- */
-
- // normalize the line breaks so we know the explode works
- $msg_data = str_replace("\r\n","\n",$msg_data);
- $msg_data = str_replace("\r","\n",$msg_data);
- $lines = explode("\n",$msg_data);
-
- /* we need to find a good way to determine is headers are
- * in the msg_data or if it is a straight msg body
- * currently I am assuming rfc 822 definitions of msg headers
- * and if the first field of the first line (':' sperated)
- * does not contain a space then it _should_ be a header
- * and we can process all lines before a blank "" line as
- * headers.
- */
- $field = substr($lines[0],0,strpos($lines[0],":"));
- $in_headers = false;
- if(!empty($field) && !strstr($field," ")) {
- $in_headers = true;
- }
-
- $max_line_length = 998; // used below; set here for ease in change
-
- while(list(,$line) = @each($lines)) {
- $lines_out = null;
- if($line == "" && $in_headers) {
- $in_headers = false;
- }
- // ok we need to break this line up into several smaller lines
- while(strlen($line) > $max_line_length) {
- $pos = strrpos(substr($line,0,$max_line_length)," ");
-
- // Patch to fix DOS attack
- if(!$pos) {
- $pos = $max_line_length - 1;
- $lines_out[] = substr($line,0,$pos);
- $line = substr($line,$pos);
- } else {
- $lines_out[] = substr($line,0,$pos);
- $line = substr($line,$pos + 1);
- }
-
- /* if we are processing headers we need to
- * add a LWSP-char to the front of the new line
- * rfc 822 on long msg headers
- */
- if($in_headers) {
- $line = "\t" . $line;
- }
- }
- $lines_out[] = $line;
-
- // now send the lines to the server
- while(list(,$line_out) = @each($lines_out)) {
- if(strlen($line_out) > 0)
- {
- if(substr($line_out, 0, 1) == ".") {
- $line_out = "." . $line_out;
- }
- }
- fputs($this->smtp_conn,$line_out . $this->CRLF);
- }
- }
-
- // ok all the message data has been sent so lets get this
- // over with aleady
- fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "DATA not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * Expand takes the name and asks the server to list all the
- * people who are members of the _list_. Expand will return
- * back and array of the result or false if an error occurs.
- * Each value in the array returned has the format of:
- * [ ]
- * The definition of is defined in rfc 821
- *
- * Implements rfc 821: EXPN
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE FAILURE: 550
- * SMTP CODE ERROR : 500,501,502,504,421
- * @access public
- * @return string array
- */
- public function Expand($name) {
- $this->error = null; // so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Expand() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "EXPN not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- // parse the reply and place in our array to return to user
- $entries = explode($this->CRLF,$rply);
- while(list(,$l) = @each($entries)) {
- $list[] = substr($l,4);
- }
-
- return $list;
- }
-
- /**
- * Sends the HELO command to the smtp server.
- * This makes sure that we and the server are in
- * the same known state.
- *
- * Implements from rfc 821: HELO
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE ERROR : 500, 501, 504, 421
- * @access public
- * @return bool
- */
- public function Hello($host="") {
- $this->error = null; // so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Hello() without being connected");
- return false;
- }
-
- // if a hostname for the HELO was not specified determine
- //a suitable one to send
- if(empty($host)) {
- // we need to determine some sort of appopiate default
- // to send to the server
- $host = "localhost";
- }
-
- // Send extended hello first (RFC 2821)
- if(!$this->SendHello("EHLO", $host))
- {
- if(!$this->SendHello("HELO", $host))
- return false;
- }
-
- return true;
- }
-
- /**
- * Sends a HELO/EHLO command.
- * @access private
- * @return bool
- */
- private function SendHello($hello, $host) {
- fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => $hello . " not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- $this->helo_rply = $rply;
-
- return true;
- }
-
- /**
- * Gets help information on the keyword specified. If the keyword
- * is not specified then returns generic help, ussually contianing
- * A list of keywords that help is available on. This function
- * returns the results back to the user. It is up to the user to
- * handle the returned data. If an error occurs then false is
- * returned with $this->error set appropiately.
- *
- * Implements rfc 821: HELP [ ]
- *
- * SMTP CODE SUCCESS: 211,214
- * SMTP CODE ERROR : 500,501,502,504,421
- * @access public
- * @return string
- */
- public function Help($keyword="") {
- $this->error = null; // to avoid confusion
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Help() without being connected");
- return false;
- }
-
- $extra = "";
- if(!empty($keyword)) {
- $extra = " " . $keyword;
- }
-
- fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 211 && $code != 214) {
- $this->error =
- array("error" => "HELP not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- return $rply;
- }
-
- /**
- * Starts a mail transaction from the email address specified in
- * $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 FROM:
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE SUCCESS: 552,451,452
- * SMTP CODE SUCCESS: 500,501,421
- * @access public
- * @return bool
- */
- public function Mail($from) {
- $this->error = null; // so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Mail() without being connected");
- return false;
- }
-
- $useVerp = ($this->do_verp ? "XVERP" : "");
- fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "MAIL not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * Sends the command NOOP to the SMTP server.
- *
- * Implements from rfc 821: NOOP
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE ERROR : 500, 421
- * @access public
- * @return bool
- */
- public function Noop() {
- $this->error = null; // so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Noop() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"NOOP" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "NOOP not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * Sends the quit command to the server and then closes the socket
- * if there is no error or the $close_on_error argument is true.
- *
- * Implements from rfc 821: QUIT
- *
- * SMTP CODE SUCCESS: 221
- * SMTP CODE ERROR : 500
- * @access public
- * @return bool
- */
- public function Quit($close_on_error=true) {
- $this->error = null; // so there is no confusion
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Quit() without being connected");
- return false;
- }
-
- // send the quit command to the server
- fputs($this->smtp_conn,"quit" . $this->CRLF);
-
- // get any good-bye messages
- $byemsg = $this->get_lines();
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg;
- }
-
- $rval = true;
- $e = null;
-
- $code = substr($byemsg,0,3);
- if($code != 221) {
- // use e as a tmp var cause Close will overwrite $this->error
- $e = array("error" => "SMTP server rejected quit command",
- "smtp_code" => $code,
- "smtp_rply" => substr($byemsg,4));
- $rval = false;
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $e["error"] . ": " .
- $byemsg . $this->CRLF;
- }
- }
-
- if(empty($e) || $close_on_error) {
- $this->Close();
- }
-
- return $rval;
- }
-
- /**
- * Sends the command RCPT to the SMTP server with the TO: argument of $to.
- * Returns true if the recipient was accepted false if it was rejected.
- *
- * Implements from rfc 821: RCPT TO:
- *
- * SMTP CODE SUCCESS: 250,251
- * SMTP CODE FAILURE: 550,551,552,553,450,451,452
- * SMTP CODE ERROR : 500,501,503,421
- * @access public
- * @return bool
- */
- public function Recipient($to) {
- $this->error = null; // so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Recipient() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250 && $code != 251) {
- $this->error =
- array("error" => "RCPT not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * Sends the RSET command to abort and transaction that is
- * currently in progress. Returns true if successful false
- * otherwise.
- *
- * Implements rfc 821: RSET
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE ERROR : 500,501,504,421
- * @access public
- * @return bool
- */
- public function Reset() {
- $this->error = null; // so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Reset() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"RSET" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "RSET failed",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- return true;
- }
-
- /**
- * Starts a mail transaction from the email address specified in
- * $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. This command
- * will send the message to the users terminal if they are logged
- * in.
- *
- * Implements rfc 821: SEND FROM:
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE SUCCESS: 552,451,452
- * SMTP CODE SUCCESS: 500,501,502,421
- * @access public
- * @return bool
- */
- public function Send($from) {
- $this->error = null; // so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Send() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "SEND not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * Starts a mail transaction from the email address specified in
- * $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. This command
- * will send the message to the users terminal if they are logged
- * in and send them an email.
- *
- * Implements rfc 821: SAML FROM:
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE SUCCESS: 552,451,452
- * SMTP CODE SUCCESS: 500,501,502,421
- * @access public
- * @return bool
- */
- public function SendAndMail($from) {
- $this->error = null; // so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called SendAndMail() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "SAML not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * Starts a mail transaction from the email address specified in
- * $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. This command
- * will send the message to the users terminal if they are logged
- * in or mail it to them if they are not.
- *
- * Implements rfc 821: SOML FROM:
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE SUCCESS: 552,451,452
- * SMTP CODE SUCCESS: 500,501,502,421
- * @access public
- * @return bool
- */
- public function SendOrMail($from) {
- $this->error = null; // so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called SendOrMail() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "SOML not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * 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 implimented in the future
- *
- * Implements from rfc 821: TURN
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE FAILURE: 502
- * SMTP CODE ERROR : 500, 503
- * @access public
- * @return bool
- */
- public function Turn() {
- $this->error = array("error" => "This method, TURN, of the SMTP ".
- "is not implemented");
- if($this->do_debug >= 1) {
- echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF;
- }
- return false;
- }
-
- /**
- * Verifies that the name is recognized by the server.
- * Returns false if the name could not be verified otherwise
- * the response from the server is returned.
- *
- * Implements rfc 821: VRFY
- *
- * SMTP CODE SUCCESS: 250,251
- * SMTP CODE FAILURE: 550,551,553
- * SMTP CODE ERROR : 500,501,502,421
- * @access public
- * @return int
- */
- public function Verify($name) {
- $this->error = null; // so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Verify() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250 && $code != 251) {
- $this->error =
- array("error" => "VRFY failed on name '$name'",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return $rply;
- }
-
- /*******************************************************************
- * INTERNAL FUNCTIONS *
- ******************************************************************/
-
- /**
- * Read in as many lines as possible
- * either before eof or socket timeout occurs on the operation.
- * 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 private
- * @return string
- */
- private function get_lines() {
- $data = "";
- while($str = @fgets($this->smtp_conn,515)) {
- if($this->do_debug >= 4) {
- echo "SMTP -> get_lines(): \$data was \"$data\"" .
- $this->CRLF;
- echo "SMTP -> get_lines(): \$str is \"$str\"" .
- $this->CRLF;
- }
- $data .= $str;
- if($this->do_debug >= 4) {
- echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF;
- }
- // if the 4th character is a space then we are done reading
- // so just break the loop
- if(substr($str,3,1) == " ") { break; }
- }
- return $data;
- }
-
-}
-
+smtp_conn = 0;
+ $this->error = null;
+ $this->helo_rply = null;
+
+ $this->do_debug = 0;
+ }
+
+ /////////////////////////////////////////////////
+ // CONNECTION FUNCTIONS
+ /////////////////////////////////////////////////
+
+ /**
+ * Connect to the server specified on the port specified.
+ * If the port is not specified use the default SMTP_PORT.
+ * If tval is specified then a connection will try and be
+ * established with the server for that number of seconds.
+ * If tval is not specified the default is 30 seconds to
+ * try on the connection.
+ *
+ * SMTP CODE SUCCESS: 220
+ * SMTP CODE FAILURE: 421
+ * @access public
+ * @return bool
+ */
+ public function Connect($host, $port = 0, $tval = 30) {
+ // set the error val to null so there is no confusion
+ $this->error = null;
+
+ // make sure we are __not__ connected
+ if($this->connected()) {
+ // already connected, generate error
+ $this->error = array("error" => "Already connected to a server");
+ return false;
+ }
+
+ if(empty($port)) {
+ $port = $this->SMTP_PORT;
+ }
+
+ // connect to the smtp server
+ $this->smtp_conn = @fsockopen($host, // the host of the server
+ $port, // the port to use
+ $errno, // error number if any
+ $errstr, // error message if any
+ $tval); // give up after ? secs
+ // verify we connected properly
+ if(empty($this->smtp_conn)) {
+ $this->error = array("error" => "Failed to connect to server",
+ "errno" => $errno,
+ "errstr" => $errstr);
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] . ": $errstr ($errno)" . $this->CRLF . ' ';
+ }
+ return false;
+ }
+
+ // 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")
+ socket_set_timeout($this->smtp_conn, $tval, 0);
+
+ // get any announcement
+ $announce = $this->get_lines();
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $announce . $this->CRLF . ' ';
+ }
+
+ return true;
+ }
+
+ /**
+ * Initiate a TLS communication with the server.
+ *
+ * SMTP CODE 220 Ready to start TLS
+ * SMTP CODE 501 Syntax error (no parameters allowed)
+ * SMTP CODE 454 TLS not available due to temporary reason
+ * @access public
+ * @return bool success
+ */
+ public function StartTLS() {
+ $this->error = null; # to avoid confusion
+
+ if(!$this->connected()) {
+ $this->error = array("error" => "Called StartTLS() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"STARTTLS" . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . ' ';
+ }
+
+ if($code != 220) {
+ $this->error =
+ array("error" => "STARTTLS not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . ' ';
+ }
+ return false;
+ }
+
+ // Begin encrypted connection
+ if(!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Performs SMTP authentication. Must be run after running the
+ * Hello() method. Returns true if successfully authenticated.
+ * @access public
+ * @return bool
+ */
+ public function Authenticate($username, $password) {
+ // Start authentication
+ fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($code != 334) {
+ $this->error =
+ array("error" => "AUTH not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . ' ';
+ }
+ return false;
+ }
+
+ // Send encoded username
+ fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($code != 334) {
+ $this->error =
+ array("error" => "Username not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . ' ';
+ }
+ return false;
+ }
+
+ // Send encoded password
+ fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($code != 235) {
+ $this->error =
+ array("error" => "Password not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . ' ';
+ }
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns true if connected to a server otherwise false
+ * @access public
+ * @return bool
+ */
+ public function Connected() {
+ if(!empty($this->smtp_conn)) {
+ $sock_status = socket_get_status($this->smtp_conn);
+ if($sock_status["eof"]) {
+ // the socket is valid but we are not connected
+ if($this->do_debug >= 1) {
+ echo "SMTP -> NOTICE:" . $this->CRLF . "EOF caught while checking if connected";
+ }
+ $this->Close();
+ return false;
+ }
+ return true; // everything looks good
+ }
+ return false;
+ }
+
+ /**
+ * Closes the socket and cleans up the state of the class.
+ * It is not considered good to use this function without
+ * first trying to use QUIT.
+ * @access public
+ * @return void
+ */
+ public function Close() {
+ $this->error = null; // so there is no confusion
+ $this->helo_rply = null;
+ if(!empty($this->smtp_conn)) {
+ // close the connection and cleanup
+ fclose($this->smtp_conn);
+ $this->smtp_conn = 0;
+ }
+ }
+
+ /////////////////////////////////////////////////
+ // SMTP COMMANDS
+ /////////////////////////////////////////////////
+
+ /**
+ * Issues a data command and sends the msg_data to the server
+ * 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 with the message headers
+ * and the message body being seperated by and additional .
+ *
+ * Implements rfc 821: DATA
+ *
+ * SMTP CODE INTERMEDIATE: 354
+ * [data]
+ * .
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE FAILURE: 552,554,451,452
+ * SMTP CODE FAILURE: 451,554
+ * SMTP CODE ERROR : 500,501,503,421
+ * @access public
+ * @return bool
+ */
+ public function Data($msg_data) {
+ $this->error = null; // so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Data() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"DATA" . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . ' ';
+ }
+
+ if($code != 354) {
+ $this->error =
+ array("error" => "DATA command not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . ' ';
+ }
+ return false;
+ }
+
+ /* the server is ready to accept data!
+ * according to rfc 821 we should not send more than 1000
+ * including the CRLF
+ * characters on a single line 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.
+ * in addition we will be looking for lines that start with
+ * a period '.' and append and additional period '.' to that
+ * line. NOTE: this does not count towards limit.
+ */
+
+ // normalize the line breaks so we know the explode works
+ $msg_data = str_replace("\r\n","\n",$msg_data);
+ $msg_data = str_replace("\r","\n",$msg_data);
+ $lines = explode("\n",$msg_data);
+
+ /* we need to find a good way to determine is headers are
+ * in the msg_data or if it is a straight msg body
+ * currently I am assuming rfc 822 definitions of msg headers
+ * and if the first field of the first line (':' sperated)
+ * does not contain a space then it _should_ be a header
+ * and we can process all lines before a blank "" line as
+ * headers.
+ */
+
+ $field = substr($lines[0],0,strpos($lines[0],":"));
+ $in_headers = false;
+ if(!empty($field) && !strstr($field," ")) {
+ $in_headers = true;
+ }
+
+ $max_line_length = 998; // used below; set here for ease in change
+
+ while(list(,$line) = @each($lines)) {
+ $lines_out = null;
+ if($line == "" && $in_headers) {
+ $in_headers = false;
+ }
+ // ok we need to break this line up into several smaller lines
+ while(strlen($line) > $max_line_length) {
+ $pos = strrpos(substr($line,0,$max_line_length)," ");
+
+ // Patch to fix DOS attack
+ if(!$pos) {
+ $pos = $max_line_length - 1;
+ $lines_out[] = substr($line,0,$pos);
+ $line = substr($line,$pos);
+ } else {
+ $lines_out[] = substr($line,0,$pos);
+ $line = substr($line,$pos + 1);
+ }
+
+ /* if processing headers add a LWSP-char to the front of new line
+ * rfc 822 on long msg headers
+ */
+ if($in_headers) {
+ $line = "\t" . $line;
+ }
+ }
+ $lines_out[] = $line;
+
+ // send the lines to the server
+ while(list(,$line_out) = @each($lines_out)) {
+ if(strlen($line_out) > 0)
+ {
+ if(substr($line_out, 0, 1) == ".") {
+ $line_out = "." . $line_out;
+ }
+ }
+ fputs($this->smtp_conn,$line_out . $this->CRLF);
+ }
+ }
+
+ // message data has been sent
+ fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . ' ';
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "DATA not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . ' ';
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Sends the HELO command to the smtp server.
+ * This makes sure that we and the server are in
+ * the same known state.
+ *
+ * Implements from rfc 821: HELO
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE ERROR : 500, 501, 504, 421
+ * @access public
+ * @return bool
+ */
+ public function Hello($host = '') {
+ $this->error = null; // so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Hello() without being connected");
+ return false;
+ }
+
+ // if hostname for HELO was not specified send default
+ if(empty($host)) {
+ // determine appropriate default to send to server
+ $host = "localhost";
+ }
+
+ // Send extended hello first (RFC 2821)
+ if(!$this->SendHello("EHLO", $host)) {
+ if(!$this->SendHello("HELO", $host)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Sends a HELO/EHLO command.
+ * @access private
+ * @return bool
+ */
+ private function SendHello($hello, $host) {
+ fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER: " . $rply . $this->CRLF . ' ';
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => $hello . " not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . ' ';
+ }
+ return false;
+ }
+
+ $this->helo_rply = $rply;
+
+ return true;
+ }
+
+ /**
+ * Starts a mail transaction from the email address specified in
+ * $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 FROM:
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE SUCCESS: 552,451,452
+ * SMTP CODE SUCCESS: 500,501,421
+ * @access public
+ * @return bool
+ */
+ public function Mail($from) {
+ $this->error = null; // so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Mail() without being connected");
+ return false;
+ }
+
+ $useVerp = ($this->do_verp ? "XVERP" : "");
+ fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . ' ';
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "MAIL not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . ' ';
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Sends the quit command to the server and then closes the socket
+ * if there is no error or the $close_on_error argument is true.
+ *
+ * Implements from rfc 821: QUIT
+ *
+ * SMTP CODE SUCCESS: 221
+ * SMTP CODE ERROR : 500
+ * @access public
+ * @return bool
+ */
+ public function Quit($close_on_error = true) {
+ $this->error = null; // so there is no confusion
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Quit() without being connected");
+ return false;
+ }
+
+ // send the quit command to the server
+ fputs($this->smtp_conn,"quit" . $this->CRLF);
+
+ // get any good-bye messages
+ $byemsg = $this->get_lines();
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $byemsg . $this->CRLF . ' ';
+ }
+
+ $rval = true;
+ $e = null;
+
+ $code = substr($byemsg,0,3);
+ if($code != 221) {
+ // use e as a tmp var cause Close will overwrite $this->error
+ $e = array("error" => "SMTP server rejected quit command",
+ "smtp_code" => $code,
+ "smtp_rply" => substr($byemsg,4));
+ $rval = false;
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $e["error"] . ": " . $byemsg . $this->CRLF . ' ';
+ }
+ }
+
+ if(empty($e) || $close_on_error) {
+ $this->Close();
+ }
+
+ return $rval;
+ }
+
+ /**
+ * Sends the command RCPT to the SMTP server with the TO: argument of $to.
+ * Returns true if the recipient was accepted false if it was rejected.
+ *
+ * Implements from rfc 821: RCPT TO:
+ *
+ * SMTP CODE SUCCESS: 250,251
+ * SMTP CODE FAILURE: 550,551,552,553,450,451,452
+ * SMTP CODE ERROR : 500,501,503,421
+ * @access public
+ * @return bool
+ */
+ public function Recipient($to) {
+ $this->error = null; // so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Recipient() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . ' ';
+ }
+
+ if($code != 250 && $code != 251) {
+ $this->error =
+ array("error" => "RCPT not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . ' ';
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Sends the RSET command to abort and transaction that is
+ * currently in progress. Returns true if successful false
+ * otherwise.
+ *
+ * Implements rfc 821: RSET
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE ERROR : 500,501,504,421
+ * @access public
+ * @return bool
+ */
+ public function Reset() {
+ $this->error = null; // so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Reset() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"RSET" . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . ' ';
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "RSET failed",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . ' ';
+ }
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Starts a mail transaction from the email address specified in
+ * $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. This command
+ * will send the message to the users terminal if they are logged
+ * in and send them an email.
+ *
+ * Implements rfc 821: SAML FROM:
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE SUCCESS: 552,451,452
+ * SMTP CODE SUCCESS: 500,501,502,421
+ * @access public
+ * @return bool
+ */
+ public function SendAndMail($from) {
+ $this->error = null; // so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called SendAndMail() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . ' ';
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "SAML not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . ' ';
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * 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 implimented in the future
+ *
+ * Implements from rfc 821: TURN
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE FAILURE: 502
+ * SMTP CODE ERROR : 500, 503
+ * @access public
+ * @return bool
+ */
+ public function Turn() {
+ $this->error = array("error" => "This method, TURN, of the SMTP ".
+ "is not implemented");
+ if($this->do_debug >= 1) {
+ echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF . ' ';
+ }
+ return false;
+ }
+
+ /**
+ * Get the current error
+ * @access public
+ * @return array
+ */
+ public function getError() {
+ return $this->error;
+ }
+
+ /////////////////////////////////////////////////
+ // INTERNAL FUNCTIONS
+ /////////////////////////////////////////////////
+
+ /**
+ * Read in as many lines as possible
+ * either before eof or socket timeout occurs on the operation.
+ * 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 private
+ * @return string
+ */
+ private function get_lines() {
+ $data = "";
+ while($str = @fgets($this->smtp_conn,515)) {
+ if($this->do_debug >= 4) {
+ echo "SMTP -> get_lines(): \$data was \"$data\"" . $this->CRLF . ' ';
+ echo "SMTP -> get_lines(): \$str is \"$str\"" . $this->CRLF . ' ';
+ }
+ $data .= $str;
+ if($this->do_debug >= 4) {
+ echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF . ' ';
+ }
+ // if 4th character is a space, we are done reading, break the loop
+ if(substr($str,3,1) == " ") { break; }
+ }
+ return $data;
+ }
+
+}
+
?>
\ No newline at end of file
diff --git a/main/inc/lib/phpmailer/codeworxtech.html b/main/inc/lib/phpmailer/codeworxtech.html
deleted file mode 100755
index 121e64dd7a..0000000000
--- a/main/inc/lib/phpmailer/codeworxtech.html
+++ /dev/null
@@ -1,121 +0,0 @@
-
-
-
-
-
-
-
-
-
-The http://phpmailer.codeworxtech.com/ website now carries a few
-advertisements through the Google Adsense network to help offset
-some of our costs.
-Thanks ....
-
-
My name is Andy Prevost, AKA "codeworxtech".
-www.codeworxtech.com for more information.
-
-
WHY USE OUR TOOLS & WHAT'S IN IT FOR YOU?
-
A valid question. We're developers too. We've been writing software, primarily for the internet, for more than 15 years. Along the way, there are two major things that had tremendous impact of our company: PHP and Open Source. PHP is without doubt the most popular platform for the internet. There has been more progress in this area of technology because of Open Source software than in any other IT segment. We have used many open source tools, some as learning tools, some as components in projects we were working on. To us, it's not about popularity ... we're committed to robust, stable, and efficient tools you can use to get your projects in your user's hands quickly. So the shorter answer: what's in it for you? rapid development and rapid deployment without fuss and with straight forward open source licensing.
-
Now, the introductions:
-
Our company, Worx International Inc., is the publisher of several Open Source applications and developer tools as well as several commercial PHP applications. The Open Source applications are ttCMS and DCP Portal. The Open Source developer tools include QuickComponents (QuickSkin and QuickCache) and now PHPMailer.
-We have staff and offices in the United States, Caribbean, the Middle
-East, and our primary development center in Canada. Our company is represented by
-agents and resellers globally.
-
Worx International Inc. is at the forefront of developing PHP applications. Our staff are all Zend Certified university educated and experts at object oriented programming. While Worx International Inc. can handle any project from trouble shooting programs written by others all the way to finished mission-critical applications, we specialize in taking projects from inception all the way through to implementation - on budget, and on time. If you need help with your projects, we're the team to get it done right at a reasonable price.
-
Over the years, there have been a number of tools that have been constant favorites in all of our projects. We have become the project administrators for most of these tools.
-
Our developer tools are all Open Source. Here's a brief description:
-
-
PHPMailer. Originally authored by Brent Matzelle, PHPMailer is the leading "email transfer class" for PHP. PHPMailer is downloaded more than 18000 times each and every month by developers looking for a stable, simple email solution. We used it ourselves for years as our favorite tool. It's always been small (the entire footprint is around 100 Kb), stable, and as complete a solution as you can find. Other tools are nowhere near as simple. And more importantly, most of our applications (including PHPMailer) is implemented in a smaller footprint than one competing email class. Our thanks to Brent Matzelle for this superb tool - our commitment is to keep it lean, keep it focused, and compliant with standards. Visit the PHPMailer website at
- http://phpmailer.codeworxtech.com/.
- Please note: all of our focus is now on the PHPMailer for PHP5.
- PS. While you are at it, please visit our sponsor's sites, click on their ads.
- It helps offset some of our costs.
- Want to help? We're looking for progressive developers to join our team of volunteer professionals working on PHPMailer. Our entire focus is on PHPMailer for PHP5, and our next major task is to enhance our
- exception/error handling with PHP 5's object oriented try/throw/catch mechanisms. If you are interested, let us know.
-
-
-
QuickCache. Originally authored by Jean Pierre Deckers as jpCache, QuickCache is an HTTP OpCode caching strategy that works on your entire site with only one line of code at the top of your script. The cached pages can be stored as files or as database objects. The benefits are absolutely astounding: bandwidth savings of up to 80% and screen display times increased by 8 - 10x. Visit the QuickCache website at
- http://quickcache.codeworxtech.com/.
-
-
-
QuickSkin. Originally authored by Philipp v. Criegern and named "SmartTemplate". The project was taken over by Manuel 'EndelWar' Dalla Lana and now by "codeworxtech". QuickSkin is one of the truly outstanding templating engines available, but has always been confused with Smarty Templating Engine. QuickSkin is even more relevant today than when it was launched. It's a small footprint with big impact on your projects. It features a built in caching technology, token based substitution, and works on the concept of one single HTML file as the template. The HTML template file can contain variable information making it one small powerful tool for your developer tool kit. Visit the QuickSkin website at
- http://quickskin.codeworxtech.com/.
-
-
-
-
We're committed to PHP and to the Open Source community.
-
Opportunities with Worx International Inc.:
-
-
Resellers/Agents: We're always interested in talking with companies that
-want to represent
-Worx International Inc. in their markets. We also have private label programs for our commercial products (in certain circumstances).
-
Programmers/Developers: We are usually fully staffed, however, if you would like to be considered for a career with
-Worx International Inc., we would be pleased to hear from you.
-A few things to note:
-
-
experience level does not matter: from fresh out of college to multi-year experience - it's your
- creative mind and a positive attitude we want
-
if you contact us looking for employment, include a cover letter, indicate what type of work/career you are looking for and expected compensation
-
if you are representing someone else looking for work, do not contact us. We have an exclusive relationship with a recruiting partner already and not interested in altering the arrangement. We will not hire your candidate under any circumstances unless they wish to approach us individually.
-
any contact that ignores any of these points will be discarded
-
-
Affiliates/Partnerships: We are interested in partnering with other firms who are leaders in their field. We clearly understand that successful companies are built on successful relationships in all industries world-wide. We currently have innovative relationships throughout the world that are mutually beneficial. Drop us a line and let's talk.
-
-Regards,
-Andy Prevost (aka, codeworxtech)
-codeworxtech@users.sourceforge.net
-
-We now also offer website design. hosting, and remote forms processing. Visit WorxStudio.com for more information.
-
-
-
-
diff --git a/main/inc/lib/phpmailer/docs/Callback_function_notes.txt b/main/inc/lib/phpmailer/docs/Callback_function_notes.txt
new file mode 100644
index 0000000000..7b98ce2297
--- /dev/null
+++ b/main/inc/lib/phpmailer/docs/Callback_function_notes.txt
@@ -0,0 +1,17 @@
+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
diff --git a/main/inc/lib/phpmailer/docs/DomainKeys_notes.txt b/main/inc/lib/phpmailer/docs/DomainKeys_notes.txt
new file mode 100644
index 0000000000..e12a16aa01
--- /dev/null
+++ b/main/inc/lib/phpmailer/docs/DomainKeys_notes.txt
@@ -0,0 +1,55 @@
+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
+
+ order allow,deny
+ deny from all
+
+
+# secure htkeypublic file
+
+ order allow,deny
+ deny from all
+
+
+(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
diff --git a/main/inc/lib/phpmailer/docs/Note_for_SMTP_debugging.txt b/main/inc/lib/phpmailer/docs/Note_for_SMTP_debugging.txt
new file mode 100644
index 0000000000..3c75660710
--- /dev/null
+++ b/main/inc/lib/phpmailer/docs/Note_for_SMTP_debugging.txt
@@ -0,0 +1,23 @@
+If you are having problems connecting or sending emails through your SMTP server, please note:
+
+1. The new rewrite of class.smtp.php provides more information about the processing/errors taking place
+2. Use the debug functionality of class.smtp.php. To do that, in your own script add the debug level you wish to use. An example of that is:
+
+$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 messages
+$mail->SMTPDebug = 2; ... will echo messages only
+... and finally, the options are 0, 1, and 2 ... any number greater than 2 will be interpreted as 2
+
+And finally, don't forget to disable debugging before going into production.
+
+Enjoy!
+Andy
\ No newline at end of file
diff --git a/main/inc/lib/phpmailer/docs/extending.html b/main/inc/lib/phpmailer/docs/extending.html
index 34f3720d34..f7c3200afc 100755
--- a/main/inc/lib/phpmailer/docs/extending.html
+++ b/main/inc/lib/phpmailer/docs/extending.html
@@ -1,148 +1,148 @@
-
-
-Examples using phpmailer
-
-
-
-
-
Examples using phpmailer
-
-
1. Advanced Example
-
-
-This demonstrates sending out multiple email messages with binary attachments
-from a MySQL database with multipart/alternative support.
-
-
-
-
-require("class.phpmailer.php");
-
-$mail = new phpmailer();
-
-$mail->From = "list@example.com";
-$mail->FromName = "List manager";
-$mail->Host = "smtp1.example.com;smtp2.example.com";
-$mail->Mailer = "smtp";
-
-@MYSQL_CONNECT("localhost","root","password");
-@mysql_select_db("my_company");
-$query� =�"SELECT full_name, email,�photo�FROM employee�WHERE�id=$id";
-$result�=�@MYSQL_QUERY($query);
-
-while ($row = mysql_fetch_array ($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();
-}
-
-
-
-
-
-
-
2. Extending phpmailer
-
-
-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. Plus, it is very
-easy to do. I've provided an example:
-
-
-Here's a class that extends the phpmailer class and sets the defaults
-for the particular site:
-PHP include file: mail.inc.php
-
-
-
-
-
-
-require("class.phpmailer.php");
-
-class my_phpmailer extends phpmailer {
- // Set default variables for all new objects
- var $From = "from@example.com";
- var $FromName = "Mailer";
- var $Host = "smtp1.example.com;smtp2.example.com";
- var $Mailer = "smtp"; // Alternative to IsSMTP()
- var $WordWrap = 75;
-
- // Replace the default error_handler
- function error_handler($msg) {
- print("My Site Error");
- print("Description:");
- printf("%s", $msg);
- exit;
- }
-
- // Create an additional function
- function do_something($something) {
- // Place your new code here
- }
-}
-
-
-
-
-
-Now here's a normal PHP page in the site, which will have all the defaults set
-above:
-Normal PHP file: mail_test.php
-
-
-
-
-
-
-require("mail.inc.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";
-
-
-
-
-
-
-
-
+
+
+Examples using phpmailer
+
+
+
+
+
Examples using phpmailer
+
+
1. Advanced Example
+
+
+This demonstrates sending out multiple email messages with binary attachments
+from a MySQL database with multipart/alternative support.
+
+
+
+
+require("class.phpmailer.php");
+
+$mail = new phpmailer();
+
+$mail->From = "list@example.com";
+$mail->FromName = "List manager";
+$mail->Host = "smtp1.example.com;smtp2.example.com";
+$mail->Mailer = "smtp";
+
+@MYSQL_CONNECT("localhost","root","password");
+@mysql_select_db("my_company");
+$query = "SELECT full_name, email, photo FROM employee WHERE id=$id";
+$result = @MYSQL_QUERY($query);
+
+while ($row = mysql_fetch_array ($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();
+}
+
+
+
+
+
+
+
2. Extending phpmailer
+
+
+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. Plus, it is very
+easy to do. I've provided an example:
+
+
+Here's a class that extends the phpmailer class and sets the defaults
+for the particular site:
+PHP include file: mail.inc.php
+
+
+
+
+
+
+require("class.phpmailer.php");
+
+class my_phpmailer extends phpmailer {
+ // Set default variables for all new objects
+ var $From = "from@example.com";
+ var $FromName = "Mailer";
+ var $Host = "smtp1.example.com;smtp2.example.com";
+ var $Mailer = "smtp"; // Alternative to IsSMTP()
+ var $WordWrap = 75;
+
+ // Replace the default error_handler
+ function error_handler($msg) {
+ print("My Site Error");
+ print("Description:");
+ printf("%s", $msg);
+ exit;
+ }
+
+ // Create an additional function
+ function do_something($something) {
+ // Place your new code here
+ }
+}
+
+
+
+
+
+Now here's a normal PHP page in the site, which will have all the defaults set
+above:
+Normal PHP file: mail_test.php
+
+
+
+
+
+
+require("mail.inc.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";
+
-
- This is a test of PHPMailer v2.0.0 rc1.
-
-This particular example uses HTML, with a <div> tag and inline
-styles.
-
-Also note the use of the PHPMailer at the top with no specific code to handle
-including it in the body of the email.
-
+
+
+
+
+ This is a test of PHPMailer.
+
+This particular example uses HTML, with a <div> tag and inline
+styles.
+
+Also note the use of the PHPMailer logo above with no specific code to handle
+including it.
+Included are two attachments:
+phpmailer.gif is an attachment and used inline as a graphic (above)
+phpmailer_mini.gif is an attachment
+
+PHPMailer:
+Author: Andy Prevost (codeworxtech@users.sourceforge.net)
+Author: Marcus Bointon (coolbru@users.sourceforge.net)
+
+
diff --git a/main/inc/lib/phpmailer/examples/images/bkgrnd.gif b/main/inc/lib/phpmailer/examples/images/bkgrnd.gif
deleted file mode 100755
index bc89624c05..0000000000
Binary files a/main/inc/lib/phpmailer/examples/images/bkgrnd.gif and /dev/null differ
diff --git a/main/inc/lib/phpmailer/examples/images/phpmailer.png b/main/inc/lib/phpmailer/examples/images/phpmailer.png
deleted file mode 100755
index abe0101f36..0000000000
Binary files a/main/inc/lib/phpmailer/examples/images/phpmailer.png and /dev/null differ
diff --git a/main/inc/lib/phpmailer/examples/index.html b/main/inc/lib/phpmailer/examples/index.html
index 3ac45d3be5..c81e35bcb0 100755
--- a/main/inc/lib/phpmailer/examples/index.html
+++ b/main/inc/lib/phpmailer/examples/index.html
@@ -1,73 +1,49 @@
-
The example file "test_mail.php" contents include:
-
-
-<?php
-
-include_once('../class.phpmailer.php');
-
-$mail = new PHPMailer();
-
-$body = $mail->getFile('contents.html');
-
-$body = eregi_replace("[\]",'',$body);
-$subject = eregi_replace("[\]",'',$subject);
-
-$mail->From = "name@yourdomain.com";
-$mail->FromName = "First Last";
-
-$mail->Subject = "PHPMailer Test Subject";
-
-$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
-
-$mail->MsgHTML($body);
-
-$mail->AddAddress("whoto@otherdomain.com", "John Doe");
-
-if(!$mail->Send()) {
- echo 'Failed to send mail';
-} else {
- echo 'Mail sent';
-}
-
-?>
-
-
-
-Although you could use full compabitility with PHPMailer 1.7.3, this example
-shows how to use the new features. If you view 'contents.html', you will note
-that there is a background image used in the <body tag as well as an image used
-with a regular <img tag. Here's what the HTML file looks like:
-
-
-
-<body background="images/bkgrnd.gif" style="margin: 0px;">
-<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
-<div align="center"><img src="images/phpmailer.gif" style="height: 90px; width: 340px"></div><br>
-<br>
- This is a test of PHPMailer v2.0.0 rc1.<br>
-<br>
-This particular example uses <strong>HTML</strong>, with a <div> tag and inline<br>
-styles.<br>
-<br>
-Also note the use of the PHPMailer at the top with no specific code to handle
-including it in the body of the email.</div>
-</body>
-
-
-
-A few things to notice in the PHP script that generates the email:
-
-
the use of $mail->AltBody is completely optional. If not used, PHPMailer
- will use the HTML text with htmlentities().
-
the background= and <img src= images were processed without any directives
- or methods from the PHP script
-
there is no specific code to define the image type ... that is handled
- automatically by PHPMailer when it parses the images
-
we are using a new class method '$mail->MsgHTML($body)' ... that is what will handle the parsing of the images and creating the AltBody text
-
-
Of course, you can still use PHPMailer the same way you have in the past.
-That provides full compatibility with all existing scripts, while new scripts
-can take advantage of the new features.
-
Modify test_mail.php now with your own email address and try it out.
-To see what the email SHOULD look like in your HTML compatible email viewer: click here
-
+This release of PHPMailer (v5.0.0) sets a new milestone in the development
+cycle of PHPMailer. First, class.phpmailer.php has a small footprint (65.7 Kb),
+while class.smtp.php is even smaller than before (at only 25.0 Kb).
+
+We have maintained all functionality and added Exception handling unique to
+PHP 5/6.
+
+There is only one function that has been removed: that is getFile(). The reason
+for this is that getFile() became a wrapper for the PHP function 'file_get_contents()'
+and nothing more. Rather than burden the class with a function already available
+in PHP, we decided to remove it.
+
+Our new Exception handling provides your own scripts far more power than ever.
+
+We have also enhanced the "packaging" of PHPMailer with an entirely new set of
+examples. Included are both basic and advanced examples showing how you can take
+advantage of PHP Exception handling to improve your own scripts.
+
+A few things to note about PHPMailer:
+
+
the use of $mail->AltBody is completely optional. If not used, PHPMailer
+ will use the HTML text with htmlentities().
+ We also highly recommend using HTML2Text authored by Jon Abernathy. The class description
+ and download can be viewed at: http://www.chuggnutt.com/html2text.php.
+
+
there is no specific code to define image or attachment types ... that is handled
+ automatically by PHPMailer when it parses the images
+
+A note to users that want to use SMTP with PHPMailer. The most common problems are:
+
+
wrong port ... most ISP (Internet Service Providers) will not allow relaying through
+ their servers. If that's the case with your ISP, try using port 26.
+
+
wrong authentication information (username and/or password) ... don't forget that
+ many servers require the account name to be in the format of the full email address.
+
+
... if these tips do not get your SMTP settings working, we have a debug mode
+ for helping you determine the problem. Insert this after $mail->IsSMTP();
+ $mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
+ note that a setting of 2 will display all errors and messages generated by the SMTP
+ server
+
-This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
-Package
-
-
-
-Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:
-
Interfaces (italic)
Classes
Exceptions
Errors
-
-
-Class/Interface
-
-
-
-Each class, interface, inner class and inner interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
-
Class inheritance diagram
Direct Subclasses
All Known Subinterfaces
All Known Implementing Classes
Class/interface declaration
Class/interface description
-
-
Inner Class Summary
Field Summary
Constructor Summary
Method Summary
-
-
Field Detail
Constructor Detail
Method Detail
-Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
-
-Tree (Class Hierarchy)
-
-There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
-
When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
-
-
-Deprecated API
-
-The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
-
-Index
-
-The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
-
-Prev/Next
-These links take you to the next or previous class, interface, package, or related page.
-Frames/No Frames
-These links show and hide the HTML frames. All pages are available with or without frames.
-
-
-Serialized Form
-Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
-
-
-
-This help file applies to API documentation generated using the standard doclet.
-
-
-
-This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
-
-Link to Non-frame version.