| 1 | /*******************************************************************
 | 
  
    | 2 | *     http://code.google.com/a/apache-extras.org/p/phpmailer/      *
 | 
  
    | 3 | ********************************************************************/
 | 
  
    | 4 | 
 | 
  
    | 5 | PHPMailer
 | 
  
    | 6 | Full Featured Email Transfer Class for PHP
 | 
  
    | 7 | ==========================================
 | 
  
    | 8 | 
 | 
  
    | 9 | Version 5.2.1 (January 16, 2012)
 | 
  
    | 10 | 
 | 
  
    | 11 | Patch release (see changelog.txt).
 | 
  
    | 12 | 
 | 
  
    | 13 | Version 5.2.0 (July 19, 2011)
 | 
  
    | 14 | 
 | 
  
    | 15 | With the release of this version, PHPMailer has moved to Apache
 | 
  
    | 16 | Extras:
 | 
  
    | 17 |    http://code.google.com/a/apache-extras.org/p/phpmailer/
 | 
  
    | 18 | 
 | 
  
    | 19 | Version 5.0.0 (April 02, 2009)
 | 
  
    | 20 | 
 | 
  
    | 21 | With the release of this version, we are initiating a new version numbering
 | 
  
    | 22 | system to differentiate from the PHP4 version of PHPMailer.
 | 
  
    | 23 | 
 | 
  
    | 24 | Most notable in this release is fully object oriented code.
 | 
  
    | 25 | 
 | 
  
    | 26 | We now have available the PHPDocumentor (phpdocs) documentation. This is
 | 
  
    | 27 | separate from the regular download to keep file sizes down. Please see the
 | 
  
    | 28 | download area of http://phpmailer.codeworxtech.com.
 | 
  
    | 29 | 
 | 
  
    | 30 | We also have created a new test script (see /test_script) that you can use
 | 
  
    | 31 | right out of the box. Copy the /test_script folder directly to your server (in
 | 
  
    | 32 | the same structure ... with class.phpmailer.php and class.smtp.php in the
 | 
  
    | 33 | folder above it. Then launch the test script with:
 | 
  
    | 34 | http://www.yourdomain.com/phpmailer/test_script/index.php
 | 
  
    | 35 | from this one script, you can test your server settings for mail(), sendmail (or
 | 
  
    | 36 | qmail), and SMTP. This will email you a sample email (using contents.html for
 | 
  
    | 37 | the email body) and two attachments. One of the attachments is used as an inline
 | 
  
    | 38 | image to demonstrate how PHPMailer will automatically detect if attachments are
 | 
  
    | 39 | the same source as inline graphics and only include one version. Once you click
 | 
  
    | 40 | the Submit button, the results will be displayed including any SMTP debug
 | 
  
    | 41 | information and send status. We will also display a version of the script that
 | 
  
    | 42 | you can cut and paste to include in your projects. Enjoy!
 | 
  
    | 43 | 
 | 
  
    | 44 | Version 2.3 (November 08, 2008)
 | 
  
    | 45 | 
 | 
  
    | 46 | We have removed the /phpdoc from the downloads. All documentation is now on
 | 
  
    | 47 | the http://phpmailer.codeworxtech.com website.
 | 
  
    | 48 | 
 | 
  
    | 49 | The phpunit.php has been updated to support PHP5.
 | 
  
    | 50 | 
 | 
  
    | 51 | For all other changes and notes, please see the changelog.
 | 
  
    | 52 | 
 | 
  
    | 53 | Donations are accepted at PayPal with our id "paypal@worxteam.com".
 | 
  
    | 54 | 
 | 
  
    | 55 | Version 2.2 (July 15 2008)
 | 
  
    | 56 | 
 | 
  
    | 57 | - see the changelog.
 | 
  
    | 58 | 
 | 
  
    | 59 | Version 2.1 (June 04 2008)
 | 
  
    | 60 | 
 | 
  
    | 61 | With this release, we are announcing that the development of PHPMailer for PHP5
 | 
  
    | 62 | will be our focus from this date on. We have implemented all the enhancements
 | 
  
    | 63 | and fixes from the latest release of PHPMailer for PHP4.
 | 
  
    | 64 | 
 | 
  
    | 65 | Far more important, though, is that this release of PHPMailer (v2.1) is
 | 
  
    | 66 | fully tested with E_STRICT error checking enabled.
 | 
  
    | 67 | 
 | 
  
    | 68 | ** NOTE: WE HAVE A NEW LANGUAGE VARIABLE FOR DIGITALLY SIGNED S/MIME EMAILS.
 | 
  
    | 69 |    IF YOU CAN HELP WITH LANGUAGES OTHER THAN ENGLISH AND SPANISH, IT WOULD BE
 | 
  
    | 70 |    APPRECIATED.
 | 
  
    | 71 | 
 | 
  
    | 72 | We have now added S/MIME functionality (ability to digitally sign emails).
 | 
  
    | 73 | BIG THANKS TO "sergiocambra" for posting this patch back in November 2007.
 | 
  
    | 74 | The "Signed Emails" functionality adds the Sign method to pass the private key
 | 
  
    | 75 | filename and the password to read it, and then email will be sent with
 | 
  
    | 76 | content-type multipart/signed and with the digital signature attached.
 | 
  
    | 77 | 
 | 
  
    | 78 | A quick note on E_STRICT:
 | 
  
    | 79 | 
 | 
  
    | 80 | - In about half the test environments the development version was subjected
 | 
  
    | 81 |   to, an error was thrown for the date() functions (used at line 1565 and 1569).
 | 
  
    | 82 |   This is NOT a PHPMailer error, it is the result of an incorrectly configured
 | 
  
    | 83 |   PHP5 installation. The fix is to modify your 'php.ini' file and include the
 | 
  
    | 84 |   date.timezone = America/New York
 | 
  
    | 85 |   directive, (for your own server timezone)
 | 
  
    | 86 | - If you do get this error, and are unable to access your php.ini file, there is
 | 
  
    | 87 |   a workaround. In your PHP script, add
 | 
  
    | 88 |   date_default_timezone_set('America/Toronto');
 | 
  
    | 89 | 
 | 
  
    | 90 |   * do NOT try to use
 | 
  
    | 91 |   $myVar = date_default_timezone_get();
 | 
  
    | 92 |   as a test, it will throw an error.
 | 
  
    | 93 | 
 | 
  
    | 94 | We have also included more example files to show the use of "sendmail", "mail()",
 | 
  
    | 95 | "smtp", and "gmail".
 | 
  
    | 96 | 
 | 
  
    | 97 | We are also looking for more programmers to join the volunteer development team.
 | 
  
    | 98 | If you have an interest in this, please let us know.
 | 
  
    | 99 | 
 | 
  
    | 100 | Enjoy!
 | 
  
    | 101 | 
 | 
  
    | 102 | 
 | 
  
    | 103 | Version 2.1.0beta1 & beta2
 | 
  
    | 104 | 
 | 
  
    | 105 | please note, this is BETA software
 | 
  
    | 106 | ** DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS
 | 
  
    | 107 | INTENDED STRICTLY FOR TESTING
 | 
  
    | 108 | 
 | 
  
    | 109 | ** NOTE:
 | 
  
    | 110 | 
 | 
  
    | 111 | As of November 2007, PHPMailer has a new project team headed by industry
 | 
  
    | 112 | veteran Andy Prevost (codeworxtech). The first release in more than two
 | 
  
    | 113 | years will focus on fixes, adding ease-of-use enhancements, provide
 | 
  
    | 114 | basic compatibility with PHP4 and PHP5 using PHP5 backwards compatibility
 | 
  
    | 115 | features. A new release is planned before year-end 2007 that will provide
 | 
  
    | 116 | full compatiblity with PHP4 and PHP5, as well as more bug fixes.
 | 
  
    | 117 | 
 | 
  
    | 118 | We are looking for project developers to assist in restoring PHPMailer to
 | 
  
    | 119 | its leadership position. Our goals are to simplify use of PHPMailer, provide
 | 
  
    | 120 | good documentation and examples, and retain backward compatibility to level
 | 
  
    | 121 | 1.7.3 standards.
 | 
  
    | 122 | 
 | 
  
    | 123 | If you are interested in helping out, visit http://sourceforge.net/projects/phpmailer
 | 
  
    | 124 | and indicate your interest.
 | 
  
    | 125 | 
 | 
  
    | 126 | **
 | 
  
    | 127 | 
 | 
  
    | 128 | http://phpmailer.sourceforge.net/
 | 
  
    | 129 | 
 | 
  
    | 130 | This software is licenced under the LGPL.  Please read LICENSE for information on the
 | 
  
    | 131 | software availability and distribution.
 | 
  
    | 132 | 
 | 
  
    | 133 | Class Features:
 | 
  
    | 134 | - Send emails with multiple TOs, CCs, BCCs and REPLY-TOs
 | 
  
    | 135 | - Redundant SMTP servers
 | 
  
    | 136 | - Multipart/alternative emails for mail clients that do not read HTML email
 | 
  
    | 137 | - Support for 8bit, base64, binary, and quoted-printable encoding
 | 
  
    | 138 | - Uses the same methods as the very popular AspEmail active server (COM) component
 | 
  
    | 139 | - SMTP authentication
 | 
  
    | 140 | - Native language support
 | 
  
    | 141 | - Word wrap, and more!
 | 
  
    | 142 | 
 | 
  
    | 143 | Why you might need it:
 | 
  
    | 144 | 
 | 
  
    | 145 | Many PHP developers utilize email in their code.  The only PHP function
 | 
  
    | 146 | that supports this is the mail() function.  However, it does not expose
 | 
  
    | 147 | any of the popular features that many email clients use nowadays like
 | 
  
    | 148 | HTML-based emails and attachments. There are two proprietary
 | 
  
    | 149 | development tools out there that have all the functionality built into
 | 
  
    | 150 | easy to use classes: AspEmail(tm) and AspMail.  Both of these
 | 
  
    | 151 | programs are COM components only available on Windows.  They are also a
 | 
  
    | 152 | little pricey for smaller projects.
 | 
  
    | 153 | 
 | 
  
    | 154 | Since I do Linux development I�ve missed these tools for my PHP coding.
 | 
  
    | 155 | So I built a version myself that implements the same methods (object
 | 
  
    | 156 | calls) that the Windows-based components do. It is open source and the
 | 
  
    | 157 | LGPL license allows you to place the class in your proprietary PHP
 | 
  
    | 158 | projects.
 | 
  
    | 159 | 
 | 
  
    | 160 | 
 | 
  
    | 161 | Installation:
 | 
  
    | 162 | 
 | 
  
    | 163 | Copy class.phpmailer.php into your php.ini include_path. If you are
 | 
  
    | 164 | using the SMTP mailer then place class.smtp.php in your path as well.
 | 
  
    | 165 | In the language directory you will find several files like
 | 
  
    | 166 | phpmailer.lang-en.php.  If you look right before the .php extension
 | 
  
    | 167 | that there are two letters.  These represent the language type of the
 | 
  
    | 168 | translation file.  For instance "en" is the English file and "br" is
 | 
  
    | 169 | the Portuguese file.  Chose the file that best fits with your language
 | 
  
    | 170 | and place it in the PHP include path.  If your language is English
 | 
  
    | 171 | then you have nothing more to do.  If it is a different language then
 | 
  
    | 172 | you must point PHPMailer to the correct translation.  To do this, call
 | 
  
    | 173 | the PHPMailer SetLanguage method like so:
 | 
  
    | 174 | 
 | 
  
    | 175 | // To load the Portuguese version
 | 
  
    | 176 | $mail->SetLanguage("br", "/optional/path/to/language/directory/");
 | 
  
    | 177 | 
 | 
  
    | 178 | That's it.  You should now be ready to use PHPMailer!
 | 
  
    | 179 | 
 | 
  
    | 180 | 
 | 
  
    | 181 | A Simple Example:
 | 
  
    | 182 | 
 | 
  
    | 183 | <?php
 | 
  
    | 184 | require("class.phpmailer.php");
 | 
  
    | 185 | 
 | 
  
    | 186 | $mail = new PHPMailer();
 | 
  
    | 187 | 
 | 
  
    | 188 | $mail->IsSMTP();                                      // set mailer to use SMTP
 | 
  
    | 189 | $mail->Host = "smtp1.example.com;smtp2.example.com";  // specify main and backup server
 | 
  
    | 190 | $mail->SMTPAuth = true;     // turn on SMTP authentication
 | 
  
    | 191 | $mail->Username = "jswan";  // SMTP username
 | 
  
    | 192 | $mail->Password = "secret"; // SMTP password
 | 
  
    | 193 | 
 | 
  
    | 194 | $mail->From = "from@example.com";
 | 
  
    | 195 | $mail->FromName = "Mailer";
 | 
  
    | 196 | $mail->AddAddress("josh@example.net", "Josh Adams");
 | 
  
    | 197 | $mail->AddAddress("ellen@example.com");                  // name is optional
 | 
  
    | 198 | $mail->AddReplyTo("info@example.com", "Information");
 | 
  
    | 199 | 
 | 
  
    | 200 | $mail->WordWrap = 50;                                 // set word wrap to 50 characters
 | 
  
    | 201 | $mail->AddAttachment("/var/tmp/file.tar.gz");         // add attachments
 | 
  
    | 202 | $mail->AddAttachment("/tmp/image.jpg", "new.jpg");    // optional name
 | 
  
    | 203 | $mail->IsHTML(true);                                  // set email format to HTML
 | 
  
    | 204 | 
 | 
  
    | 205 | $mail->Subject = "Here is the subject";
 | 
  
    | 206 | $mail->Body    = "This is the HTML message body <b>in bold!</b>";
 | 
  
    | 207 | $mail->AltBody = "This is the body in plain text for non-HTML mail clients";
 | 
  
    | 208 | 
 | 
  
    | 209 | if(!$mail->Send())
 | 
  
    | 210 | {
 | 
  
    | 211 |    echo "Message could not be sent. <p>";
 | 
  
    | 212 |    echo "Mailer Error: " . $mail->ErrorInfo;
 | 
  
    | 213 |    exit;
 | 
  
    | 214 | }
 | 
  
    | 215 | 
 | 
  
    | 216 | echo "Message has been sent";
 | 
  
    | 217 | ?>
 | 
  
    | 218 | 
 | 
  
    | 219 | CHANGELOG
 | 
  
    | 220 | 
 | 
  
    | 221 | See ChangeLog.txt
 | 
  
    | 222 | 
 | 
  
    | 223 | Download: http://sourceforge.net/project/showfiles.php?group_id=26031
 | 
  
    | 224 | 
 | 
  
    | 225 | Andy Prevost
 |