inc/phpmailer/language/phpmailer.lang-ca.php -text
inc/phpmailer/language/phpmailer.lang-cz.php -text
inc/phpmailer/language/phpmailer.lang-de.php -text
+inc/phpmailer/language/phpmailer.lang-de.zip -text
inc/phpmailer/language/phpmailer.lang-dk.php -text
inc/phpmailer/language/phpmailer.lang-en.php -text
inc/phpmailer/language/phpmailer.lang-es.php -text
// Current SVN revision
//define('CURR_SVN_REVISION', getActualVersion(0));
-define('CURR_SVN_REVISION', "814");
+define('CURR_SVN_REVISION', "815");
define('CURR_SVN_DATE' , getActualVersion(1));
define('CURR_SVN_VERSION' , getActualVersion(2));
ChangeLog
+Version 2.0.3 (November 08 2008)
+* fixed line 1041 in class.smtp.php (endless loop from missing = sign)
+* fixed duplicate images in email body
+* 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
+* corrected $basedir to $directory
+* 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
+* 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.0.2 (June 04 2008)
** NOTE: WE HAVE A NEW LANGUAGE VARIABLE FOR DIGITALLY SIGNED S/MIME EMAILS.
* 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.
+ 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.
* added ability to define path (mainly for embedded images)
function MsgHTML($message,$basedir='') ... where:
$basedir is the fully qualified path
* 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->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
Full Featured Email Transfer Class for PHP\r
==========================================\r
\r
+Version 2.3 (November 08, 2008)\r
+\r
+PHP4 continues to be a major platform for developers. We are responding\r
+to the emails received to continue development for PHP4 with this \r
+release.\r
+\r
+We have removed the /phpdoc from the downloads. All documentation is now on\r
+the http://phpmailer.codeworxtech.com website.\r
+\r
+For all other changes and notes, please see the changelog.\r
+\r
+Donations are accepted at PayPal with our id "paypal@worxteam.com".\r
+\r
+Version 2.2 (July 15 2008)\r
+\r
+- see the changelog.\r
+\r
Version 2.0.2 (June 04 2008)\r
\r
With this release, we are announcing that the development of PHPMailer for PHP5\r
good documentation and examples, and retain backward compatibility to level\r
1.7.3 standards.\r
\r
-If you are interested in helping out, visit http://sourceforge.net/phpmailer\r
+If you are interested in helping out, visit http://sourceforge.net/projects/phpmailer\r
and indicate your interest.\r
\r
**\r
/*~ class.phpmailer.php
.---------------------------------------------------------------------------.
| Software: PHPMailer - PHP email class |
-| Version: 2.0.2 |
+| Version: 2.0.3 |
| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
| Info: http://phpmailer.sourceforge.net |
| Support: http://sourceforge.net/projects/phpmailer/ |
* Holds PHPMailer version.
* @var string
*/
- var $Version = "2.0.2";
+ var $Version = "2.0.3";
/**
* Sets the email address that a reading confirmation will be sent.
var $boundary = array();
var $language = array();
var $error_count = 0;
- var $LE = "\n";
+ var $LE = "\r\n";
+ var $sign_cert_file = "";
var $sign_key_file = "";
var $sign_key_pass = "";
} elseif (file_exists($lang_path.'phpmailer.lang-en.php')) {
include($lang_path.'phpmailer.lang-en.php');
} else {
- $this->SetError('Could not load language file');
- return false;
+ $PHPMAILER_LANG = array();
+ $PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' .
+ $PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.';
+ $PHPMAILER_LANG["execute"] = 'Could not execute: ';
+ $PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.';
+ $PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.';
+ $PHPMAILER_LANG["from_failed"] = 'The following From address failed: ';
+ $PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' .
+ $PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.';
+ $PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host.';
+ $PHPMAILER_LANG["file_access"] = 'Could not access file: ';
+ $PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: ';
+ $PHPMAILER_LANG["encoding"] = 'Unknown encoding: ';
+ $PHPMAILER_LANG["signing"] = 'Signing Error: ';
}
$this->language = $PHPMAILER_LANG;
} elseif (count($this->cc) == 0) {
$result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
}
- if(count($this->cc) > 0) {
- $result .= $this->AddrAppend('Cc', $this->cc);
- }
}
$from = array();
fclose($fp);
$signed = tempnam("", "signed");
- if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_key_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) {
+ if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) {
$fp = fopen($signed, "r");
$result = fread($fp, filesize($this->sign_key_file));
+ $result = '';
+ while(!feof($fp)){
+ $result = $result . fread($fp, 1024);
+ }
fclose($fp);
} else {
$this->SetError($this->Lang("signing").openssl_error_string());
$cid = $this->attachment[$i][7];
$mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
- $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE);
+ $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE);
$mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
if($disposition == 'inline') {
$mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
}
- $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $name, $this->LE.$this->LE);
+ $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE);
/* Encode as string attachment */
if($bString) {
} // end of for
$output .= $newline.$eol;
} // end of while
- return trim($output);
+ return $output;
}
/**
$ext = $fileParts[1];
$mimeType = $this->_mime_types($ext);
if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
- if ( strlen($directory) > 1 && substr($basedir,-1) != '/') { $directory .= '/'; }
- $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType);
+ if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; }
if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
$message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
}
$this->Body = $message;
$textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
if ( !empty($textMsg) && empty($this->AltBody) ) {
- $this->AltBody = $textMsg;
+ $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";
*/
function _mime_types($ext = '') {
$mimes = array(
- 'hqx' => 'application/mac-binhex40',
- 'cpt' => 'application/mac-compactpro',
- 'doc' => 'application/msword',
+ 'ai' => 'application/postscript',
+ 'aif' => 'audio/x-aiff',
+ 'aifc' => 'audio/x-aiff',
+ 'aiff' => 'audio/x-aiff',
+ 'avi' => 'video/x-msvideo',
'bin' => 'application/macbinary',
- 'dms' => 'application/octet-stream',
- 'lha' => 'application/octet-stream',
- 'lzh' => 'application/octet-stream',
- 'exe' => 'application/octet-stream',
+ 'bmp' => 'image/bmp',
'class' => 'application/octet-stream',
- 'psd' => 'application/octet-stream',
- 'so' => 'application/octet-stream',
- 'sea' => 'application/octet-stream',
- 'dll' => 'application/octet-stream',
- 'oda' => 'application/oda',
- 'pdf' => 'application/pdf',
- 'ai' => 'application/postscript',
- 'eps' => 'application/postscript',
- 'ps' => 'application/postscript',
- 'smi' => 'application/smil',
- 'smil' => 'application/smil',
- 'mif' => 'application/vnd.mif',
- 'xls' => 'application/vnd.ms-excel',
- 'ppt' => 'application/vnd.ms-powerpoint',
- 'wbxml' => 'application/vnd.wap.wbxml',
- 'wmlc' => 'application/vnd.wap.wmlc',
+ 'cpt' => 'application/mac-compactpro',
+ 'css' => 'text/css',
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
- 'dxr' => 'application/x-director',
+ 'dll' => 'application/octet-stream',
+ 'dms' => 'application/octet-stream',
+ 'doc' => 'application/msword',
'dvi' => 'application/x-dvi',
+ 'dxr' => 'application/x-director',
+ 'eml' => 'message/rfc822',
+ 'eps' => 'application/postscript',
+ 'exe' => 'application/octet-stream',
+ 'gif' => 'image/gif',
'gtar' => 'application/x-gtar',
- 'php' => 'application/x-httpd-php',
- 'php4' => 'application/x-httpd-php',
- 'php3' => 'application/x-httpd-php',
- 'phtml' => 'application/x-httpd-php',
- 'phps' => 'application/x-httpd-php-source',
+ 'htm' => 'text/html',
+ 'html' => 'text/html',
+ 'jpe' => 'image/jpeg',
+ 'jpeg' => 'image/jpeg',
+ 'jpg' => 'image/jpeg',
+ 'hqx' => 'application/mac-binhex40',
'js' => 'application/x-javascript',
- 'swf' => 'application/x-shockwave-flash',
- 'sit' => 'application/x-stuffit',
- 'tar' => 'application/x-tar',
- 'tgz' => 'application/x-tar',
- 'xhtml' => 'application/xhtml+xml',
- 'xht' => 'application/xhtml+xml',
- 'zip' => 'application/zip',
+ 'lha' => 'application/octet-stream',
+ 'log' => 'text/plain',
+ 'lzh' => 'application/octet-stream',
'mid' => 'audio/midi',
'midi' => 'audio/midi',
- 'mpga' => 'audio/mpeg',
+ 'mif' => 'application/vnd.mif',
+ 'mov' => 'video/quicktime',
+ 'movie' => 'video/x-sgi-movie',
'mp2' => 'audio/mpeg',
'mp3' => 'audio/mpeg',
- 'aif' => 'audio/x-aiff',
- 'aiff' => 'audio/x-aiff',
- 'aifc' => 'audio/x-aiff',
+ 'mpe' => 'video/mpeg',
+ 'mpeg' => 'video/mpeg',
+ 'mpg' => 'video/mpeg',
+ 'mpga' => 'audio/mpeg',
+ 'oda' => 'application/oda',
+ 'pdf' => 'application/pdf',
+ 'php' => 'application/x-httpd-php',
+ 'php3' => 'application/x-httpd-php',
+ 'php4' => 'application/x-httpd-php',
+ 'phps' => 'application/x-httpd-php-source',
+ 'phtml' => 'application/x-httpd-php',
+ 'png' => 'image/png',
+ 'ppt' => 'application/vnd.ms-powerpoint',
+ 'ps' => 'application/postscript',
+ 'psd' => 'application/octet-stream',
+ 'qt' => 'video/quicktime',
+ 'ra' => 'audio/x-realaudio',
'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio',
'rpm' => 'audio/x-pn-realaudio-plugin',
- 'ra' => 'audio/x-realaudio',
+ 'rtf' => 'text/rtf',
+ 'rtx' => 'text/richtext',
'rv' => 'video/vnd.rn-realvideo',
- 'wav' => 'audio/x-wav',
- 'bmp' => 'image/bmp',
- 'gif' => 'image/gif',
- 'jpeg' => 'image/jpeg',
- 'jpg' => 'image/jpeg',
- 'jpe' => 'image/jpeg',
- 'png' => 'image/png',
- 'tiff' => 'image/tiff',
- 'tif' => 'image/tiff',
- 'css' => 'text/css',
- 'html' => 'text/html',
- 'htm' => 'text/html',
+ 'sea' => 'application/octet-stream',
'shtml' => 'text/html',
- 'txt' => 'text/plain',
+ 'sit' => 'application/x-stuffit',
+ 'so' => 'application/octet-stream',
+ 'smi' => 'application/smil',
+ 'smil' => 'application/smil',
+ 'swf' => 'application/x-shockwave-flash',
+ 'tar' => 'application/x-tar',
'text' => 'text/plain',
- 'log' => 'text/plain',
- 'rtx' => 'text/richtext',
- 'rtf' => 'text/rtf',
- 'xml' => 'text/xml',
- 'xsl' => 'text/xml',
- 'mpeg' => 'video/mpeg',
- 'mpg' => 'video/mpeg',
- 'mpe' => 'video/mpeg',
- 'qt' => 'video/quicktime',
- 'mov' => 'video/quicktime',
- 'avi' => 'video/x-msvideo',
- 'movie' => 'video/x-sgi-movie',
- 'doc' => 'application/msword',
+ 'txt' => 'text/plain',
+ 'tgz' => 'application/x-tar',
+ 'tif' => 'image/tiff',
+ 'tiff' => 'image/tiff',
+ 'wav' => 'audio/x-wav',
+ 'wbxml' => 'application/vnd.wap.wbxml',
+ 'wmlc' => 'application/vnd.wap.wmlc',
'word' => 'application/msword',
+ 'xht' => 'application/xhtml+xml',
+ 'xhtml' => 'application/xhtml+xml',
'xl' => 'application/excel',
- 'eml' => 'message/rfc822'
+ 'xls' => 'application/vnd.ms-excel',
+ 'xml' => 'text/xml',
+ 'xsl' => 'text/xml',
+ 'zip' => 'application/zip'
);
return ( ! isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
}
* @param string $key_filename Parameter File Name
* @param string $key_pass Password for private key
*/
- function Sign($key_filename, $key_pass) {
+ function Sign($cert_filename, $key_filename, $key_pass) {
+ $this->sign_cert_file = $cert_filename;
$this->sign_key_file = $key_filename;
$this->sign_key_pass = $key_pass;
}
}
-?>
+?>
\ No newline at end of file
/*~ class.pop3.php
.---------------------------------------------------------------------------.
| Software: PHPMailer - PHP email class |
-| Version: 2.0.2 |
+| Version: 2.0.3 |
| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
| Info: http://phpmailer.sourceforge.net |
| Support: http://sourceforge.net/projects/phpmailer/ |
/*~ class.smtp.php
.---------------------------------------------------------------------------.
| Software: PHPMailer - PHP email class |
-| Version: 2.0.2 |
+| Version: 2.0.3 |
| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
| Info: http://phpmailer.sourceforge.net |
| Support: http://sourceforge.net/projects/phpmailer/ |
*/
function get_lines() {
$data = "";
- while($str = @fgets($this->smtp_conn,515)) {
+ while($str == @fgets($this->smtp_conn,515)) {
if($this->do_debug >= 4) {
echo "SMTP -> get_lines(): \$data was \"$data\"" .
$this->CRLF;
-<html>
-<head>
-<style>
-body, p {
- font-family: Arial, Helvetica, sans-serif;
- font-size: 12px;
-}
-div.width {
- width: 500px;
- text-align: left;
-}
-</style>
-<script>
-<!--
-var popsite="http://phpmailer.codeworxtech.com"
-var withfeatures="width=960,height=760,scrollbars=1,resizable=1,toolbar=1,location=1,menubar=1,status=1,directories=0"
-var once_per_session=0
-function get_cookie(Name) {
- var search = Name + "="
- var returnvalue = "";
- if (document.cookie.length > 0) {
- offset = document.cookie.indexOf(search)
- if (offset != -1) { // if cookie exists
- offset += search.length
- // set index of beginning of value
- end = document.cookie.indexOf(";", offset);
- // set index of end of cookie value
- if (end == -1)
- end = document.cookie.length;
- returnvalue=unescape(document.cookie.substring(offset, end))
- }
- }
- return returnvalue;
-}
-function loadornot(){
- if (get_cookie('popsite')=='') {
- loadpopsite()
- document.cookie="popsite=yes"
- }
-}
-function loadpopsite(){
- win2=window.open(popsite,"",withfeatures)
- win2.blur()
- window.focus()
-}
-if (once_per_session==0) {
- loadpopsite()
-} else {
- loadornot()
-}
--->
-</script>
-</head>
-<body>
-<center>
-<div class="width">
-<hr>
-The http://phpmailer.codeworxtech.com/ website now carries a few
-advertisements through the Google Adsense network. Please visit
-the advertiser sites and help us offset some of our costs.<br />
-Thanks ....<br />
-<hr>
-<p><b>My name is Andy Prevost, AKA "codeworxtech".</b><br />
-<a href="http://www.codeworxtech.com">www.codeworxtech.com</a> for more information.<br />
-</p>
-<p><strong>WHY USE OUR TOOLS & WHAT'S IN IT FOR YOU?</strong></p>
-<p>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.</p>
-<p>Now, the introductions:</p>
-<p>Our company, <strong>Codeworx Technologies</strong>, 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, QuickCache, and QuickTabs) and now PHPMailer.
-We have staff and offices in the United States, Canada, Caribbean, the Middle
-East, and our primary development center in India. Our company is represented by
-agents and resellers globally.</p>
-<p><strong>Codeworx Technologies</strong> is at the forefront of developing PHP applications. Our staff are all Zend Certified university educated and experts at object oriented programming. While <strong>Codeworx Technologies</strong> 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.</p>
-<p>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.</p>
-<p>Our developer tools are all Open Source. Here's a brief description:</p>
-<ul>
- <li><span style="background-color: #FFFF00"><strong>PHPMailer</strong></span>. 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
- <a href="http://phpmailer.codeworxtech.com/">http://phpmailer.codeworxtech.com/</a>. <br />
- Please note: <strong>all of our focus is now on the PHPMailer for PHP5.</strong><br />
- <span style="background-color: #FFFF00">PS. While you are at it, please visit our sponsor's sites, click on their ads.
- It helps offset some of our costs.</span><br />
- 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.<br />
- <br />
- </li>
- <li><strong><span style="background-color: #FFFF00">QuickCache</span></strong>. 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
- <a href="http://quickcache.codeworxtech.com/">http://quickcache.codeworxtech.com/</a>.<br />
- <br />
- </li>
- <li><strong><span style="background-color: #FFFF00">QuickSkin</span></strong>. 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
- <a href="http://quickskin.codeworxtech.com/">http://quickskin.codeworxtech.com/</a>.<br />
- <br />
- </li>
- <li><strong><span style="background-color: #FFFF00">QuickTabs</span></strong>. If you read about the projects above, you'll get the sense that we are minimalists and that's pretty accurate. We prefer using tools that are small, efficient, and effective. We have no use for software bloat. QuickTabs came to life in several of our projects where we needed to display complex information in a simplified manner to users. It had to function something like a "wizard" interface, but with more flexibility to float from one item to another. We looked at various Ajax-based solutions, but found one annoying problem with Ajax - page reloads if switching between items (with corresponding data loss if changed by the customer). QuickTabs is our solution to this by presenting complex data in a Javascript show/hide div set. It's not a complex architecture, but it works! Visit the QuickTabs website at <a href="http://quicktabs.codeworxtech.com/">http://quicktabs.codeworxtech.com/</a>.</li>
-</ul>
-<p>We're committed to PHP and to the Open Source community.</p>
-<p>Opportunities with <strong>Codeworx Technologies</strong>:</p>
-<ul>
-<li><span style="background-color: #FFFF00">Resellers/Agents</span>: We're always interested in talking with companies that
-want to represent
-<strong>Codeworx Technologies</strong> in their markets. We also have private label programs for our commercial products (in certain circumstances).</li>
-<li>Programmers/Developers: We are usually fully staffed, however, if you would like to be considered for a career with
-<strong>Codeworx Technologies</strong>, we would be pleased to hear from you.<br />
-A few things to note:<br />
-<ul>
- <li>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</li>
- <li>if you contact us looking for employment, include a cover letter, indicate what type of work/career you are looking for and expected compensation</li>
- <li>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.</li>
- <li>any contact that ignores any of these points will be discarded</li>
-</ul></li>
-<li>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.</li>
-</ul>
-Regards,<br />
-Andy Prevost (aka, codeworxtech)<br />
-<a href="mailto:codeworxtech@users.sourceforge.net">codeworxtech@users.sourceforge.net</a><br />
-<br />
-</div>
-</center>
-</body>
-</html>
+<html>\r
+<head>\r
+<style>\r
+body, p {\r
+ font-family: Arial, Helvetica, sans-serif;\r
+ font-size: 12px;\r
+}\r
+div.width {\r
+ width: 500px;\r
+ text-align: left;\r
+}\r
+</style>\r
+<script>\r
+<!--\r
+var popsite="http://phpmailer.codeworxtech.com"\r
+var withfeatures="width=960,height=760,scrollbars=1,resizable=1,toolbar=1,location=1,menubar=1,status=1,directories=0"\r
+var once_per_session=0\r
+function get_cookie(Name) {\r
+ var search = Name + "="\r
+ var returnvalue = "";\r
+ if (document.cookie.length > 0) {\r
+ offset = document.cookie.indexOf(search)\r
+ if (offset != -1) { // if cookie exists\r
+ offset += search.length\r
+ // set index of beginning of value\r
+ end = document.cookie.indexOf(";", offset);\r
+ // set index of end of cookie value\r
+ if (end == -1)\r
+ end = document.cookie.length;\r
+ returnvalue=unescape(document.cookie.substring(offset, end))\r
+ }\r
+ }\r
+ return returnvalue;\r
+}\r
+function loadornot(){\r
+ if (get_cookie('popsite')=='') {\r
+ loadpopsite()\r
+ document.cookie="popsite=yes"\r
+ }\r
+}\r
+function loadpopsite(){\r
+ win2=window.open(popsite,"",withfeatures)\r
+ win2.blur()\r
+ window.focus()\r
+}\r
+if (once_per_session==0) {\r
+ loadpopsite()\r
+} else {\r
+ loadornot()\r
+}\r
+-->\r
+</script>\r
+</head>\r
+<body>\r
+<center>\r
+<div class="width">\r
+<hr>\r
+The http://phpmailer.codeworxtech.com/ website now carries a few\r
+advertisements through the Google Adsense network to help offset\r
+some of our costs.<br />\r
+Thanks ....<br />\r
+<hr>\r
+<p><b>My name is Andy Prevost, AKA "codeworxtech".</b><br />\r
+<a href="http://www.codeworxtech.com">www.codeworxtech.com</a> for more information.<br />\r
+</p>\r
+<p><strong>WHY USE OUR TOOLS & WHAT'S IN IT FOR YOU?</strong></p>\r
+<p>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.</p>\r
+<p>Now, the introductions:</p>\r
+<p>Our company, <strong>Worx International Inc.</strong>, 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.\r
+We have staff and offices in the United States, Caribbean, the Middle\r
+East, and our primary development center in Canada. Our company is represented by\r
+agents and resellers globally.</p>\r
+<p><strong>Worx International Inc.</strong> is at the forefront of developing PHP applications. Our staff are all Zend Certified university educated and experts at object oriented programming. While <strong>Worx International Inc.</strong> 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.</p>\r
+<p>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.</p>\r
+<p>Our developer tools are all Open Source. Here's a brief description:</p>\r
+<ul>\r
+ <li><span style="background-color: #FFFF00"><strong>PHPMailer</strong></span>. 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\r
+ <a href="http://phpmailer.codeworxtech.com/">http://phpmailer.codeworxtech.com/</a>. <br />\r
+ Please note: <strong>all of our focus is now on the PHPMailer for PHP5.</strong><br />\r
+ <span style="background-color: #FFFF00">PS. While you are at it, please visit our sponsor's sites, click on their ads.\r
+ It helps offset some of our costs.</span><br />\r
+ 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\r
+ exception/error handling with PHP 5's object oriented try/throw/catch mechanisms. If you are interested, let us know.<br />\r
+ <br />\r
+ </li>\r
+ <li><strong><span style="background-color: #FFFF00">QuickCache</span></strong>. 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\r
+ <a href="http://quickcache.codeworxtech.com/">http://quickcache.codeworxtech.com/</a>.<br />\r
+ <br />\r
+ </li>\r
+ <li><strong><span style="background-color: #FFFF00">QuickSkin</span></strong>. 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\r
+ <a href="http://quickskin.codeworxtech.com/">http://quickskin.codeworxtech.com/</a>.<br />\r
+ <br />\r
+ </li>\r
+</ul>\r
+<p>We're committed to PHP and to the Open Source community.</p>\r
+<p>Opportunities with <strong>Worx International Inc.</strong>:</p>\r
+<ul>\r
+<li><span style="background-color: #FFFF00">Resellers/Agents</span>: We're always interested in talking with companies that\r
+want to represent\r
+<strong>Worx International Inc.</strong> in their markets. We also have private label programs for our commercial products (in certain circumstances).</li>\r
+<li>Programmers/Developers: We are usually fully staffed, however, if you would like to be considered for a career with\r
+<strong>Worx International Inc.</strong>, we would be pleased to hear from you.<br />\r
+A few things to note:<br />\r
+<ul>\r
+ <li>experience level does not matter: from fresh out of college to multi-year experience - it's your\r
+ creative mind and a positive attitude we want</li>\r
+ <li>if you contact us looking for employment, include a cover letter, indicate what type of work/career you are looking for and expected compensation</li>\r
+ <li>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.</li>\r
+ <li>any contact that ignores any of these points will be discarded</li>\r
+</ul></li>\r
+<li>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.</li>\r
+</ul>\r
+Regards,<br />\r
+Andy Prevost (aka, codeworxtech)<br />\r
+<a href="mailto:codeworxtech@users.sourceforge.net">codeworxtech@users.sourceforge.net</a><br />\r
+<br />\r
+We now also offer website design. hosting, and remote forms processing. Visit <a href="http://www.worxstudio.com/" target="_blank">WorxStudio.com</a> for more information.<br />\r
+</div>\r
+</center>\r
+</body>\r
+</html>\r
-<html>
-<head>
-<title>Examples using phpmailer</title>
-</head>
-
-<body bgcolor="#FFFFFF">
-
-<h2>Examples using phpmailer</h2>
-
-<h3>1. Advanced Example</h3>
-<p>
-
-This demonstrates sending out multiple email messages with binary attachments
-from a MySQL database with multipart/alternative support.<p>
-<table cellpadding="4" border="1" width="80%">
-<tr>
-<td bgcolor="#CCCCCC">
-<pre>
-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();
-}
-</pre>
-</td>
-</tr>
-</table>
-<p>
-
-<h3>2. Extending phpmailer</h3>
-<p>
-
-Extending classes with inheritance is one of the most
-powerful features of object-oriented
-programming. It allows you to make changes to the
-original class for your
-own personal use without hacking the original
-classes. Plus, it is very
-easy to do. I've provided an example:
-
-<p>
-Here's a class that extends the phpmailer class and sets the defaults
-for the particular site:<br>
-PHP include file: <b>mail.inc.php</b>
-<p>
-
-<table cellpadding="4" border="1" width="80%">
-<tr>
-<td bgcolor="#CCCCCC">
-<pre>
-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
- }
-}
-</td>
-</tr>
-</table>
-<br>
-
-Now here's a normal PHP page in the site, which will have all the defaults set
-above:<br>
-Normal PHP file: <b>mail_test.php</b>
-<p>
-
-<table cellpadding="4" border="1" width="80%">
-<tr>
-<td bgcolor="#CCCCCC">
-<pre>
-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";
-</pre>
-</td>
-</tr>
-</table>
-</p>
-
-</body>
-</html>
+<html>\r
+<head>\r
+<title>Examples using phpmailer</title>\r
+</head>\r
+\r
+<body bgcolor="#FFFFFF">\r
+\r
+<h2>Examples using phpmailer</h2>\r
+\r
+<h3>1. Advanced Example</h3>\r
+<p>\r
+\r
+This demonstrates sending out multiple email messages with binary attachments\r
+from a MySQL database with multipart/alternative support.<p>\r
+<table cellpadding="4" border="1" width="80%">\r
+<tr>\r
+<td bgcolor="#CCCCCC">\r
+<pre>\r
+require("class.phpmailer.php");\r
+\r
+$mail = new phpmailer();\r
+\r
+$mail->From = "list@example.com";\r
+$mail->FromName = "List manager";\r
+$mail->Host = "smtp1.example.com;smtp2.example.com";\r
+$mail->Mailer = "smtp";\r
+\r
+@MYSQL_CONNECT("localhost","root","password");\r
+@mysql_select_db("my_company");\r
+$query = "SELECT full_name, email, photo FROM employee WHERE id=$id";\r
+$result = @MYSQL_QUERY($query);\r
+\r
+while ($row = mysql_fetch_array ($result))\r
+{\r
+ // HTML body\r
+ $body = "Hello <font size=\"4\">" . $row["full_name"] . "</font>, <p>";\r
+ $body .= "<i>Your</i> personal photograph to this message.<p>";\r
+ $body .= "Sincerely, <br>";\r
+ $body .= "phpmailer List manager";\r
+\r
+ // Plain text body (for mail clients that cannot read HTML)\r
+ $text_body = "Hello " . $row["full_name"] . ", \n\n";\r
+ $text_body .= "Your personal photograph to this message.\n\n";\r
+ $text_body .= "Sincerely, \n";\r
+ $text_body .= "phpmailer List manager";\r
+\r
+ $mail->Body = $body;\r
+ $mail->AltBody = $text_body;\r
+ $mail->AddAddress($row["email"], $row["full_name"]);\r
+ $mail->AddStringAttachment($row["photo"], "YourPhoto.jpg");\r
+\r
+ if(!$mail->Send())\r
+ echo "There has been a mail error sending to " . $row["email"] . "<br>";\r
+\r
+ // Clear all addresses and attachments for next loop\r
+ $mail->ClearAddresses();\r
+ $mail->ClearAttachments();\r
+}\r
+</pre>\r
+</td>\r
+</tr>\r
+</table>\r
+<p>\r
+\r
+<h3>2. Extending phpmailer</h3>\r
+<p>\r
+\r
+Extending classes with inheritance is one of the most\r
+powerful features of object-oriented\r
+programming. It allows you to make changes to the\r
+original class for your\r
+own personal use without hacking the original\r
+classes. Plus, it is very\r
+easy to do. I've provided an example:\r
+\r
+<p>\r
+Here's a class that extends the phpmailer class and sets the defaults\r
+for the particular site:<br>\r
+PHP include file: <b>mail.inc.php</b>\r
+<p>\r
+\r
+<table cellpadding="4" border="1" width="80%">\r
+<tr>\r
+<td bgcolor="#CCCCCC">\r
+<pre>\r
+require("class.phpmailer.php");\r
+\r
+class my_phpmailer extends phpmailer {\r
+ // Set default variables for all new objects\r
+ var $From = "from@example.com";\r
+ var $FromName = "Mailer";\r
+ var $Host = "smtp1.example.com;smtp2.example.com";\r
+ var $Mailer = "smtp"; // Alternative to IsSMTP()\r
+ var $WordWrap = 75;\r
+\r
+ // Replace the default error_handler\r
+ function error_handler($msg) {\r
+ print("My Site Error");\r
+ print("Description:");\r
+ printf("%s", $msg);\r
+ exit;\r
+ }\r
+\r
+ // Create an additional function\r
+ function do_something($something) {\r
+ // Place your new code here\r
+ }\r
+}\r
+</td>\r
+</tr>\r
+</table>\r
+<br>\r
+\r
+Now here's a normal PHP page in the site, which will have all the defaults set\r
+above:<br>\r
+Normal PHP file: <b>mail_test.php</b>\r
+<p>\r
+\r
+<table cellpadding="4" border="1" width="80%">\r
+<tr>\r
+<td bgcolor="#CCCCCC">\r
+<pre>\r
+require("mail.inc.php");\r
+\r
+// Instantiate your new class\r
+$mail = new my_phpmailer;\r
+\r
+// Now you only need to add the necessary stuff\r
+$mail->AddAddress("josh@example.com", "Josh Adams");\r
+$mail->Subject = "Here is the subject";\r
+$mail->Body = "This is the message body";\r
+$mail->AddAttachment("c:/temp/11-10-00.zip", "new_name.zip"); // optional name\r
+\r
+if(!$mail->Send())\r
+{\r
+ echo "There was an error sending the message";\r
+ exit;\r
+}\r
+\r
+echo "Message was sent successfully";\r
+</pre>\r
+</td>\r
+</tr>\r
+</table>\r
+</p>\r
+\r
+</body>\r
+</html>\r
-This is built for PHP Mailer 1.72 and was not tested with any previous version. It was developed under PHP 4.3.11 (E_ALL). It works under PHP 5 and 5.1 with E_ALL, but not in Strict mode due to var deprecation (but then neither does PHP Mailer either!). It follows the RFC 1939 standard explicitly and is fully commented.
-
-With that noted, here is how to implement it:
-Install the class file
-
-I didn't want to modify the PHP Mailer classes at all, so you will have to include/require this class along with the base one. It can sit quite happily in the phpmailer-1.72 directory:
-[geshi lang=php] require 'phpmailer-1.72/class.phpmailer.php'; require 'phpmailer-1.72/class.pop3.php'; [/geshi]
-When you need it, create your POP3 object
-
-Right before I invoke PHP Mailer I activate the POP3 authorisation. POP3 before SMTP is a process whereby you login to your web hosts POP3 mail server BEFORE sending out any emails via SMTP. The POP3 logon 'verifies' your ability to send email by SMTP, which typically otherwise blocks you. On my web host (Pair Networks) a single POP3 logon is enough to 'verify' you for 90 minutes. Here is some sample PHP code that activates the POP3 logon and then sends an email via PHP Mailer:
-[geshi lang=php] Authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1); $mail = new PHPMailer(); $mail->SMTPDebug = 2; $mail->IsSMTP(); $mail->IsHTML(false); $mail->Host = 'relay.example.com'; $mail->From = 'mailer@example.com'; $mail->FromName = 'Example Mailer'; $mail->Subject = 'My subject'; $mail->Body = 'Hello world'; $mail->AddAddress('rich@corephp.co.uk', 'Richard Davey'); if (!$mail->Send()) { echo $mail->ErrorInfo; } ?> [/geshi]
-
-The PHP Mailer parts of this code should be obvious to anyone who has used PHP Mailer before. One thing to note - you almost certainly will not need to use SMTP Authentication *and* POP3 before SMTP together. The Authorisation method is a proxy method to all of the others within that class. There are Connect, Logon and Disconnect methods available, but I wrapped them in the single Authorisation one to make things easier.
-The Parameters
-
-The Authorise parameters are as follows:
-[geshi lang=php]$pop->Authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1);[/geshi]
-
- 1. pop3.example.com - The POP3 Mail Server Name (hostname or IP address)
- 2. 110 - The POP3 Port on which to connect (default is usually 110, but check with your host)
- 3. 30 - A connection time-out value (in seconds)
- 4. mailer - The POP3 Username required to logon
- 5. password - The POP3 Password required to logon
- 6. 1 - The class debug level (0 = off, 1+ = debug output is echoed to the browser)
-
-Final Comments + the Download
-
-1) This class does not support APOP connections. This is only because I did not have an APOP server to test with, but if you'd like to see that added just contact me.
-
-2) Opening and closing lots of POP3 connections can be quite a resource/network drain. If you need to send a whole batch of emails then just perform the authentication once at the start, and then loop through your mail sending script. Providing this process doesn't take longer than the verification period lasts on your POP3 server, you should be fine. With my host that period is 90 minutes, i.e. plenty of time.
-
-3) If you have heavy requirements for this script (i.e. send a LOT of email on a frequent basis) then I would advise seeking out an alternative sending method (direct SMTP ideally). If this isn't possible then you could modify this class so the 'last authorised' date is recorded somewhere (MySQL, Flat file, etc) meaning you only open a new connection if the old one has expired, saving you precious overhead.
-
-4) There are lots of other POP3 classes for PHP available. However most of them implement the full POP3 command set, where-as this one is purely for authentication, and much lighter as a result. However using any of the other POP3 classes to just logon to your server would have the same net result. At the end of the day, use whatever method you feel most comfortable with.
-Download
-
-Here is the full class file plus my test script: POP_before_SMTP_PHPMailer.zip (4 KB) - Please note that it does not include PHPMailer itself.
-
-My thanks to Chris Ryan for the inspiration (even if indirectly, via his SMTP class)
+This is built for PHP Mailer 1.72 and was not tested with any previous version. It was developed under PHP 4.3.11 (E_ALL). It works under PHP 5 and 5.1 with E_ALL, but not in Strict mode due to var deprecation (but then neither does PHP Mailer either!). It follows the RFC 1939 standard explicitly and is fully commented.\r
+\r
+With that noted, here is how to implement it:\r
+Install the class file\r
+\r
+I didn't want to modify the PHP Mailer classes at all, so you will have to include/require this class along with the base one. It can sit quite happily in the phpmailer-1.72 directory:\r
+[geshi lang=php] require 'phpmailer-1.72/class.phpmailer.php'; require 'phpmailer-1.72/class.pop3.php'; [/geshi]\r
+When you need it, create your POP3 object\r
+\r
+Right before I invoke PHP Mailer I activate the POP3 authorisation. POP3 before SMTP is a process whereby you login to your web hosts POP3 mail server BEFORE sending out any emails via SMTP. The POP3 logon 'verifies' your ability to send email by SMTP, which typically otherwise blocks you. On my web host (Pair Networks) a single POP3 logon is enough to 'verify' you for 90 minutes. Here is some sample PHP code that activates the POP3 logon and then sends an email via PHP Mailer:\r
+[geshi lang=php] Authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1); $mail = new PHPMailer(); $mail->SMTPDebug = 2; $mail->IsSMTP(); $mail->IsHTML(false); $mail->Host = 'relay.example.com'; $mail->From = 'mailer@example.com'; $mail->FromName = 'Example Mailer'; $mail->Subject = 'My subject'; $mail->Body = 'Hello world'; $mail->AddAddress('rich@corephp.co.uk', 'Richard Davey'); if (!$mail->Send()) { echo $mail->ErrorInfo; } ?> [/geshi]\r
+\r
+The PHP Mailer parts of this code should be obvious to anyone who has used PHP Mailer before. One thing to note - you almost certainly will not need to use SMTP Authentication *and* POP3 before SMTP together. The Authorisation method is a proxy method to all of the others within that class. There are Connect, Logon and Disconnect methods available, but I wrapped them in the single Authorisation one to make things easier.\r
+The Parameters\r
+\r
+The Authorise parameters are as follows:\r
+[geshi lang=php]$pop->Authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1);[/geshi]\r
+\r
+ 1. pop3.example.com - The POP3 Mail Server Name (hostname or IP address)\r
+ 2. 110 - The POP3 Port on which to connect (default is usually 110, but check with your host)\r
+ 3. 30 - A connection time-out value (in seconds)\r
+ 4. mailer - The POP3 Username required to logon\r
+ 5. password - The POP3 Password required to logon\r
+ 6. 1 - The class debug level (0 = off, 1+ = debug output is echoed to the browser)\r
+\r
+Final Comments + the Download\r
+\r
+1) This class does not support APOP connections. This is only because I did not have an APOP server to test with, but if you'd like to see that added just contact me.\r
+\r
+2) Opening and closing lots of POP3 connections can be quite a resource/network drain. If you need to send a whole batch of emails then just perform the authentication once at the start, and then loop through your mail sending script. Providing this process doesn't take longer than the verification period lasts on your POP3 server, you should be fine. With my host that period is 90 minutes, i.e. plenty of time.\r
+\r
+3) If you have heavy requirements for this script (i.e. send a LOT of email on a frequent basis) then I would advise seeking out an alternative sending method (direct SMTP ideally). If this isn't possible then you could modify this class so the 'last authorised' date is recorded somewhere (MySQL, Flat file, etc) meaning you only open a new connection if the old one has expired, saving you precious overhead.\r
+\r
+4) There are lots of other POP3 classes for PHP available. However most of them implement the full POP3 command set, where-as this one is purely for authentication, and much lighter as a result. However using any of the other POP3 classes to just logon to your server would have the same net result. At the end of the day, use whatever method you feel most comfortable with.\r
+Download\r
+\r
+Here is the full class file plus my test script: POP_before_SMTP_PHPMailer.zip (4 KB) - Please note that it does not include PHPMailer itself.\r
+\r
+My thanks to Chris Ryan for the inspiration (even if indirectly, via his SMTP class)\r
-<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>
+<body background="images/bkgrnd.gif" style="margin: 0px;">\r
+<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">\r
+<div align="center"><img src="images/phpmailer.gif" style="height: 90px; width: 340px"></div><br>\r
+<br>\r
+ This is a test of PHPMailer v2.0.0 rc1.<br>\r
+<br>\r
+This particular example uses <strong>HTML</strong>, with a <div> tag and inline<br>\r
+styles.<br>\r
+<br>\r
+Also note the use of the PHPMailer at the top with no specific code to handle\r
+including it in the body of the email.</div>\r
+</body>\r
-<html>
-<head>
-<title>POP before SMTP Test</title>
-</head>
-
-<body>
-
-<pre>
-<?php
- require 'class.phpmailer.php';
- require 'class.pop3.php';
-
- $pop = new POP3();
- $pop->Authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1);
-
- $mail = new PHPMailer();
-
- $mail->IsSMTP();
- $mail->SMTPDebug = 2;
- $mail->IsHTML(false);
-
- $mail->Host = 'relay.example.com';
-
- $mail->From = 'mailer@example.com';
- $mail->FromName = 'Example Mailer';
-
- $mail->Subject = 'My subject';
- $mail->Body = 'Hello world';
- $mail->AddAddress('name@anydomain.com', 'First Last');
-
- if (!$mail->Send())
- {
- echo $mail->ErrorInfo;
- }
-?>
-</pre>
-
-</body>
-</html>
+<html>\r
+<head>\r
+<title>POP before SMTP Test</title>\r
+</head>\r
+\r
+<body>\r
+\r
+<pre>\r
+<?php\r
+ require 'class.phpmailer.php';\r
+ require 'class.pop3.php';\r
+\r
+ $pop = new POP3();\r
+ $pop->Authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1);\r
+\r
+ $mail = new PHPMailer();\r
+\r
+ $mail->IsSMTP();\r
+ $mail->SMTPDebug = 2;\r
+ $mail->IsHTML(false);\r
+\r
+ $mail->Host = 'relay.example.com';\r
+\r
+ $mail->From = 'mailer@example.com';\r
+ $mail->FromName = 'Example Mailer';\r
+\r
+ $mail->Subject = 'My subject';\r
+ $mail->Body = 'Hello world';\r
+ $mail->AddAddress('name@anydomain.com', 'First Last');\r
+\r
+ if (!$mail->Send())\r
+ {\r
+ echo $mail->ErrorInfo;\r
+ }\r
+?>\r
+</pre>\r
+\r
+</body>\r
+</html>\r
$PHPMAILER_LANG["encoding"] = 'Codificação desconhecida: ';
$PHPMAILER_LANG["signing"] = 'Signing Error: ';
-?>
-
+?>
\ No newline at end of file
$PHPMAILER_LANG["encoding"] = 'Codificació desconeguda: ';
$PHPMAILER_LANG["signing"] = 'Signing Error: ';
-?>
+?>
\ No newline at end of file
$PHPMAILER_LANG["encoding"] = 'Neznámé kódování: ';
$PHPMAILER_LANG["signing"] = 'Signing Error: ';
-?>
+?>
\ No newline at end of file
/**
* PHPMailer language file.
* German Version
+ * Thanks to Yann-Patrick Schlame for the latest update!
*/
$PHPMAILER_LANG = array();
$PHPMAILER_LANG["file_access"] = 'Zugriff auf folgende Datei fehlgeschlagen: ';
$PHPMAILER_LANG["file_open"] = 'Datei Fehler: konnte folgende Datei nicht öffnen: ';
$PHPMAILER_LANG["encoding"] = 'Unbekanntes Encoding-Format: ';
-$PHPMAILER_LANG["signing"] = 'Signing Error: ';
-
-?>
+$PHPMAILER_LANG["signing"] = 'Fehler beim Signieren: ';
+?>
\ No newline at end of file
/**
* PHPMailer language file.
* Danish Version
- * Author: Mikael Stokkebro <info@stokkebro.dk>
- */
+ * Author: Mikael Stokkebro <info@stokkebro.dk?> */
$PHPMAILER_LANG = array();
$PHPMAILER_LANG["encoding"] = 'Ukendt encode-format: ';
$PHPMAILER_LANG["signing"] = 'Signing Error: ';
-?>
+?>
\ No newline at end of file
$PHPMAILER_LANG["encoding"] = 'Unknown encoding: ';
$PHPMAILER_LANG["signing"] = 'Signing Error: ';
-?>
+?>
\ No newline at end of file
$PHPMAILER_LANG["encoding"] = 'Codificación desconocida: ';
$PHPMAILER_LANG["signing"] = 'Error al firmar: ';
-?>
+?>
\ No newline at end of file
$PHPMAILER_LANG["encoding"] = 'Tundmatu Unknown kodeering: ';
$PHPMAILER_LANG["signing"] = 'Signing Error: ';
-?>
+?>
\ No newline at end of file
$PHPMAILER_LANG["encoding"] = 'Tuntematon koodaustyyppi: ';
$PHPMAILER_LANG["signing"] = 'Signing Error: ';
-?>
+?>
\ No newline at end of file
$PHPMAILER_LANG["encoding"] = 'Ókend encoding: ';
$PHPMAILER_LANG["signing"] = 'Signing Error: ';
-?>
+?>
\ No newline at end of file
$PHPMAILER_LANG["encoding"] = 'Encodage inconnu : ';
$PHPMAILER_LANG["signing"] = 'Signing Error: ';
-?>
-
+?>
\ No newline at end of file
$PHPMAILER_LANG["encoding"] = 'Ismeretlen kódolás: ';
$PHPMAILER_LANG["signing"] = 'Signing Error: ';
-?>
+?>
\ No newline at end of file
* PHPMailer language file.
* Italian version
* @package PHPMailer
-* @author Ilias Bartolini <brain79@inwind.it>
-*/
+* @author Ilias Bartolini <brain79@inwind.it?>*/
$PHPMAILER_LANG = array();
$PHPMAILER_LANG["encoding"] = 'Encoding set dei caratteri sconosciuto: ';
$PHPMAILER_LANG["signing"] = 'Signing Error: ';
-?>
+?>
\ No newline at end of file
$PHPMAILER_LANG["encoding"] = 'Onbekende codering: ';
$PHPMAILER_LANG["signing"] = 'Signing Error: ';
-?>
+?>
\ No newline at end of file
$PHPMAILER_LANG["encoding"] = 'Ukjent encoding: ';
$PHPMAILER_LANG["signing"] = 'Signing Error: ';
-?>
+?>
\ No newline at end of file
$PHPMAILER_LANG["encoding"] = 'Nieznany sposób kodowania znaków: ';
$PHPMAILER_LANG["signing"] = 'Signing Error: ';
-?>
+?>
\ No newline at end of file
* PHPMailer language file.
* Romanian Version
* @package PHPMailer
- * @author Catalin Constantin <catalin@dazoot.ro>
- */
+ * @author Catalin Constantin <catalin@dazoot.ro?> */
$PHPMAILER_LANG = array();
$PHPMAILER_LANG["encoding"] = 'Encodare necunoscuta: ';
$PHPMAILER_LANG["signing"] = 'Signing Error: ';
-?>
+?>
\ No newline at end of file
<?php
/**
* PHPMailer language file.
- * Russian Version by Alexey Chumakov <alex@chumakov.ru>
- */
+ * Russian Version by Alexey Chumakov <alex@chumakov.ru?> */
$PHPMAILER_LANG = array();
$PHPMAILER_LANG["encoding"] = 'Íåèçâåñòíûé âèä êîäèðîâêè: ';
$PHPMAILER_LANG["signing"] = 'Signing Error: ';
-?>
-
+?>
\ No newline at end of file
/**
* PHPMailer language file.
* Swedish Version
- * Author: Johan Linnér <johan@linner.biz>
- */
+ * Author: Johan Linnér <johan@linner.biz?> */
$PHPMAILER_LANG = array();
$PHPMAILER_LANG["encoding"] = 'Okänt encode-format: ';
$PHPMAILER_LANG["signing"] = 'Signing Error: ';
-?>
+?>
\ No newline at end of file
$PHPMAILER_LANG["encoding"] = 'Bilinmeyen þifreleme: ';
$PHPMAILER_LANG["signing"] = 'Signing Error: ';
-?>
+?>
\ No newline at end of file
-<?php
-/*******************
- Unit Test
- Type: phpmailer class
-********************/
-
-$INCLUDE_DIR = "../";
-
-require("phpunit.php");
-require($INCLUDE_DIR . "class.phpmailer.php");
-error_reporting(E_ALL);
-
-/**
- * Performs authentication tests
- */
-class phpmailerTest extends TestCase
-{
- /**
- * Holds the default phpmailer instance.
- * @private
- * @type object
- */
- var $Mail = false;
-
- /**
- * Holds the SMTP mail host.
- * @public
- * @type string
- */
- var $Host = "";
-
- /**
- * Holds the change log.
- * @private
- * @type string array
- */
- var $ChangeLog = array();
-
- /**
- * Holds the note log.
- * @private
- * @type string array
- */
- var $NoteLog = array();
-
- /**
- * Class constuctor.
- */
- function phpmailerTest($name) {
- /* must define this constructor */
- $this->TestCase( $name );
- }
-
- /**
- * Run before each test is started.
- */
- function setUp() {
- global $global_vars;
- global $INCLUDE_DIR;
-
- $this->Mail = new PHPMailer();
-
- $this->Mail->Priority = 3;
- $this->Mail->Encoding = "8bit";
- $this->Mail->CharSet = "iso-8859-1";
- $this->Mail->From = "unit_test@phpmailer.sf.net";
- $this->Mail->FromName = "Unit Tester";
- $this->Mail->Sender = "";
- $this->Mail->Subject = "Unit Test";
- $this->Mail->Body = "";
- $this->Mail->AltBody = "";
- $this->Mail->WordWrap = 0;
- $this->Mail->Host = $global_vars["mail_host"];
- $this->Mail->Port = 25;
- $this->Mail->Helo = "localhost.localdomain";
- $this->Mail->SMTPAuth = false;
- $this->Mail->Username = "";
- $this->Mail->Password = "";
- $this->Mail->PluginDir = $INCLUDE_DIR;
- $this->Mail->AddReplyTo("no_reply@phpmailer.sf.net", "Reply Guy");
- $this->Mail->Sender = "unit_test@phpmailer.sf.net";
-
- if(strlen($this->Mail->Host) > 0)
- $this->Mail->Mailer = "smtp";
- else
- {
- $this->Mail->Mailer = "mail";
- $this->Sender = "unit_test@phpmailer.sf.net";
- }
-
- global $global_vars;
- $this->SetAddress($global_vars["mail_to"], "Test User");
- if(strlen($global_vars["mail_cc"]) > 0)
- $this->SetAddress($global_vars["mail_cc"], "Carbon User", "cc");
- }
-
- /**
- * Run after each test is completed.
- */
- function tearDown() {
- // Clean global variables
- $this->Mail = NULL;
- $this->ChangeLog = array();
- $this->NoteLog = array();
- }
-
-
- /**
- * Build the body of the message in the appropriate format.
- * @private
- * @returns void
- */
- function BuildBody() {
- $this->CheckChanges();
-
- // Determine line endings for message
- if($this->Mail->ContentType == "text/html" || strlen($this->Mail->AltBody) > 0)
- {
- $eol = "<br/>";
- $bullet = "<li>";
- $bullet_start = "<ul>";
- $bullet_end = "</ul>";
- }
- else
- {
- $eol = "\n";
- $bullet = " - ";
- $bullet_start = "";
- $bullet_end = "";
- }
-
- $ReportBody = "";
-
- $ReportBody .= "---------------------" . $eol;
- $ReportBody .= "Unit Test Information" . $eol;
- $ReportBody .= "---------------------" . $eol;
- $ReportBody .= "phpmailer version: " . $this->Mail->Version . $eol;
- $ReportBody .= "Content Type: " . $this->Mail->ContentType . $eol;
-
- if(strlen($this->Mail->Host) > 0)
- $ReportBody .= "Host: " . $this->Mail->Host . $eol;
-
- // If attachments then create an attachment list
- if(count($this->Mail->attachment) > 0)
- {
- $ReportBody .= "Attachments:" . $eol;
- $ReportBody .= $bullet_start;
- for($i = 0; $i < count($this->Mail->attachment); $i++)
- {
- $ReportBody .= $bullet . "Name: " . $this->Mail->attachment[$i][1] . ", ";
- $ReportBody .= "Encoding: " . $this->Mail->attachment[$i][3] . ", ";
- $ReportBody .= "Type: " . $this->Mail->attachment[$i][4] . $eol;
- }
- $ReportBody .= $bullet_end . $eol;
- }
-
- // If there are changes then list them
- if(count($this->ChangeLog) > 0)
- {
- $ReportBody .= "Changes" . $eol;
- $ReportBody .= "-------" . $eol;
-
- $ReportBody .= $bullet_start;
- for($i = 0; $i < count($this->ChangeLog); $i++)
- {
- $ReportBody .= $bullet . $this->ChangeLog[$i][0] . " was changed to [" .
- $this->ChangeLog[$i][1] . "]" . $eol;
- }
- $ReportBody .= $bullet_end . $eol . $eol;
- }
-
- // If there are notes then list them
- if(count($this->NoteLog) > 0)
- {
- $ReportBody .= "Notes" . $eol;
- $ReportBody .= "-----" . $eol;
-
- $ReportBody .= $bullet_start;
- for($i = 0; $i < count($this->NoteLog); $i++)
- {
- $ReportBody .= $bullet . $this->NoteLog[$i] . $eol;
- }
- $ReportBody .= $bullet_end;
- }
-
- // Re-attach the original body
- $this->Mail->Body .= $eol . $eol . $ReportBody;
- }
-
- /**
- * Check which default settings have been changed for the report.
- * @private
- * @returns void
- */
- function CheckChanges() {
- if($this->Mail->Priority != 3)
- $this->AddChange("Priority", $this->Mail->Priority);
- if($this->Mail->Encoding != "8bit")
- $this->AddChange("Encoding", $this->Mail->Encoding);
- if($this->Mail->CharSet != "iso-8859-1")
- $this->AddChange("CharSet", $this->Mail->CharSet);
- if($this->Mail->Sender != '')
- $this->AddChange("Sender", $this->Mail->Sender);
- if($this->Mail->WordWrap != 0)
- $this->AddChange("WordWrap", $this->Mail->WordWrap);
- if($this->Mail->Mailer != "mail")
- $this->AddChange("Mailer", $this->Mail->Mailer);
- if($this->Mail->Port != 25)
- $this->AddChange("Port", $this->Mail->Port);
- if($this->Mail->Helo != "localhost.localdomain")
- $this->AddChange("Helo", $this->Mail->Helo);
- if($this->Mail->SMTPAuth)
- $this->AddChange("SMTPAuth", "true");
- }
-
- /**
- * Adds a change entry.
- * @private
- * @returns void
- */
- function AddChange($sName, $sNewValue) {
- $cur = count($this->ChangeLog);
- $this->ChangeLog[$cur][0] = $sName;
- $this->ChangeLog[$cur][1] = $sNewValue;
- }
-
- /**
- * Adds a simple note to the message.
- * @public
- * @returns void
- */
- function AddNote($sValue) {
- $this->NoteLog[] = $sValue;
- }
-
- /**
- * Adds all of the addresses
- * @public
- * @returns void
- */
- function SetAddress($sAddress, $sName = "", $sType = "to") {
- switch($sType)
- {
- case "to":
- $this->Mail->AddAddress($sAddress, $sName);
- break;
- case "cc":
- $this->Mail->AddCC($sAddress, $sName);
- break;
- case "bcc":
- $this->Mail->AddBCC($sAddress, $sName);
- break;
- }
- }
-
- /////////////////////////////////////////////////
- // UNIT TESTS
- /////////////////////////////////////////////////
-
- /**
- * Try a plain message.
- */
- function test_WordWrap() {
-
- $this->Mail->WordWrap = 40;
- $my_body = "Here is the main body of this message. It should " .
- "be quite a few lines. It should be wrapped at the " .
- "40 characters. Make sure that it is.";
- $nBodyLen = strlen($my_body);
- $my_body .= "\n\nThis is the above body length: " . $nBodyLen;
-
- $this->Mail->Body = $my_body;
- $this->Mail->Subject .= ": Wordwrap";
-
- $this->BuildBody();
- $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Try a plain message.
- */
- function test_Low_Priority() {
-
- $this->Mail->Priority = 5;
- $this->Mail->Body = "Here is the main body. There should be " .
- "a reply to address in this message.";
- $this->Mail->Subject .= ": Low Priority";
- $this->Mail->AddReplyTo("nobody@nobody.com", "Nobody (Unit Test)");
-
- $this->BuildBody();
- $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Simple plain file attachment test.
- */
- function test_Multiple_Plain_FileAttachment() {
-
- $this->Mail->Body = "Here is the text body";
- $this->Mail->Subject .= ": Plain + Multiple FileAttachments";
-
- if(!$this->Mail->AddAttachment("test.png"))
- {
- $this->assert(false, $this->Mail->ErrorInfo);
- return;
- }
-
- if(!$this->Mail->AddAttachment("phpmailer_test.php", "test.txt"))
- {
- $this->assert(false, $this->Mail->ErrorInfo);
- return;
- }
-
- $this->BuildBody();
- $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Simple plain string attachment test.
- */
- function test_Plain_StringAttachment() {
-
- $this->Mail->Body = "Here is the text body";
- $this->Mail->Subject .= ": Plain + StringAttachment";
-
- $sAttachment = "These characters are the content of the " .
- "string attachment.\nThis might be taken from a ".
- "database or some other such thing. ";
-
- $this->Mail->AddStringAttachment($sAttachment, "string_attach.txt");
-
- $this->BuildBody();
- $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Plain quoted-printable message.
- */
- function test_Quoted_Printable() {
-
- $this->Mail->Body = "Here is the main body";
- $this->Mail->Subject .= ": Plain + Quoted-printable";
- $this->Mail->Encoding = "quoted-printable";
-
- $this->BuildBody();
- $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Try a plain message.
- */
- function test_Html() {
-
- $this->Mail->IsHTML(true);
- $this->Mail->Subject .= ": HTML only";
-
- $this->Mail->Body = "This is a <b>test message</b> written in HTML. </br>" .
- "Go to <a href=\"http://phpmailer.sourceforge.net/\">" .
- "http://phpmailer.sourceforge.net/</a> for new versions of " .
- "phpmailer. <p/> Thank you!";
-
- $this->BuildBody();
- $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Simple HTML and attachment test
- */
- function test_HTML_Attachment() {
-
- $this->Mail->Body = "This is the <b>HTML</b> part of the email.";
- $this->Mail->Subject .= ": HTML + Attachment";
- $this->Mail->IsHTML(true);
-
- if(!$this->Mail->AddAttachment("phpmailer_test.php", "test_attach.txt"))
- {
- $this->assert(false, $this->Mail->ErrorInfo);
- return;
- }
-
- $this->BuildBody();
- $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * An embedded attachment test.
- */
- function test_Embedded_Image() {
-
- $this->Mail->Body = "Embedded Image: <img alt=\"phpmailer\" src=\"cid:my-attach\">" .
- "Here is an image!</a>";
- $this->Mail->Subject .= ": Embedded Image";
- $this->Mail->IsHTML(true);
-
- if(!$this->Mail->AddEmbeddedImage("test.png", "my-attach", "test.png",
- "base64", "image/png"))
- {
- $this->assert(false, $this->Mail->ErrorInfo);
- return;
- }
-
- $this->BuildBody();
- $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * An embedded attachment test.
- */
- function test_Multi_Embedded_Image() {
-
- $this->Mail->Body = "Embedded Image: <img alt=\"phpmailer\" src=\"cid:my-attach\">" .
- "Here is an image!</a>";
- $this->Mail->Subject .= ": Embedded Image + Attachment";
- $this->Mail->IsHTML(true);
-
- if(!$this->Mail->AddEmbeddedImage("test.png", "my-attach", "test.png",
- "base64", "image/png"))
- {
- $this->assert(false, $this->Mail->ErrorInfo);
- return;
- }
-
- if(!$this->Mail->AddAttachment("phpmailer_test.php", "test.txt"))
- {
- $this->assert(false, $this->Mail->ErrorInfo);
- return;
- }
-
- $this->BuildBody();
- $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Simple multipart/alternative test.
- */
- function test_AltBody() {
-
- $this->Mail->Body = "This is the <b>HTML</b> part of the email.";
- $this->Mail->AltBody = "Here is the text body of this message. " .
- "It should be quite a few lines. It should be wrapped at the " .
- "40 characters. Make sure that it is.";
- $this->Mail->WordWrap = 40;
- $this->AddNote("This is a mulipart alternative email");
- $this->Mail->Subject .= ": AltBody + Word Wrap";
-
- $this->BuildBody();
- $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
- }
-
- /**
- * Simple HTML and attachment test
- */
- function test_AltBody_Attachment() {
-
- $this->Mail->Body = "This is the <b>HTML</b> part of the email.";
- $this->Mail->AltBody = "This is the text part of the email.";
- $this->Mail->Subject .= ": AltBody + Attachment";
- $this->Mail->IsHTML(true);
-
- if(!$this->Mail->AddAttachment("phpmailer_test.php", "test_attach.txt"))
- {
- $this->assert(false, $this->Mail->ErrorInfo);
- return;
- }
-
- $this->BuildBody();
- $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
-
- $fp = fopen("message.txt", "w");
- fwrite($fp, $this->Mail->CreateHeader() . $this->Mail->CreateBody());
- fclose($fp);
- }
-
- function test_MultipleSend() {
- $this->Mail->Body = "Sending two messages without keepalive";
- $this->BuildBody();
- $subject = $this->Mail->Subject;
-
- $this->Mail->Subject = $subject . ": SMTP 1";
- $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
-
- $this->Mail->Subject = $subject . ": SMTP 2";
- $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
- }
-
- function test_SmtpKeepAlive() {
- $this->Mail->Body = "This was done using the SMTP keep-alive.";
- $this->BuildBody();
- $subject = $this->Mail->Subject;
-
- $this->Mail->SMTPKeepAlive = true;
- $this->Mail->Subject = $subject . ": SMTP keep-alive 1";
- $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
-
- $this->Mail->Subject = $subject . ": SMTP keep-alive 2";
- $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
- $this->Mail->SmtpClose();
- }
-
- /**
- * Tests this denial of service attack:
- * http://www.cybsec.com/vuln/PHPMailer-DOS.pdf
- */
- function test_DenialOfServiceAttack() {
- $this->Mail->Body = "This should no longer cause a denial of service.";
- $this->BuildBody();
-
- $this->Mail->Subject = str_repeat("A", 998);
- $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
- }
-
- function test_Error() {
- $this->Mail->Subject .= ": This should be sent";
- $this->BuildBody();
- $this->Mail->ClearAllRecipients(); // no addresses should cause an error
- $this->assert($this->Mail->IsError() == false, "Error found");
- $this->assert($this->Mail->Send() == false, "Send succeeded");
- $this->assert($this->Mail->IsError(), "No error found");
- $this->assertEquals('You must provide at least one ' .
- 'recipient email address.', $this->Mail->ErrorInfo);
- $this->Mail->AddAddress(get("mail_to"));
- $this->assert($this->Mail->Send(), "Send failed");
- }
-}
-
-/**
- * Create and run test instance.
- */
-
-if(isset($HTTP_GET_VARS))
- $global_vars = $HTTP_GET_VARS;
-else
- $global_vars = $_REQUEST;
-
-if(isset($global_vars["submitted"]))
-{
- echo "Test results:<br>";
- $suite = new TestSuite( "phpmailerTest" );
-
- $testRunner = new TestRunner;
- $testRunner->run($suite);
- echo "<hr noshade/>";
-}
-
-function get($sName) {
- global $global_vars;
- if(isset($global_vars[$sName]))
- return $global_vars[$sName];
- else
- return "";
-}
-
-?>
-
-<html>
-<body>
-<h3>phpmailer Unit Test</h3>
-By entering a SMTP hostname it will automatically perform tests with SMTP.
-
-<form name="phpmailer_unit" action="phpmailer_test.php" method="get">
-<input type="hidden" name="submitted" value="1"/>
-To Address: <input type="text" size="50" name="mail_to" value="<?php echo get("mail_to"); ?>"/>
-<br/>
-Cc Address: <input type="text" size="50" name="mail_cc" value="<?php echo get("mail_cc"); ?>"/>
-<br/>
-SMTP Hostname: <input type="text" size="50" name="mail_host" value="<?php echo get("mail_host"); ?>"/>
-<p/>
-<input type="submit" value="Run Test"/>
-
-</form>
-</body>
-</html>
+<?php\r
+/*******************\r
+ Unit Test\r
+ Type: phpmailer class\r
+********************/\r
+\r
+$INCLUDE_DIR = "../";\r
+\r
+require("phpunit.php");\r
+require($INCLUDE_DIR . "class.phpmailer.php");\r
+error_reporting(E_ALL);\r
+\r
+/**\r
+ * Performs authentication tests\r
+ */\r
+class phpmailerTest extends TestCase\r
+{\r
+ /**\r
+ * Holds the default phpmailer instance.\r
+ * @private\r
+ * @type object\r
+ */\r
+ var $Mail = false;\r
+\r
+ /**\r
+ * Holds the SMTP mail host.\r
+ * @public\r
+ * @type string\r
+ */\r
+ var $Host = "";\r
+ \r
+ /**\r
+ * Holds the change log.\r
+ * @private\r
+ * @type string array\r
+ */\r
+ var $ChangeLog = array();\r
+ \r
+ /**\r
+ * Holds the note log.\r
+ * @private\r
+ * @type string array\r
+ */\r
+ var $NoteLog = array(); \r
+\r
+ /**\r
+ * Class constuctor.\r
+ */\r
+ function phpmailerTest($name) {\r
+ /* must define this constructor */\r
+ $this->TestCase( $name );\r
+ }\r
+ \r
+ /**\r
+ * Run before each test is started.\r
+ */\r
+ function setUp() {\r
+ global $global_vars;\r
+ global $INCLUDE_DIR;\r
+\r
+ $this->Mail = new PHPMailer();\r
+\r
+ $this->Mail->Priority = 3;\r
+ $this->Mail->Encoding = "8bit";\r
+ $this->Mail->CharSet = "iso-8859-1";\r
+ $this->Mail->From = "unit_test@phpmailer.sf.net";\r
+ $this->Mail->FromName = "Unit Tester";\r
+ $this->Mail->Sender = "";\r
+ $this->Mail->Subject = "Unit Test";\r
+ $this->Mail->Body = "";\r
+ $this->Mail->AltBody = "";\r
+ $this->Mail->WordWrap = 0;\r
+ $this->Mail->Host = $global_vars["mail_host"];\r
+ $this->Mail->Port = 25;\r
+ $this->Mail->Helo = "localhost.localdomain";\r
+ $this->Mail->SMTPAuth = false;\r
+ $this->Mail->Username = "";\r
+ $this->Mail->Password = "";\r
+ $this->Mail->PluginDir = $INCLUDE_DIR;\r
+ $this->Mail->AddReplyTo("no_reply@phpmailer.sf.net", "Reply Guy");\r
+ $this->Mail->Sender = "unit_test@phpmailer.sf.net";\r
+\r
+ if(strlen($this->Mail->Host) > 0)\r
+ $this->Mail->Mailer = "smtp";\r
+ else\r
+ {\r
+ $this->Mail->Mailer = "mail";\r
+ $this->Sender = "unit_test@phpmailer.sf.net";\r
+ }\r
+ \r
+ global $global_vars;\r
+ $this->SetAddress($global_vars["mail_to"], "Test User");\r
+ if(strlen($global_vars["mail_cc"]) > 0)\r
+ $this->SetAddress($global_vars["mail_cc"], "Carbon User", "cc");\r
+ } \r
+\r
+ /**\r
+ * Run after each test is completed.\r
+ */\r
+ function tearDown() {\r
+ // Clean global variables\r
+ $this->Mail = NULL;\r
+ $this->ChangeLog = array();\r
+ $this->NoteLog = array();\r
+ }\r
+\r
+\r
+ /**\r
+ * Build the body of the message in the appropriate format.\r
+ * @private\r
+ * @returns void\r
+ */\r
+ function BuildBody() {\r
+ $this->CheckChanges();\r
+ \r
+ // Determine line endings for message \r
+ if($this->Mail->ContentType == "text/html" || strlen($this->Mail->AltBody) > 0)\r
+ {\r
+ $eol = "<br/>";\r
+ $bullet = "<li>";\r
+ $bullet_start = "<ul>";\r
+ $bullet_end = "</ul>";\r
+ }\r
+ else\r
+ {\r
+ $eol = "\n";\r
+ $bullet = " - ";\r
+ $bullet_start = "";\r
+ $bullet_end = "";\r
+ }\r
+ \r
+ $ReportBody = "";\r
+ \r
+ $ReportBody .= "---------------------" . $eol;\r
+ $ReportBody .= "Unit Test Information" . $eol;\r
+ $ReportBody .= "---------------------" . $eol;\r
+ $ReportBody .= "phpmailer version: " . $this->Mail->Version . $eol;\r
+ $ReportBody .= "Content Type: " . $this->Mail->ContentType . $eol;\r
+ \r
+ if(strlen($this->Mail->Host) > 0)\r
+ $ReportBody .= "Host: " . $this->Mail->Host . $eol;\r
+ \r
+ // If attachments then create an attachment list\r
+ if(count($this->Mail->attachment) > 0)\r
+ {\r
+ $ReportBody .= "Attachments:" . $eol;\r
+ $ReportBody .= $bullet_start;\r
+ for($i = 0; $i < count($this->Mail->attachment); $i++)\r
+ {\r
+ $ReportBody .= $bullet . "Name: " . $this->Mail->attachment[$i][1] . ", ";\r
+ $ReportBody .= "Encoding: " . $this->Mail->attachment[$i][3] . ", ";\r
+ $ReportBody .= "Type: " . $this->Mail->attachment[$i][4] . $eol;\r
+ }\r
+ $ReportBody .= $bullet_end . $eol;\r
+ }\r
+ \r
+ // If there are changes then list them\r
+ if(count($this->ChangeLog) > 0)\r
+ {\r
+ $ReportBody .= "Changes" . $eol;\r
+ $ReportBody .= "-------" . $eol;\r
+\r
+ $ReportBody .= $bullet_start;\r
+ for($i = 0; $i < count($this->ChangeLog); $i++)\r
+ {\r
+ $ReportBody .= $bullet . $this->ChangeLog[$i][0] . " was changed to [" . \r
+ $this->ChangeLog[$i][1] . "]" . $eol;\r
+ }\r
+ $ReportBody .= $bullet_end . $eol . $eol;\r
+ }\r
+ \r
+ // If there are notes then list them\r
+ if(count($this->NoteLog) > 0)\r
+ {\r
+ $ReportBody .= "Notes" . $eol;\r
+ $ReportBody .= "-----" . $eol;\r
+\r
+ $ReportBody .= $bullet_start;\r
+ for($i = 0; $i < count($this->NoteLog); $i++)\r
+ {\r
+ $ReportBody .= $bullet . $this->NoteLog[$i] . $eol;\r
+ }\r
+ $ReportBody .= $bullet_end;\r
+ }\r
+ \r
+ // Re-attach the original body\r
+ $this->Mail->Body .= $eol . $eol . $ReportBody;\r
+ }\r
+ \r
+ /**\r
+ * Check which default settings have been changed for the report.\r
+ * @private\r
+ * @returns void\r
+ */\r
+ function CheckChanges() {\r
+ if($this->Mail->Priority != 3)\r
+ $this->AddChange("Priority", $this->Mail->Priority);\r
+ if($this->Mail->Encoding != "8bit")\r
+ $this->AddChange("Encoding", $this->Mail->Encoding);\r
+ if($this->Mail->CharSet != "iso-8859-1")\r
+ $this->AddChange("CharSet", $this->Mail->CharSet);\r
+ if($this->Mail->Sender != "")\r
+ $this->AddChange("Sender", $this->Mail->Sender);\r
+ if($this->Mail->WordWrap != 0)\r
+ $this->AddChange("WordWrap", $this->Mail->WordWrap);\r
+ if($this->Mail->Mailer != "mail")\r
+ $this->AddChange("Mailer", $this->Mail->Mailer);\r
+ if($this->Mail->Port != 25)\r
+ $this->AddChange("Port", $this->Mail->Port);\r
+ if($this->Mail->Helo != "localhost.localdomain")\r
+ $this->AddChange("Helo", $this->Mail->Helo);\r
+ if($this->Mail->SMTPAuth)\r
+ $this->AddChange("SMTPAuth", "true");\r
+ }\r
+ \r
+ /**\r
+ * Adds a change entry.\r
+ * @private\r
+ * @returns void\r
+ */\r
+ function AddChange($sName, $sNewValue) {\r
+ $cur = count($this->ChangeLog);\r
+ $this->ChangeLog[$cur][0] = $sName;\r
+ $this->ChangeLog[$cur][1] = $sNewValue;\r
+ }\r
+ \r
+ /**\r
+ * Adds a simple note to the message.\r
+ * @public\r
+ * @returns void\r
+ */\r
+ function AddNote($sValue) {\r
+ $this->NoteLog[] = $sValue;\r
+ }\r
+\r
+ /**\r
+ * Adds all of the addresses\r
+ * @public\r
+ * @returns void\r
+ */\r
+ function SetAddress($sAddress, $sName = "", $sType = "to") {\r
+ switch($sType)\r
+ {\r
+ case "to":\r
+ $this->Mail->AddAddress($sAddress, $sName);\r
+ break;\r
+ case "cc":\r
+ $this->Mail->AddCC($sAddress, $sName);\r
+ break;\r
+ case "bcc":\r
+ $this->Mail->AddBCC($sAddress, $sName);\r
+ break;\r
+ }\r
+ }\r
+\r
+ /////////////////////////////////////////////////\r
+ // UNIT TESTS\r
+ /////////////////////////////////////////////////\r
+\r
+ /**\r
+ * Try a plain message.\r
+ */\r
+ function test_WordWrap() {\r
+\r
+ $this->Mail->WordWrap = 40;\r
+ $my_body = "Here is the main body of this message. It should " .\r
+ "be quite a few lines. It should be wrapped at the " .\r
+ "40 characters. Make sure that it is.";\r
+ $nBodyLen = strlen($my_body);\r
+ $my_body .= "\n\nThis is the above body length: " . $nBodyLen;\r
+\r
+ $this->Mail->Body = $my_body;\r
+ $this->Mail->Subject .= ": Wordwrap";\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * Try a plain message.\r
+ */\r
+ function test_Low_Priority() {\r
+ \r
+ $this->Mail->Priority = 5;\r
+ $this->Mail->Body = "Here is the main body. There should be " .\r
+ "a reply to address in this message.";\r
+ $this->Mail->Subject .= ": Low Priority";\r
+ $this->Mail->AddReplyTo("nobody@nobody.com", "Nobody (Unit Test)");\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * Simple plain file attachment test.\r
+ */\r
+ function test_Multiple_Plain_FileAttachment() {\r
+\r
+ $this->Mail->Body = "Here is the text body";\r
+ $this->Mail->Subject .= ": Plain + Multiple FileAttachments";\r
+\r
+ if(!$this->Mail->AddAttachment("test.png"))\r
+ {\r
+ $this->assert(false, $this->Mail->ErrorInfo);\r
+ return;\r
+ }\r
+\r
+ if(!$this->Mail->AddAttachment("phpmailer_test.php", "test.txt"))\r
+ {\r
+ $this->assert(false, $this->Mail->ErrorInfo);\r
+ return;\r
+ }\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * Simple plain string attachment test.\r
+ */\r
+ function test_Plain_StringAttachment() {\r
+\r
+ $this->Mail->Body = "Here is the text body";\r
+ $this->Mail->Subject .= ": Plain + StringAttachment";\r
+ \r
+ $sAttachment = "These characters are the content of the " .\r
+ "string attachment.\nThis might be taken from a ".\r
+ "database or some other such thing. ";\r
+ \r
+ $this->Mail->AddStringAttachment($sAttachment, "string_attach.txt");\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * Plain quoted-printable message.\r
+ */\r
+ function test_Quoted_Printable() {\r
+\r
+ $this->Mail->Body = "Here is the main body";\r
+ $this->Mail->Subject .= ": Plain + Quoted-printable";\r
+ $this->Mail->Encoding = "quoted-printable";\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * Try a plain message.\r
+ */\r
+ function test_Html() {\r
+ \r
+ $this->Mail->IsHTML(true);\r
+ $this->Mail->Subject .= ": HTML only";\r
+ \r
+ $this->Mail->Body = "This is a <b>test message</b> written in HTML. </br>" .\r
+ "Go to <a href=\"http://phpmailer.sourceforge.net/\">" .\r
+ "http://phpmailer.sourceforge.net/</a> for new versions of " .\r
+ "phpmailer. <p/> Thank you!";\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * Simple HTML and attachment test\r
+ */\r
+ function test_HTML_Attachment() {\r
+\r
+ $this->Mail->Body = "This is the <b>HTML</b> part of the email.";\r
+ $this->Mail->Subject .= ": HTML + Attachment";\r
+ $this->Mail->IsHTML(true);\r
+ \r
+ if(!$this->Mail->AddAttachment("phpmailer_test.php", "test_attach.txt"))\r
+ {\r
+ $this->assert(false, $this->Mail->ErrorInfo);\r
+ return;\r
+ }\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * An embedded attachment test.\r
+ */\r
+ function test_Embedded_Image() {\r
+\r
+ $this->Mail->Body = "Embedded Image: <img alt=\"phpmailer\" src=\"cid:my-attach\">" .\r
+ "Here is an image!</a>";\r
+ $this->Mail->Subject .= ": Embedded Image";\r
+ $this->Mail->IsHTML(true);\r
+ \r
+ if(!$this->Mail->AddEmbeddedImage("test.png", "my-attach", "test.png",\r
+ "base64", "image/png"))\r
+ {\r
+ $this->assert(false, $this->Mail->ErrorInfo);\r
+ return;\r
+ }\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * An embedded attachment test.\r
+ */\r
+ function test_Multi_Embedded_Image() {\r
+\r
+ $this->Mail->Body = "Embedded Image: <img alt=\"phpmailer\" src=\"cid:my-attach\">" .\r
+ "Here is an image!</a>";\r
+ $this->Mail->Subject .= ": Embedded Image + Attachment";\r
+ $this->Mail->IsHTML(true);\r
+ \r
+ if(!$this->Mail->AddEmbeddedImage("test.png", "my-attach", "test.png",\r
+ "base64", "image/png"))\r
+ {\r
+ $this->assert(false, $this->Mail->ErrorInfo);\r
+ return;\r
+ }\r
+\r
+ if(!$this->Mail->AddAttachment("phpmailer_test.php", "test.txt"))\r
+ {\r
+ $this->assert(false, $this->Mail->ErrorInfo);\r
+ return;\r
+ }\r
+ \r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * Simple multipart/alternative test.\r
+ */\r
+ function test_AltBody() {\r
+\r
+ $this->Mail->Body = "This is the <b>HTML</b> part of the email.";\r
+ $this->Mail->AltBody = "Here is the text body of this message. " .\r
+ "It should be quite a few lines. It should be wrapped at the " .\r
+ "40 characters. Make sure that it is.";\r
+ $this->Mail->WordWrap = 40;\r
+ $this->AddNote("This is a mulipart alternative email");\r
+ $this->Mail->Subject .= ": AltBody + Word Wrap";\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * Simple HTML and attachment test\r
+ */\r
+ function test_AltBody_Attachment() {\r
+\r
+ $this->Mail->Body = "This is the <b>HTML</b> part of the email.";\r
+ $this->Mail->AltBody = "This is the text part of the email.";\r
+ $this->Mail->Subject .= ": AltBody + Attachment";\r
+ $this->Mail->IsHTML(true);\r
+ \r
+ if(!$this->Mail->AddAttachment("phpmailer_test.php", "test_attach.txt"))\r
+ {\r
+ $this->assert(false, $this->Mail->ErrorInfo);\r
+ return;\r
+ }\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+\r
+ $fp = fopen("message.txt", "w");\r
+ fwrite($fp, $this->Mail->CreateHeader() . $this->Mail->CreateBody());\r
+ fclose($fp);\r
+ } \r
+\r
+ function test_MultipleSend() {\r
+ $this->Mail->Body = "Sending two messages without keepalive";\r
+ $this->BuildBody();\r
+ $subject = $this->Mail->Subject;\r
+\r
+ $this->Mail->Subject = $subject . ": SMTP 1";\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ \r
+ $this->Mail->Subject = $subject . ": SMTP 2";\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ function test_SmtpKeepAlive() {\r
+ $this->Mail->Body = "This was done using the SMTP keep-alive.";\r
+ $this->BuildBody();\r
+ $subject = $this->Mail->Subject;\r
+\r
+ $this->Mail->SMTPKeepAlive = true;\r
+ $this->Mail->Subject = $subject . ": SMTP keep-alive 1";\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ \r
+ $this->Mail->Subject = $subject . ": SMTP keep-alive 2";\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ $this->Mail->SmtpClose();\r
+ }\r
+ \r
+ /**\r
+ * Tests this denial of service attack: \r
+ * http://www.cybsec.com/vuln/PHPMailer-DOS.pdf\r
+ */\r
+ function test_DenialOfServiceAttack() {\r
+ $this->Mail->Body = "This should no longer cause a denial of service.";\r
+ $this->BuildBody();\r
+ \r
+ $this->Mail->Subject = str_repeat("A", 998);\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+ \r
+ function test_Error() {\r
+ $this->Mail->Subject .= ": This should be sent"; \r
+ $this->BuildBody();\r
+ $this->Mail->ClearAllRecipients(); // no addresses should cause an error\r
+ $this->assert($this->Mail->IsError() == false, "Error found");\r
+ $this->assert($this->Mail->Send() == false, "Send succeeded");\r
+ $this->assert($this->Mail->IsError(), "No error found");\r
+ $this->assertEquals('You must provide at least one ' .\r
+ 'recipient email address.', $this->Mail->ErrorInfo);\r
+ $this->Mail->AddAddress(get("mail_to"));\r
+ $this->assert($this->Mail->Send(), "Send failed");\r
+ }\r
+} \r
+ \r
+/**\r
+ * Create and run test instance.\r
+ */\r
+ \r
+if(isset($HTTP_GET_VARS))\r
+ $global_vars = $HTTP_GET_VARS;\r
+else\r
+ $global_vars = $_REQUEST;\r
+\r
+if(isset($global_vars["submitted"]))\r
+{\r
+ echo "Test results:<br>";\r
+ $suite = new TestSuite( "phpmailerTest" );\r
+ \r
+ $testRunner = new TestRunner;\r
+ $testRunner->run($suite);\r
+ echo "<hr noshade/>";\r
+}\r
+\r
+function get($sName) {\r
+ global $global_vars;\r
+ if(isset($global_vars[$sName]))\r
+ return $global_vars[$sName];\r
+ else\r
+ return "";\r
+}\r
+\r
+?>\r
+\r
+<html>\r
+<body>\r
+<h3>phpmailer Unit Test</h3>\r
+By entering a SMTP hostname it will automatically perform tests with SMTP.\r
+\r
+<form name="phpmailer_unit" action="phpmailer_test.php" method="get">\r
+<input type="hidden" name="submitted" value="1"/>\r
+To Address: <input type="text" size="50" name="mail_to" value="<?php echo get("mail_to"); ?>"/>\r
+<br/>\r
+Cc Address: <input type="text" size="50" name="mail_cc" value="<?php echo get("mail_cc"); ?>"/>\r
+<br/>\r
+SMTP Hostname: <input type="text" size="50" name="mail_host" value="<?php echo get("mail_host"); ?>"/>\r
+<p/>\r
+<input type="submit" value="Run Test"/>\r
+\r
+</form>\r
+</body>\r
+</html>\r
-<?php
-//
-// PHP framework for testing, based on the design of "JUnit".
-//
-// Written by Fred Yankowski <fred@ontosys.com>
-// OntoSys, Inc <http://www.OntoSys.com>
-//
-// $Id: phpunit.php,v 1.1 2002/03/30 19:32:17 bmatzelle Exp $
-
-// Copyright (c) 2000 Fred Yankowski
-
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use, copy,
-// modify, merge, publish, distribute, sublicense, and/or sell copies
-// of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
-//
-error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE |
- E_CORE_ERROR | E_CORE_WARNING);
-
-/*
-interface Test {
- function run(&$aTestResult);
- function countTestCases();
-}
-*/
-
-function trace($msg) {
- return;
- print($msg);
- flush();
-}
-
-
-class Exception {
- /* Emulate a Java exception, sort of... */
- var $message;
- function Exception($message) {
- $this->message = $message;
- }
- function getMessage() {
- return $this->message;
- }
-}
-
-class Assert {
- function assert($boolean, $message=0) {
- if (! $boolean)
- $this->fail($message);
- }
-
- function assertEquals($expected, $actual, $message=0) {
- if ($expected != $actual) {
- $this->failNotEquals($expected, $actual, "expected", $message);
- }
- }
-
- function assertRegexp($regexp, $actual, $message=false) {
- if (! preg_match($regexp, $actual)) {
- $this->failNotEquals($regexp, $actual, "pattern", $message);
- }
- }
-
- function failNotEquals($expected, $actual, $expected_label, $message=0) {
- // Private function for reporting failure to match.
- $str = $message ? ($message . ' ') : "";
- $str .= "($expected_label/actual)<br>";
- $htmlExpected = htmlspecialchars($expected);
- $htmlActual = htmlspecialchars($actual);
- $str .= sprintf("<pre>%s\n--------\n%s</pre>",
- $htmlExpected, $htmlActual);
- $this->fail($str);
- }
-}
-
-class TestCase extends Assert /* implements Test */ {
- /* Defines context for running tests. Specific context -- such as
- instance variables, global variables, global state -- is defined
- by creating a subclass that specializes the setUp() and
- tearDown() methods. A specific test is defined by a subclass
- that specializes the runTest() method. */
- var $fName;
- var $fResult;
- var $fExceptions = array();
-
- function TestCase($name) {
- $this->fName = $name;
- }
-
- function run($testResult=0) {
- /* Run this single test, by calling the run() method of the
- TestResult object which will in turn call the runBare() method
- of this object. That complication allows the TestResult object
- to do various kinds of progress reporting as it invokes each
- test. Create/obtain a TestResult object if none was passed in.
- Note that if a TestResult object was passed in, it must be by
- reference. */
- if (! $testResult)
- $testResult = $this->_createResult();
- $this->fResult = $testResult;
- $testResult->run(&$this);
- $this->fResult = 0;
- return $testResult;
- }
-
- function countTestCases() {
- return 1;
- }
-
- function runTest() {
- $name = $this->name();
- // Since isset($this->$name) is false, no way to run defensive checks
- $this->$name();
- }
-
- function setUp() /* expect override */ {
- //print("TestCase::setUp()<br>\n");
- }
-
- function tearDown() /* possible override */ {
- //print("TestCase::tearDown()<br>\n");
- }
-
- ////////////////////////////////////////////////////////////////
-
-
- function _createResult() /* protected */ {
- /* override this to use specialized subclass of TestResult */
- return new TestResult;
- }
-
- function fail($message=0) {
- //printf("TestCase::fail(%s)<br>\n", ($message) ? $message : "");
- /* JUnit throws AssertionFailedError here. We just record the
- failure and carry on */
- $this->fExceptions[] = new Exception(&$message);
- }
-
- function error($message) {
- /* report error that requires correction in the test script
- itself, or (heaven forbid) in this testing infrastructure */
- printf('<b>ERROR: ' . $message . '</b><br>');
- $this->fResult->stop();
- }
-
- function failed() {
- return count($this->fExceptions);
- }
-
- function getExceptions() {
- return $this->fExceptions;
- }
-
- function name() {
- return $this->fName;
- }
-
- function runBare() {
- $this->setup();
- $this->runTest();
- $this->tearDown();
- }
-}
-
-
-class TestSuite /* implements Test */ {
- /* Compose a set of Tests (instances of TestCase or TestSuite), and
- run them all. */
- var $fTests = array();
-
- function TestSuite($classname=false) {
- if ($classname) {
- // Find all methods of the given class whose name starts with
- // "test" and add them to the test suite. We are just _barely_
- // able to do this with PHP's limited introspection... Note
- // that PHP seems to store method names in lower case, and we
- // have to avoid the constructor function for the TestCase class
- // superclass. This will fail when $classname starts with
- // "Test" since that will have a constructor method that will
- // get matched below and then treated (incorrectly) as a test
- // method. So don't name any TestCase subclasses as "Test..."!
- if (floor(phpversion()) >= 4) {
- // PHP4 introspection, submitted by Dylan Kuhn
- $names = get_class_methods($classname);
- while (list($key, $method) = each($names)) {
- if (preg_match('/^test/', $method) && $method != "testcase") {
- $this->addTest(new $classname($method));
- }
- }
- }
- else {
- $dummy = new $classname("dummy");
- $names = (array) $dummy;
- while (list($key, $value) = each($names)) {
- $type = gettype($value);
- if ($type == "user function" && preg_match('/^test/', $key)
- && $key != "testcase") {
- $this->addTest(new $classname($key));
- }
- }
- }
- }
- }
-
- function addTest($test) {
- /* Add TestCase or TestSuite to this TestSuite */
- $this->fTests[] = $test;
- }
-
- function run(&$testResult) {
- /* Run all TestCases and TestSuites comprising this TestSuite,
- accumulating results in the given TestResult object. */
- reset($this->fTests);
- while (list($na, $test) = each($this->fTests)) {
- if ($testResult->shouldStop())
- break;
- $test->run(&$testResult);
- }
- }
-
- function countTestCases() {
- /* Number of TestCases comprising this TestSuite (including those
- in any constituent TestSuites) */
- $count = 0;
- reset($fTests);
- while (list($na, $test_case) = each($this->fTests)) {
- $count += $test_case->countTestCases();
- }
- return $count;
- }
-}
-
-
-class TestFailure {
- /* Record failure of a single TestCase, associating it with the
- exception(s) that occurred */
- var $fFailedTestName;
- var $fExceptions;
-
- function TestFailure(&$test, &$exceptions) {
- $this->fFailedTestName = $test->name();
- $this->fExceptions = $exceptions;
- }
-
- function getExceptions() {
- return $this->fExceptions;
- }
- function getTestName() {
- return $this->fFailedTestName;
- }
-}
-
-
-class TestResult {
- /* Collect the results of running a set of TestCases. */
- var $fFailures = array();
- var $fRunTests = 0;
- var $fStop = false;
-
- function TestResult() { }
-
- function _endTest($test) /* protected */ {
- /* specialize this for end-of-test action, such as progress
- reports */
- }
-
- function getFailures() {
- return $this->fFailures;
- }
-
- function run($test) {
- /* Run a single TestCase in the context of this TestResult */
- $this->_startTest($test);
- $this->fRunTests++;
-
- $test->runBare();
-
- /* this is where JUnit would catch AssertionFailedError */
- $exceptions = $test->getExceptions();
- if ($exceptions)
- $this->fFailures[] = new TestFailure(&$test, &$exceptions);
- $this->_endTest($test);
- }
-
- function countTests() {
- return $this->fRunTests;
- }
-
- function shouldStop() {
- return $this->fStop;
- }
-
- function _startTest($test) /* protected */ {
- /* specialize this for start-of-test actions */
- }
-
- function stop() {
- /* set indication that the test sequence should halt */
- $fStop = true;
- }
-
- function countFailures() {
- return count($this->fFailures);
- }
-}
-
-
-class TextTestResult extends TestResult {
- /* Specialize TestResult to produce text/html report */
- function TextTestResult() {
- $this->TestResult(); // call superclass constructor
- }
-
- function report() {
- /* report result of test run */
- $nRun = $this->countTests();
- $nFailures = $this->countFailures();
- printf("<p>%s test%s run<br>", $nRun, ($nRun == 1) ? "" : 's');
- printf("%s failure%s.<br>\n", $nFailures, ($nFailures == 1) ? "" : 's');
- if ($nFailures == 0)
- return;
-
- print("<ol>\n");
- $failures = $this->getFailures();
- while (list($i, $failure) = each($failures)) {
- $failedTestName = $failure->getTestName();
- printf("<li>%s\n", $failedTestName);
-
- $exceptions = $failure->getExceptions();
- print("<ul>");
- while (list($na, $exception) = each($exceptions))
- printf("<li>%s\n", $exception->getMessage());
- print("</ul>");
- }
- print("</ol>\n");
- }
-
- function _startTest($test) {
- printf("%s ", $test->name());
- flush();
- }
-
- function _endTest($test) {
- $outcome = $test->failed()
- ? "<font color=\"red\">FAIL</font>"
- : "<font color=\"green\">ok</font>";
- printf("$outcome<br>\n");
- flush();
- }
-}
-
-
-class TestRunner {
- /* Run a suite of tests and report results. */
- function run($suite) {
- $result = new TextTestResult;
- $suite->run($result);
- $result->report();
- }
-}
-
-?>
+<?php\r
+//\r
+// PHP framework for testing, based on the design of "JUnit".\r
+//\r
+// Written by Fred Yankowski <fred@ontosys.com>\r
+// OntoSys, Inc <http://www.OntoSys.com>\r
+//\r
+// $Id: phpunit.php,v 1.1 2002/03/30 19:32:17 bmatzelle Exp $\r
+\r
+// Copyright (c) 2000 Fred Yankowski\r
+\r
+// Permission is hereby granted, free of charge, to any person\r
+// obtaining a copy of this software and associated documentation\r
+// files (the "Software"), to deal in the Software without\r
+// restriction, including without limitation the rights to use, copy,\r
+// modify, merge, publish, distribute, sublicense, and/or sell copies\r
+// of the Software, and to permit persons to whom the Software is\r
+// furnished to do so, subject to the following conditions:\r
+//\r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+//\r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+// SOFTWARE.\r
+//\r
+error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE |\r
+ E_CORE_ERROR | E_CORE_WARNING);\r
+\r
+/*\r
+interface Test {\r
+ function run(&$aTestResult);\r
+ function countTestCases();\r
+}\r
+*/\r
+\r
+function trace($msg) {\r
+ return;\r
+ print($msg);\r
+ flush();\r
+}\r
+\r
+\r
+class Exception {\r
+ /* Emulate a Java exception, sort of... */\r
+ var $message;\r
+ function Exception($message) {\r
+ $this->message = $message;\r
+ }\r
+ function getMessage() {\r
+ return $this->message;\r
+ }\r
+}\r
+\r
+class Assert {\r
+ function assert($boolean, $message=0) {\r
+ if (! $boolean)\r
+ $this->fail($message);\r
+ }\r
+\r
+ function assertEquals($expected, $actual, $message=0) {\r
+ if ($expected != $actual) {\r
+ $this->failNotEquals($expected, $actual, "expected", $message);\r
+ }\r
+ }\r
+\r
+ function assertRegexp($regexp, $actual, $message=false) {\r
+ if (! preg_match($regexp, $actual)) {\r
+ $this->failNotEquals($regexp, $actual, "pattern", $message);\r
+ }\r
+ }\r
+\r
+ function failNotEquals($expected, $actual, $expected_label, $message=0) {\r
+ // Private function for reporting failure to match.\r
+ $str = $message ? ($message . ' ') : '';\r
+ $str .= "($expected_label/actual)<br>";\r
+ $htmlExpected = htmlspecialchars($expected);\r
+ $htmlActual = htmlspecialchars($actual);\r
+ $str .= sprintf("<pre>%s\n--------\n%s</pre>",\r
+ $htmlExpected, $htmlActual);\r
+ $this->fail($str);\r
+ }\r
+}\r
+\r
+class TestCase extends Assert /* implements Test */ {\r
+ /* Defines context for running tests. Specific context -- such as\r
+ instance variables, global variables, global state -- is defined\r
+ by creating a subclass that specializes the setUp() and\r
+ tearDown() methods. A specific test is defined by a subclass\r
+ that specializes the runTest() method. */\r
+ var $fName;\r
+ var $fResult;\r
+ var $fExceptions = array();\r
+\r
+ function TestCase($name) {\r
+ $this->fName = $name;\r
+ }\r
+\r
+ function run($testResult=0) {\r
+ /* Run this single test, by calling the run() method of the\r
+ TestResult object which will in turn call the runBare() method\r
+ of this object. That complication allows the TestResult object\r
+ to do various kinds of progress reporting as it invokes each\r
+ test. Create/obtain a TestResult object if none was passed in.\r
+ Note that if a TestResult object was passed in, it must be by\r
+ reference. */\r
+ if (! $testResult)\r
+ $testResult = $this->_createResult();\r
+ $this->fResult = $testResult;\r
+ $testResult->run(&$this);\r
+ $this->fResult = 0;\r
+ return $testResult;\r
+ }\r
+\r
+ function countTestCases() {\r
+ return 1;\r
+ }\r
+\r
+ function runTest() {\r
+ $name = $this->name();\r
+ // Since isset($this->$name) is false, no way to run defensive checks\r
+ $this->$name();\r
+ }\r
+\r
+ function setUp() /* expect override */ {\r
+ //print("TestCase::setUp()<br>\n");\r
+ }\r
+\r
+ function tearDown() /* possible override */ {\r
+ //print("TestCase::tearDown()<br>\n");\r
+ }\r
+\r
+ ////////////////////////////////////////////////////////////////\r
+\r
+\r
+ function _createResult() /* protected */ {\r
+ /* override this to use specialized subclass of TestResult */\r
+ return new TestResult;\r
+ }\r
+\r
+ function fail($message=0) {\r
+ //printf("TestCase::fail(%s)<br>\n", ($message) ? $message : '');\r
+ /* JUnit throws AssertionFailedError here. We just record the\r
+ failure and carry on */\r
+ $this->fExceptions[] = new Exception(&$message);\r
+ }\r
+\r
+ function error($message) {\r
+ /* report error that requires correction in the test script\r
+ itself, or (heaven forbid) in this testing infrastructure */\r
+ printf('<b>ERROR: ' . $message . '</b><br>');\r
+ $this->fResult->stop();\r
+ }\r
+\r
+ function failed() {\r
+ return count($this->fExceptions);\r
+ }\r
+\r
+ function getExceptions() {\r
+ return $this->fExceptions;\r
+ }\r
+\r
+ function name() {\r
+ return $this->fName;\r
+ }\r
+\r
+ function runBare() {\r
+ $this->setup();\r
+ $this->runTest();\r
+ $this->tearDown();\r
+ }\r
+}\r
+\r
+\r
+class TestSuite /* implements Test */ {\r
+ /* Compose a set of Tests (instances of TestCase or TestSuite), and\r
+ run them all. */\r
+ var $fTests = array();\r
+\r
+ function TestSuite($classname=false) {\r
+ if ($classname) {\r
+ // Find all methods of the given class whose name starts with\r
+ // "test" and add them to the test suite. We are just _barely_\r
+ // able to do this with PHP's limited introspection... Note\r
+ // that PHP seems to store method names in lower case, and we\r
+ // have to avoid the constructor function for the TestCase class\r
+ // superclass. This will fail when $classname starts with\r
+ // "Test" since that will have a constructor method that will\r
+ // get matched below and then treated (incorrectly) as a test\r
+ // method. So don't name any TestCase subclasses as "Test..."!\r
+ if (floor(phpversion()) >= 4) {\r
+ // PHP4 introspection, submitted by Dylan Kuhn\r
+ $names = get_class_methods($classname);\r
+ while (list($key, $method) = each($names)) {\r
+ if (preg_match('/^test/', $method) && $method != "testcase") { \r
+ $this->addTest(new $classname($method));\r
+ }\r
+ }\r
+ }\r
+ else {\r
+ $dummy = new $classname("dummy");\r
+ $names = (array) $dummy;\r
+ while (list($key, $value) = each($names)) {\r
+ $type = gettype($value);\r
+ if ($type == "user function" && preg_match('/^test/', $key)\r
+ && $key != "testcase") { \r
+ $this->addTest(new $classname($key));\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ function addTest($test) {\r
+ /* Add TestCase or TestSuite to this TestSuite */\r
+ $this->fTests[] = $test;\r
+ }\r
+\r
+ function run(&$testResult) {\r
+ /* Run all TestCases and TestSuites comprising this TestSuite,\r
+ accumulating results in the given TestResult object. */\r
+ reset($this->fTests);\r
+ while (list($na, $test) = each($this->fTests)) {\r
+ if ($testResult->shouldStop())\r
+ break;\r
+ $test->run(&$testResult);\r
+ }\r
+ }\r
+\r
+ function countTestCases() {\r
+ /* Number of TestCases comprising this TestSuite (including those\r
+ in any constituent TestSuites) */\r
+ $count = 0;\r
+ reset($fTests);\r
+ while (list($na, $test_case) = each($this->fTests)) {\r
+ $count += $test_case->countTestCases();\r
+ }\r
+ return $count;\r
+ }\r
+}\r
+\r
+\r
+class TestFailure {\r
+ /* Record failure of a single TestCase, associating it with the\r
+ exception(s) that occurred */\r
+ var $fFailedTestName;\r
+ var $fExceptions;\r
+\r
+ function TestFailure(&$test, &$exceptions) {\r
+ $this->fFailedTestName = $test->name();\r
+ $this->fExceptions = $exceptions;\r
+ }\r
+\r
+ function getExceptions() {\r
+ return $this->fExceptions;\r
+ }\r
+ function getTestName() {\r
+ return $this->fFailedTestName;\r
+ }\r
+}\r
+\r
+\r
+class TestResult {\r
+ /* Collect the results of running a set of TestCases. */\r
+ var $fFailures = array();\r
+ var $fRunTests = 0;\r
+ var $fStop = false;\r
+\r
+ function TestResult() { }\r
+\r
+ function _endTest($test) /* protected */ {\r
+ /* specialize this for end-of-test action, such as progress\r
+ reports */\r
+ }\r
+\r
+ function getFailures() {\r
+ return $this->fFailures;\r
+ }\r
+\r
+ function run($test) {\r
+ /* Run a single TestCase in the context of this TestResult */\r
+ $this->_startTest($test);\r
+ $this->fRunTests++;\r
+\r
+ $test->runBare();\r
+\r
+ /* this is where JUnit would catch AssertionFailedError */\r
+ $exceptions = $test->getExceptions();\r
+ if ($exceptions)\r
+ $this->fFailures[] = new TestFailure(&$test, &$exceptions);\r
+ $this->_endTest($test);\r
+ }\r
+\r
+ function countTests() {\r
+ return $this->fRunTests;\r
+ }\r
+\r
+ function shouldStop() {\r
+ return $this->fStop;\r
+ }\r
+\r
+ function _startTest($test) /* protected */ {\r
+ /* specialize this for start-of-test actions */\r
+ }\r
+\r
+ function stop() {\r
+ /* set indication that the test sequence should halt */\r
+ $fStop = true;\r
+ }\r
+\r
+ function countFailures() {\r
+ return count($this->fFailures);\r
+ }\r
+}\r
+\r
+\r
+class TextTestResult extends TestResult {\r
+ /* Specialize TestResult to produce text/html report */\r
+ function TextTestResult() {\r
+ $this->TestResult(); // call superclass constructor\r
+ }\r
+ \r
+ function report() {\r
+ /* report result of test run */\r
+ $nRun = $this->countTests();\r
+ $nFailures = $this->countFailures();\r
+ printf("<p>%s test%s run<br>", $nRun, ($nRun == 1) ? '' : 's');\r
+ printf("%s failure%s.<br>\n", $nFailures, ($nFailures == 1) ? '' : 's');\r
+ if ($nFailures == 0)\r
+ return;\r
+\r
+ print("<ol>\n");\r
+ $failures = $this->getFailures();\r
+ while (list($i, $failure) = each($failures)) {\r
+ $failedTestName = $failure->getTestName();\r
+ printf("<li>%s\n", $failedTestName);\r
+\r
+ $exceptions = $failure->getExceptions();\r
+ print("<ul>");\r
+ while (list($na, $exception) = each($exceptions))\r
+ printf("<li>%s\n", $exception->getMessage());\r
+ print("</ul>");\r
+ }\r
+ print("</ol>\n");\r
+ }\r
+\r
+ function _startTest($test) {\r
+ printf("%s ", $test->name());\r
+ flush();\r
+ }\r
+\r
+ function _endTest($test) {\r
+ $outcome = $test->failed()\r
+ ? "<font color=\"red\">FAIL</font>"\r
+ : "<font color=\"green\">ok</font>";\r
+ printf("$outcome<br>\n");\r
+ flush();\r
+ }\r
+}\r
+\r
+\r
+class TestRunner {\r
+ /* Run a suite of tests and report results. */\r
+ function run($suite) {\r
+ $result = new TextTestResult;\r
+ $suite->run($result);\r
+ $result->report();\r
+ }\r
+}\r
+\r
+?>\r