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