From 0b821adfdcd31c34ff4a42832eaf762fb0ccb285 Mon Sep 17 00:00:00 2001 From: martin Date: Sat, 18 May 2002 06:54:12 +0000 Subject: [PATCH] Upgraded to phpmailer 1.60 --- lib/phpmailer/ChangeLog.txt | 16 + lib/phpmailer/LICENSE | 1008 +++++++------- lib/phpmailer/class.phpmailer.php | 765 +++++++--- lib/phpmailer/class.smtp.php | 13 +- lib/phpmailer/phpdoc/index-all.html | 92 +- lib/phpmailer/phpdoc/phpmailer.html | 1841 +++++++++++++------------ lib/phpmailer/test/phpmailer_test.php | 546 ++++++++ lib/phpmailer/test/phpunit.php | 376 +++++ lib/phpmailer/test/rocks.png | Bin 0 -> 1280 bytes 9 files changed, 3063 insertions(+), 1594 deletions(-) create mode 100644 lib/phpmailer/test/phpmailer_test.php create mode 100644 lib/phpmailer/test/phpunit.php create mode 100644 lib/phpmailer/test/rocks.png diff --git a/lib/phpmailer/ChangeLog.txt b/lib/phpmailer/ChangeLog.txt index efb5e14b296..52410784256 100644 --- a/lib/phpmailer/ChangeLog.txt +++ b/lib/phpmailer/ChangeLog.txt @@ -1,5 +1,21 @@ ChangeLog +Version 1.60 (Sat, Mar 30 2002) +* Sendmail pipe and address patch (Christian Holtje) +* Added embedded image and read confirmation support (A. Ognio) +* Added unit tests +* Added SMTP timeout support (*nix only) +* Added possibly temporary PluginDir variable for SMTP class +* Added LE message line ending variable +* Refactored boundary and attachment code +* Eliminated SMTP class warnings +* Added SendToQueue method for future queuing support + +Version 1.54 (Wed, Dec 19 2001) +* Add some queuing support code +* Fixed a pesky multi/alt bug +* Messages are no longer forced to have "To" addresses + Version 1.50 (Thu, Nov 08 2001) * Fix extra lines when not using SMTP mailer * Set WordWrap variable to int with a zero default diff --git a/lib/phpmailer/LICENSE b/lib/phpmailer/LICENSE index 03851a33830..f3f1b3b65e1 100644 --- a/lib/phpmailer/LICENSE +++ b/lib/phpmailer/LICENSE @@ -1,504 +1,504 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/lib/phpmailer/class.phpmailer.php b/lib/phpmailer/class.phpmailer.php index 2942f90a7e2..481b1bbc973 100644 --- a/lib/phpmailer/class.phpmailer.php +++ b/lib/phpmailer/class.phpmailer.php @@ -2,7 +2,7 @@ //////////////////////////////////////////////////// // phpmailer - PHP email class // -// Version 1.50, Created 11/08/2001 +// Version 1.60, Created 03/30/2002 // // Class for sending email using either // sendmail, PHP mail(), or SMTP. Methods are @@ -57,7 +57,7 @@ class phpmailer * @public * @type string */ - var $ErrorInfo = ""; + var $ErrorInfo = ""; /** * Sets the From email address for the message. Default value is "root@localhost". @@ -71,7 +71,7 @@ class phpmailer * @public * @type string */ - var $FromName = "Root User"; + var $FromName = "Root User"; /** * Sets the Sender email of the message. If not empty, will be sent via -f to sendmail @@ -108,7 +108,8 @@ class phpmailer var $AltBody = ""; /** - * Sets word wrapping on the message. Default value is 0 (off). + * Sets word wrapping on the body of the message to a given number of + * characters. Default value is 0 (off). * @public * @type int */ @@ -137,13 +138,36 @@ class phpmailer * @type bool */ var $UseMSMailHeaders = false; + + /** + * Path to phpmailer plugins. This is now only useful if the SMTP class + * is in a different directory than the PHP include path. + * Default is empty (""). + * @public + * @type string + */ + var $PluginDir = ""; /** * Holds phpmailer version. * @public * @type string */ - var $Version = "1.50"; + var $Version = "1.54"; + + /** + * Sets the email address that a reading confirmation will be sent. Default value is "". + * @public + * @type string + */ + var $ConfirmReadingTo = ""; + + /** + * Sets the line endings of the message. Default is "\n"; + * @public + * @type string + */ + var $LE = "\n"; ///////////////////////////////////////////////// @@ -200,8 +224,8 @@ class phpmailer var $Password = ""; /** - * Sets the SMTP server timeout in seconds. Does not function at this time - * because PHP for win32 does not support it. Default value is 10. + * Sets the SMTP server timeout in seconds. This function will not + * work with the win32 version. Default value is 10. * @public * @type int */ @@ -256,18 +280,16 @@ class phpmailer var $CustomHeader = array(); /** - * Holds the message boundary. Default is false. + * Holds the type of the message. * @type string */ - var $boundary = false; + var $message_type = ""; /** - * Holds the message boundary. This is used specifically - * when multipart/alternative messages are sent. Default is false. - * @type string + * Holds the message boundaries. + * @type string array */ - var $subboundary = false; - + var $boundary = array(); ///////////////////////////////////////////////// // VARIABLE METHODS @@ -397,7 +419,10 @@ class phpmailer * @returns bool */ function Send() { - if(count($this->to) < 1) + $header = ""; + $body = ""; + + if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) { $this->error_handler("You must provide at least one recipient email address"); return false; @@ -407,7 +432,11 @@ class phpmailer if(!empty($this->AltBody)) $this->ContentType = "multipart/alternative"; - $header = $this->create_header(); + // Attach sender information & date + $header = $this->received(); + $header .= sprintf("Date: %s%s", $this->rfc_date(), $this->LE); + $header .= $this->create_header(); + if(!$body = $this->create_body()) return false; @@ -437,6 +466,107 @@ class phpmailer return true; } + + /** + * Sends mail message to an assigned queue directory. Has an optional + * sendTime argument. This is used when the user wants the + * message to be sent from the queue at a predetermined time. + * The data must be a valid timestamp like that returned from + * the time() or strtotime() functions. Returns false on failure + * or the message file name if success. + * @public + * @returns string + */ + function SendToQueue($queue_path, $send_time = 0) { + $message = array(); + $header = ""; + $body = ""; + + // If invalid or empty just set to the current time + if($send_time == 0) + $send_time = time(); + + if(!is_dir($queue_path)) + { + $this->error_handler("The supplied queue directory does not exist"); + return false; + } + + if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) + { + $this->error_handler("You must provide at least one recipient email address"); + return false; + } + + // Set whether the message is multipart/alternative + if(!empty($this->AltBody)) + $this->ContentType = "multipart/alternative"; + + $header = $this->create_header(); + if(!$body = $this->create_body()) + return false; + + // Seed randomizer + mt_srand(time()); + $msg_id = md5(uniqid(mt_rand())); + + $fp = fopen($queue_path . $msg_id . ".pqm", "wb"); + if(!$fp) + { + $this->error_handler(sprintf("Could not write to %s directory", $queue_path)); + return false; + } + + $message[] = sprintf("----START PQM HEADER----%s", $this->LE); + $message[] = sprintf("SendTime: %s%s", $send_time, $this->LE); + $message[] = sprintf("Mailer: %s%s", $this->Mailer, $this->LE); + + // Choose the mailer + if($this->Mailer == "sendmail") + { + $message[] = sprintf("Sendmail: %s%s", $this->Sendmail, $this->LE); + $message[] = sprintf("Sender: %s%s", $this->Sender, $this->LE); + } + elseif($this->Mailer == "mail") + { + $message[] = sprintf("Sender: %s%s", $this->Sender, $this->LE); + $message[] = sprintf("Subject: %s%s", $this->Subject, $this->LE); + $message[] = sprintf("to: %s%s", $this->addr_list($this->to), $this->LE); + } + elseif($this->Mailer == "smtp") + { + $message[] = sprintf("Host: %s%s", $this->Host, $this->LE); + $message[] = sprintf("Port: %d%s", $this->Port, $this->LE); + $message[] = sprintf("Helo: %s%s", $this->Helo, $this->LE); + $message[] = sprintf("Timeout: %d%s", $this->Timeout, $this->LE); + + if($this->SMTPAuth) + $auth_no = 1; + else + $auth_no = 0; + $message[] = sprintf("SMTPAuth: %d%s", $auth_no, $this->LE); + $message[] = sprintf("Username: %s%s", $this->Username, $this->LE); + $message[] = sprintf("Password: %s%s", $this->Password, $this->LE); + $message[] = sprintf("From: %s%s", $this->From, $this->LE); + + $message[] = sprintf("to: %s%s", $this->addr_list($this->to), $this->LE); + $message[] = sprintf("cc: %s%s", $this->addr_list($this->cc), $this->LE); + $message[] = sprintf("bcc: %s%s", $this->addr_list($this->bcc), $this->LE); + } + else + { + $this->error_handler(sprintf("%s mailer is not supported", $this->Mailer)); + return false; + } + + $message[] = sprintf("----END PQM HEADER----%s", $this->LE); // end of pqm header + $message[] = $header; + $message[] = $body; + + fwrite($fp, join("", $message)); + + return ($msg_id . ".pqm"); + } /** * Sends mail using the $Sendmail program. Returns bool. @@ -457,7 +587,13 @@ class phpmailer fputs($mail, $header); fputs($mail, $body); - pclose($mail); + + $result = pclose($mail) >> 8 & 0xFF; + if($result != 0) + { + $this->error_handler(sprintf("Could not execute %s", $this->Sendmail)); + return false; + } return true; } @@ -513,7 +649,7 @@ class phpmailer */ function smtp_send($header, $body) { // Include SMTP class code, but not twice - include_once("class.smtp.php"); // Load code only if asked + include_once($this->PluginDir . "class.smtp.php"); $smtp = new SMTP; @@ -628,21 +764,52 @@ class phpmailer * @returns string */ function addr_append($type, $addr) { - $addr_str = ""; - $addr_str .= sprintf("%s: \"%s\" <%s>", $type, addslashes($addr[0][1]), $addr[0][0]); + $addr_str = $type . ": "; + $addr_str .= $this->addr_format($addr[0]); if(count($addr) > 1) { for($i = 1; $i < count($addr); $i++) { - $addr_str .= sprintf(", \"%s\" <%s>", addslashes($addr[$i][1]), $addr[$i][0]); + $addr_str .= sprintf(", %s", $this->addr_format($addr[$i])); } - $addr_str .= "\r\n"; + $addr_str .= $this->LE; } else - $addr_str .= "\r\n"; + $addr_str .= $this->LE; return($addr_str); } + + /** + * Creates a semicolon delimited list for use in pqm files. + * @private + * @returns string + */ + function addr_list($list_array) { + $addr_list = ""; + for($i = 0; $i < count($list_array); $i++) + { + if($i > 0) + $addr_list .= ";"; + $addr_list .= $list_array[$i][0]; + } + + return $addr_list; + } + + /** + * Formats an address correctly. + * @private + * @returns string + */ + function addr_format($addr) { + if(empty($addr[1])) + $formatted = $addr[0]; + else + $formatted = sprintf('"%s" <%s>', addslashes($addr[1]), $addr[0]); + + return $formatted; + } /** * Wraps message for use with mailers that do not @@ -651,17 +818,17 @@ class phpmailer * @private * @returns string */ - function wordwrap($message, $length, $qp_mode = false) { + function word_wrap($message, $length, $qp_mode = false) { if ($qp_mode) - $soft_break = " =\r\n"; + $soft_break = sprintf(" =%s", $this->LE); else - $soft_break = "\r\n"; + $soft_break = $this->LE; $message = $this->fix_eol($message); - if (substr($message, -1) == "\r\n") + if (substr($message, -1) == $this->LE) $message = substr($message, 0, -1); - $line = explode("\r\n", $message); + $line = explode($this->LE, $message); $message = ""; for ($i=0 ;$i < count($line); $i++) { @@ -685,7 +852,7 @@ class phpmailer $part = substr($word, 0, $len); $word = substr($word, $len); $buf .= " " . $part; - $message .= $buf . "=\r\n"; + $message .= $buf . sprintf("=%s", $this->LE); } else { @@ -704,7 +871,7 @@ class phpmailer $word = substr($word, $len); if (strlen($word) > 0) - $message .= $part . "=\r\n"; + $message .= $part . sprintf("=%s", $this->LE); else $buf = $part; } @@ -723,7 +890,7 @@ class phpmailer } } } - $message .= $buf . "\r\n"; + $message .= $buf . $this->LE; } return ($message); @@ -737,14 +904,18 @@ class phpmailer */ function create_header() { $header = array(); - $header[] = $this->received(); - $header[] = sprintf("Date: %s\r\n", $this->rfc_date()); + + // Set the boundaries + $uniq_id = md5(uniqid(time())); + $this->boundary[1] = "b1_" . $uniq_id; + $this->boundary[2] = "b2_" . $uniq_id; // To be created automatically by mail() - if($this->Mailer != "mail") + if(($this->Mailer != "mail") && (count($this->to) > 0)) $header[] = $this->addr_append("To", $this->to); - $header[] = sprintf("From: \"%s\" <%s>\r\n", addslashes($this->FromName), trim($this->From)); + $header[] = sprintf("From: \"%s\" <%s>%s", addslashes($this->FromName), + trim($this->From), $this->LE); if(count($this->cc) > 0) $header[] = $this->addr_append("Cc", $this->cc); @@ -757,41 +928,71 @@ class phpmailer // mail() sets the subject itself if($this->Mailer != "mail") - $header[] = sprintf("Subject: %s\r\n", trim($this->Subject)); + $header[] = sprintf("Subject: %s%s", trim($this->Subject), $this->LE); - $header[] = sprintf("X-Priority: %d\r\n", $this->Priority); - $header[] = sprintf("X-Mailer: Moodle phpmailer [version %s]\r\n", $this->Version); - $header[] = sprintf("Return-Path: %s\r\n", trim($this->From)); + $header[] = sprintf("X-Priority: %d%s", $this->Priority, $this->LE); + $header[] = sprintf("X-Mailer: phpmailer [version %s]%s", $this->Version, $this->LE); + $header[] = sprintf("Return-Path: %s%s", trim($this->From), $this->LE); + + if($this->ConfirmReadingTo != "") + $header[] = sprintf("Disposition-Notification-To: <%s>%s", + trim($this->ConfirmReadingTo), $this->LE); // Add custom headers for($index = 0; $index < count($this->CustomHeader); $index++) - $header[] = sprintf("%s\r\n", $this->CustomHeader[$index]); + $header[] = sprintf("%s%s", $this->CustomHeader[$index], $this->LE); if($this->UseMSMailHeaders) $header[] = $this->AddMSMailHeaders(); - $header[] = "MIME-Version: 1.0\r\n"; + $header[] = sprintf("MIME-Version: 1.0%s", $this->LE); - // Add all attachments - if(count($this->attachment) > 0 || !empty($this->AltBody)) - { - // Set message boundary - $this->boundary = "_b" . md5(uniqid(time())); - // Set message subboundary for multipart/alternative - $this->subboundary = "_sb" . md5(uniqid(time())); - - $header[] = "Content-Type: Multipart/Mixed;\r\n"; - $header[] = sprintf("\tboundary=\"Boundary-=%s\"\r\n\r\n", $this->boundary); - } + // Determine what type of message this is + if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) + $this->message_type = "plain"; else { - $header[] = sprintf("Content-Transfer-Encoding: %s\r\n", $this->Encoding); - $header[] = sprintf("Content-Type: %s; charset = \"%s\"", - $this->ContentType, $this->CharSet); - // No additional lines when using mail() function - if($this->Mailer != "mail") - $header[] = "\r\n\r\n"; + if(count($this->attachment) > 0) + $this->message_type = "attachments"; + if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) + $this->message_type = "alt"; + if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) + $this->message_type = "alt_attachments"; } + + switch($this->message_type) + { + case "plain": + $header[] = sprintf("Content-Transfer-Encoding: %s%s", + $this->Encoding, $this->LE); + $header[] = sprintf("Content-Type: %s; charset = \"%s\"", + $this->ContentType, $this->CharSet); + break; + case "attachments": + case "alt_attachments": + if($this->EmbeddedImageCount() > 0) + { + $header[] = sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", + "multipart/related", $this->LE, $this->LE, + $this->boundary[1], $this->LE); + } + else + { + $header[] = sprintf("Content-Type: %s;%s", + "multipart/mixed", $this->LE); + $header[] = sprintf("\tboundary=\"%s\"%s", $this->boundary[1], $this->LE); + } + break; + case "alt": + $header[] = sprintf("Content-Type: %s;%s", + "multipart/alternative", $this->LE); + $header[] = sprintf("\tboundary=\"%s\"%s", $this->boundary[1], $this->LE); + break; + } + + // No additional lines when using mail() function + if($this->Mailer != "mail") + $header[] = $this->LE.$this->LE; return(join("", $header)); } @@ -803,56 +1004,86 @@ class phpmailer * @returns string */ function create_body() { + $body = array(); + // wordwrap the message body if set - if($this->WordWrap) - $this->Body = $this->wordwrap($this->Body, $this->WordWrap); + if($this->WordWrap > 0) + $this->Body = $this->word_wrap($this->Body, $this->WordWrap); - // If content type is multipart/alternative set body like this: - if ((!empty($this->AltBody)) && (count($this->attachment) < 1)) + switch($this->message_type) { - // Return text of body - $mime = array(); - $mime[] = "This is a MIME message. If you are reading this text, you\r\n"; - $mime[] = "might want to consider changing to a mail reader that\r\n"; - $mime[] = "understands how to properly display MIME multipart messages.\r\n\r\n"; - $mime[] = sprintf("--Boundary-=%s\r\n", $this->boundary); + case "alt": + // Return text of body + $bndry = new Boundary($this->boundary[1]); + $bndry->CharSet = $this->CharSet; + $bndry->Encoding = $this->Encoding; + $body[] = $bndry->GetSource(); + + $body[] = sprintf("%s%s", $this->AltBody, $this->LE.$this->LE); + + $bndry = new Boundary($this->boundary[1]); + $bndry->CharSet = $this->CharSet; + $bndry->ContentType = "text/html"; + $bndry->Encoding = $this->Encoding; + $body[] = $bndry->GetSource(); + + $body[] = sprintf("%s%s", $this->Body, $this->LE.$this->LE); + + // End the boundary + $body[] = sprintf("%s--%s--%s", $this->LE, + $this->boundary[1], $this->LE.$this->LE); + break; + case "plain": + $body[] = $this->Body; + break; + case "attachments": + $bndry = new Boundary($this->boundary[1]); + $bndry->CharSet = $this->CharSet; + $bndry->ContentType = $this->ContentType; + $bndry->Encoding = $this->Encoding; + $body[] = sprintf("%s%s%s%s", $bndry->GetSource(false), $this->LE, + $this->Body, $this->LE); + + if(!$body[] = $this->attach_all()) + return false; + break; + case "alt_attachments": + $body[] = sprintf("--%s%s", $this->boundary[1], $this->LE); + $body[] = sprintf("Content-Type: %s;%s" . + "\tboundary=\"%s\"%s", + "multipart/alternative", $this->LE, + $this->boundary[2], $this->LE.$this->LE); + + // Create text body + $bndry = new Boundary($this->boundary[2]); + $bndry->CharSet = $this->CharSet; + $bndry->ContentType = "text/plain"; + $bndry->Encoding = $this->Encoding; + $body[] = $bndry->GetSource() . $this->LE; + + $body[] = sprintf("%s%s", $this->AltBody, $this->LE.$this->LE); + + // Create the HTML body + $bndry = new Boundary($this->boundary[2]); + $bndry->CharSet = $this->CharSet; + $bndry->ContentType = "text/html"; + $bndry->Encoding = $this->Encoding; + $body[] = $bndry->GetSource() . $this->LE; + + $body[] = sprintf("%s%s", $this->Body, $this->LE.$this->LE); - // Insert body. If multipart/alternative, insert both html and plain - $mime[] = sprintf("Content-Type: %s; charset = \"%s\";\r\n" . - "\tboundary=\"Boundary-=%s\";\r\n\r\n", - $this->ContentType, $this->CharSet, $this->subboundary); - - $mime[] = sprintf("--Boundary-=%s\r\n", $this->subboundary); - $mime[] = sprintf("Content-Type: text/plain; charset = \"%s\";\r\n", $this->CharSet); - $mime[] = sprintf("Content-Transfer-Encoding: %s\r\n\r\n", $this->Encoding); - $mime[] = sprintf("%s\r\n\r\n", $this->AltBody); - - $mime[] = sprintf("--Boundary-=%s\r\n", $this->subboundary); - $mime[] = sprintf("Content-Type: text/html; charset = \"%s\";\r\n", $this->CharSet); - $mime[] = sprintf("Content-Transfer-Encoding: %s\r\n\r\n", $this->Encoding); - $mime[] = sprintf("%s\r\n\r\n", $this->Body); - - $mime[] = sprintf("\r\n--Boundary-=%s--\r\n\r\n", $this->subboundary); - - $mime[] = sprintf("\r\n--Boundary-=%s--\r\n", $this->boundary); - - $this->Body = $this->encode_string(join("", $mime), $this->Encoding); - } - else - { - $this->Body = $this->encode_string($this->Body, $this->Encoding); + $body[] = sprintf("%s--%s--%s", $this->LE, + $this->boundary[2], $this->LE.$this->LE); + + if(!$body[] = $this->attach_all()) + return false; + break; } + // Add the encode string code here + $sBody = join("", $body); + $sBody = $this->encode_string($sBody, $this->Encoding); - - if(count($this->attachment) > 0) - { - if(!$body = $this->attach_all()) - return false; - } - else - $body = $this->Body; - - return($body); + return $sBody; } @@ -888,6 +1119,8 @@ class phpmailer $this->attachment[$cur][3] = $encoding; $this->attachment[$cur][4] = $type; $this->attachment[$cur][5] = false; // isStringAttachment + $this->attachment[$cur][6] = "attachment"; + $this->attachment[$cur][7] = 0; return true; } @@ -901,77 +1134,60 @@ class phpmailer function attach_all() { // Return text of body $mime = array(); - $mime[] = "This is a MIME message. If you are reading this text, you\r\n"; - $mime[] = "might want to consider changing to a mail reader that\r\n"; - $mime[] = "understands how to properly display MIME multipart messages.\r\n\r\n"; - $mime[] = sprintf("--Boundary-=%s\r\n", $this->boundary); - - // Insert body. If multipart/alternative, insert both html and plain. - if (!empty($this->AltBody)) - { - $mime[] = sprintf("Content-Type: %s; charset = \"%s\";\r\n" . - "\tboundary=\"Boundary-=%s\";\r\n\r\n", - $this->ContentType, $this->CharSet, $this->subboundary); - - $mime[] = sprintf("--Boundary-=%s\r\n", $this->subboundary); - $mime[] = sprintf("Content-Type: text/plain; charset = \"%s\";\r\n", $this->CharSet); - $mime[] = sprintf("Content-Transfer-Encoding: %s\r\n\r\n", $this->Encoding); - $mime[] = sprintf("%s\r\n\r\n", $this->AltBody); - - $mime[] = sprintf("--Boundary-=%s\r\n", $this->subboundary); - $mime[] = sprintf("Content-Type: text/html; charset = \"%s\";\r\n", $this->CharSet); - $mime[] = sprintf("Content-Transfer-Encoding: %s\r\n\r\n", $this->Encoding); - $mime[] = sprintf("%s\r\n\r\n", $this->Body); - - $mime[] = sprintf("\r\n--Boundary-=%s--\r\n\r\n", $this->subboundary); - } - else - { - $mime[] = sprintf("Content-Type: %s; charset = \"%s\";\r\n", $this->ContentType, $this->CharSet); - $mime[] = sprintf("Content-Transfer-Encoding: %s\r\n\r\n", $this->Encoding); - $mime[] = sprintf("%s\r\n", $this->Body); - } // Add all attachments for($i = 0; $i < count($this->attachment); $i++) { - // Check for string attachment - $isString = $this->attachment[$i][5]; - if ($isString) - { - $string = $this->attachment[$i][0]; - } - else - { - $path = $this->attachment[$i][0]; - } - $filename = $this->attachment[$i][1]; - $name = $this->attachment[$i][2]; - $encoding = $this->attachment[$i][3]; - $type = $this->attachment[$i][4]; - $mime[] = sprintf("--Boundary-=%s\r\n", $this->boundary); - $mime[] = sprintf("Content-Type: %s; ", $type); - $mime[] = sprintf("name=\"%s\"\r\n", $name); - $mime[] = sprintf("Content-Transfer-Encoding: %s\r\n", $encoding); - $mime[] = sprintf("Content-Disposition: attachment; filename=\"%s\"\r\n\r\n", $name); + // Check for string attachment + $isString = $this->attachment[$i][5]; + if ($isString) + { + $string = $this->attachment[$i][0]; + } + else + { + $path = $this->attachment[$i][0]; + } + $filename = $this->attachment[$i][1]; + $name = $this->attachment[$i][2]; + $encoding = $this->attachment[$i][3]; + $type = $this->attachment[$i][4]; + $disposition = $this->attachment[$i][6]; + $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-Transfer-Encoding: %s%s", $encoding, $this->LE); - // Encode as string attachment - if($isString) - { - if(!$mime[] = sprintf("%s\r\n\r\n", $this->encode_string($string, $encoding))) - return false; - } - else - { - if(!$mime[] = sprintf("%s\r\n\r\n", $this->encode_file($path, $encoding))) - return false; - } + if($disposition == "inline") + $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE); + else + $mime[] = sprintf("Content-ID: <%s>%s", $name, $this->LE); + + $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", + $disposition, $name, $this->LE.$this->LE); + + // Encode as string attachment + if($isString) + { + if(!$mime[] = sprintf("%s%s", $this->encode_string($string, $encoding), + $this->LE.$this->LE)) + return false; + } + else + { + if(!$mime[] = sprintf("%s%s", $this->encode_file($path, $encoding), + $this->LE.$this->LE)) + return false; + + $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE); + + } } - $mime[] = sprintf("\r\n--Boundary-=%s--\r\n", $this->boundary); return(join("", $mime)); } - + /** * Encodes attachment in requested format. Returns a * string if successful or false if unsuccessful. @@ -1007,8 +1223,8 @@ class phpmailer case "7bit": case "8bit": $encoded = $this->fix_eol($str); - if (substr($encoded, -2) != "\r\n") - $encoded .= "\r\n"; + if (substr($encoded, -2) != $this->LE) + $encoded .= $this->LE; break; case "binary": @@ -1033,29 +1249,29 @@ class phpmailer */ function encode_qp ($str) { $encoded = $this->fix_eol($str); - if (substr($encoded, -2) != "\r\n") - $encoded .= "\r\n"; + if (substr($encoded, -2) != $this->LE) + $encoded .= $this->LE; // Replace every high ascii, control and = characters $encoded = preg_replace("/([\001-\010\013\014\016-\037\075\177-\377])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); // Replace every spaces and tabs when it's the last character on a line - $encoded = preg_replace("/([\011\040])\r\n/e", - "'='.sprintf('%02X', ord('\\1')).'\r\n'", $encoded); + $encoded = preg_replace("/([\011\040])".$this->LE."/e", + "'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded); // Maximum line length of 76 characters before CRLF (74 + space + '=') - $encoded = $this->WordWrap($encoded, 74, true); + $encoded = $this->word_wrap($encoded, 74, true); return $encoded; } /** - * Adds a string or binary attachment (non-filesystem) to the list. - * This method can be used to attach ascii or binary data, - * such as a BLOB record from a database. - * @public - * @returns void - */ + * Adds a string or binary attachment (non-filesystem) to the list. + * This method can be used to attach ascii or binary data, + * such as a BLOB record from a database. + * @public + * @returns void + */ function AddStringAttachment($string, $filename, $encoding = "base64", $type = "application/octet-stream") { // Append to $attachment array $cur = count($this->attachment); @@ -1065,6 +1281,58 @@ class phpmailer $this->attachment[$cur][3] = $encoding; $this->attachment[$cur][4] = $type; $this->attachment[$cur][5] = true; // isString + $this->attachment[$cur][6] = "attachment"; + $this->attachment[$cur][7] = 0; + } + + /** + * Adds an embedded attachment. This can include images, sounds, and + * just about any other document. + * @param cid this is the Content Id of the attachment. Use this to identify + * the Id for accessing the image in an HTML form. + * @public + * @returns bool + */ + function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64", $type = "application/octet-stream") { + + if(!@is_file($path)) + { + $this->error_handler(sprintf("Could not access [%s] file", $path)); + return false; + } + + $filename = basename($path); + if($name == "") + $name = $filename; + + // Append to $attachment array + $cur = count($this->attachment); + $this->attachment[$cur][0] = $path; + $this->attachment[$cur][1] = $filename; + $this->attachment[$cur][2] = $name; + $this->attachment[$cur][3] = $encoding; + $this->attachment[$cur][4] = $type; + $this->attachment[$cur][5] = false; // isStringAttachment + $this->attachment[$cur][6] = "inline"; + $this->attachment[$cur][7] = $cid; + + return true; + } + + /** + * Returns the number of embedded images in an email. + * @private + * @returns int + */ + function EmbeddedImageCount() { + $ret = 0; + for($i = 0; $i < count($this->attachment); $i++) + { + if($this->attachment[$i][6] == "inline") + $ret++; + } + + return $ret; } ///////////////////////////////////////////////// @@ -1173,23 +1441,42 @@ class phpmailer * @returns string */ function received() { + // Check for vars because they might not exist. Possibly + // write a small retrieval function (that mailer can use too!) + + $str = sprintf("Received: from phpmailer ([%s]) by %s " . + "with HTTP;%s\t %s%s", + $this->get_server_var("REMOTE_ADDR"), + $this->get_server_var("SERVER_NAME"), + $this->LE, + $this->rfc_date(), + $this->LE); + + return $str; + } + + /** + * Returns the appropriate server variable. Should work with both + * PHP 4.1.0+ as well as older versions. Returns an empty string + * if nothing is found. + * @private + * @returns mixed + */ + function get_server_var($varName) { global $HTTP_SERVER_VARS; global $HTTP_ENV_VARS; - // IIS & Apache use different global variables - if($HTTP_SERVER_VARS["REMOTE_ADDR"] == "") - $http_vars = $HTTP_ENV_VARS; // Apache found + if(!isset($_SERVER)) + { + $_SERVER = $HTTP_SERVER_VARS; + if(!isset($_SERVER["REMOTE_ADDR"])) + $_SERVER = $HTTP_ENV_VARS; // must be Apache + } + + if(isset($_SERVER[$varName])) + return $_SERVER[$varName]; else - $http_vars = $HTTP_SERVER_VARS; // IIS found - - $str = sprintf("Received: from phpmailer ([%s]) by %s " . - "with HTTP (%s);\r\n\t %s\r\n", - $http_vars["REMOTE_ADDR"], - $http_vars["SERVER_NAME"], - $http_vars["SERVER_SOFTWARE"], - $this->rfc_date()); - - return $str; + return ""; } /** @@ -1200,7 +1487,7 @@ class phpmailer function fix_eol($str) { $str = str_replace("\r\n", "\n", $str); $str = str_replace("\r", "\n", $str); - $str = str_replace("\n", "\r\n", $str); + $str = str_replace("\n", $this->LE, $str); return $str; } @@ -1227,12 +1514,102 @@ class phpmailer else $MSPriority = "Medium"; - $MSHeader .= sprintf("X-MSMail-Priority: %s\r\n", $MSPriority); - $MSHeader .= sprintf("Importance: %s\r\n", $MSPriority); + $MSHeader .= sprintf("X-MSMail-Priority: %s%s", $MSPriority, $this->LE); + $MSHeader .= sprintf("Importance: %s%s", $MSPriority, $this->LE); return($MSHeader); } } -// End of class + + +/** + * Boundary - MIME message boundary class + * @author Brent R. Matzelle + */ +class Boundary +{ + /** + * Sets the boundary ID. + * @private + * @type string + */ + var $ID = 0; + + /** + * Sets the boundary Content Type. + * @public + * @type string + */ + var $ContentType = "text/plain"; + + /** + * Sets the Encoding. + * @public + * @type string + */ + var $Encoding = ""; + + /** + * Sets an attachment disposition. + * @public + * @type string + */ + var $Disposition = ""; + + /** + * Sets an attachment file name. + * @public + * @type string + */ + var $FileName = ""; + + /** + * Sets the Char set. + * @public + * @type string + */ + var $CharSet = ""; + + /** + * Sets the line endings of the message. Default is "\n"; + * @public + * @type string + */ + var $LE = "\n"; + + /** + * Main constructor. + */ + function Boundary($boundary_id) { + $this->ID = $boundary_id; + } + + /** + * Returns the source of the boundary. + * @public + * @returns string + */ + function GetSource($bLineEnding = true) { + $ret = array(); + $mime[] = sprintf("--%s%s", $this->ID, $this->LE); + $mime[] = sprintf("Content-Type: %s; charset = \"%s\"%s", + $this->ContentType, $this->CharSet, $this->LE); + //$mime[] = sprintf("Content-Transfer-Encoding: %s%s", $this->Encoding, + // $this->LE); + + if(strlen($this->Disposition) > 0) + { + $mime[] = sprintf("Content-Disposition: %s;"); + if(strlen($this->FileName) > 0) + $mime[] = sprinf("filename=\"%s\"", $this->$this->FileName); + } + + if($bLineEnding) + $mime[] = $this->LE; + + return join("", $mime); + } +} + ?> diff --git a/lib/phpmailer/class.smtp.php b/lib/phpmailer/class.smtp.php index 34bf54f9318..c169be674d0 100644 --- a/lib/phpmailer/class.smtp.php +++ b/lib/phpmailer/class.smtp.php @@ -101,9 +101,9 @@ # sometimes the SMTP server takes a little longer to respond # so we will give it a longer timeout for the first read - // Commented b/c of win32 warning messages - //if(function_exists("socket_set_timeout")) - // socket_set_timeout($this->smtp_conn, 1, 0); + // Windows still does not have support for this timeout function + if(substr(PHP_OS, 0, 3) != "WIN") + socket_set_timeout($this->smtp_conn, 1, 0); # get any announcement stuff $announce = $this->get_lines(); @@ -329,8 +329,11 @@ # now send the lines to the server while(list(,$line_out) = @each($lines_out)) { - if($line_out[0] == ".") { - $line_out = "." . $line_out; + if(strlen($line_out) > 0) + { + if(substr($line_out, 0, 1) == ".") { + $line_out = "." . $line_out; + } } fputs($this->smtp_conn,$line_out . $this->CRLF); } diff --git a/lib/phpmailer/phpdoc/index-all.html b/lib/phpmailer/phpdoc/index-all.html index 22eb277261d..5633608f8ef 100644 --- a/lib/phpmailer/phpdoc/index-all.html +++ b/lib/phpmailer/phpdoc/index-all.html @@ -2,7 +2,7 @@ - + : Index @@ -42,49 +42,76 @@ -$ A C I P S
+$ A B C G I P S

$

$AltBody - Variable in class phpmailer -
Sets a multipart/alternative message. +
Sets the text-only body of the message.
$Body - Variable in class phpmailer
Sets the Body of the message.
$CharSet - Variable in class phpmailer
Sets the CharSet of the message. +
$CharSet - +Variable in class Boundary +
Sets the Char set. +
$ConfirmReadingTo - +Variable in class phpmailer +
Sets the email address that a reading confirmation will be sent.
$ContentType - Variable in class phpmailer
Sets the Content-type of the message. +
$ContentType - +Variable in class Boundary +
Sets the boundary Content Type. +
$Disposition - +Variable in class Boundary +
Sets an attachment disposition.
$Encoding - Variable in class phpmailer
Sets the Encoding of the message. +
$Encoding - +Variable in class Boundary +
Sets the Encoding.
$ErrorInfo - Variable in class phpmailer
Holds the most recent mailer error message. +
$FileName - +Variable in class Boundary +
Sets an attachment file name.
$From - Variable in class phpmailer -
Sets the From email of the message. +
Sets the From email address for the message.
$FromName - Variable in class phpmailer
Sets the From name of the message.
$Helo - Variable in class phpmailer -
Sets the CharSet of the message. +
Sets the SMTP HELO of the message.
$Host - Variable in class phpmailer -
Sets the SMTP host. +
Sets the SMTP hosts. +
$LE - +Variable in class phpmailer +
Sets the line endings of the message. +
$LE - +Variable in class Boundary +
Sets the line endings of the message.
$Mailer - Variable in class phpmailer
Method to send mail: ("mail", "sendmail", or "smtp").
$Password - Variable in class phpmailer
Sets SMTP password. +
$PluginDir - +Variable in class phpmailer +
Path to phpmailer plugins.
$Port - Variable in class phpmailer -
Sets the SMTP server port. +
Sets the default SMTP server port.
$Priority - Variable in class phpmailer
Email priority (1 = High, 3 = Normal, 5 = low). @@ -97,15 +124,9 @@ Variable in class phpmailer
$SMTPAuth - Variable in class phpmailer
Sets SMTP authentication. -
$SMTPDebug - -Variable in class phpmailer -
Sets SMTP class debugging on or off.
$Subject - Variable in class phpmailer
Sets the Subject of the message. -
$Timeout - -Variable in class phpmailer -
Sets the SMTP server timeout.
$UseMSMailHeaders - Variable in class phpmailer
Turns Microsoft mail client headers on and off. @@ -117,7 +138,8 @@ Variable in class phpmailer
Holds phpmailer version.
$WordWrap - Variable in class phpmailer -
Sets word wrapping on the message. +
Sets word wrapping on the body of the message to a given number of + characters.

@@ -125,11 +147,10 @@ Variable in class phpmailer
AddAddress(var, var) - Method in class phpmailer -
Adds a "to" address. +
Adds a "To" address.
AddAttachment(var, var, var, var) - Method in class phpmailer -
Checks if attachment is valid and then adds - the attachment to the list. +
Adds an attachment from a path on the filesystem.
AddBCC(var, var) - Method in class phpmailer
Adds a "Bcc" address. @@ -139,12 +160,23 @@ Method in class phpmailer
AddCustomHeader(var) - Method in class phpmailer
Adds a custom header. +
AddEmbeddedImage(var, var, var, var, var) - +Method in class phpmailer +
Adds an embedded attachment.
AddReplyTo(var, var) - Method in class phpmailer
Adds a "Reply-to" address.
AddStringAttachment(var, var, var, var) - Method in class phpmailer -
Adds the string attachment to the list. +
Adds a string or binary attachment (non-filesystem) to the list. +
+
+

+B

+
+
Boundary - class Boundary.
Boundary - MIME message boundary class
Boundary(var) - +Constructor for class Boundary +
Main constructor.

@@ -159,7 +191,8 @@ Method in class phpmailer array.
ClearAttachments() - Method in class phpmailer -
Clears all previously set attachments. +
Clears all previously set filesystem, string, and binary + attachments.
ClearBCCs() - Method in class phpmailer
Clears all recipients assigned in the BCC array. @@ -174,6 +207,14 @@ Method in class phpmailer
Clears all recipients assigned in the ReplyTo array.
+

+G

+
+
GetSource(var) - +Method in class Boundary +
Returns the source of the boundary. +
+

I

@@ -182,16 +223,16 @@ Method in class phpmailer
Sets message type to HTML.
IsMail() - Method in class phpmailer -
Sets Mailer to use PHP mail() function. +
Sets Mailer to send message using PHP mail() function.
IsQmail() - Method in class phpmailer -
Sets Mailer to use qmail MTA. +
Sets Mailer to send message using the qmail MTA.
IsSendmail() - Method in class phpmailer -
Sets Mailer to use $Sendmail program. +
Sets Mailer to send message using the $Sendmail program.
IsSMTP() - Method in class phpmailer -
Sets Mailer to use SMTP. +
Sets Mailer to send message using SMTP.

@@ -208,9 +249,12 @@ Constructor for class phpmailer
Send() - Method in class phpmailer
Creates message and assigns Mailer. +
SendToQueue(var, var) - +Method in class phpmailer +
Sends mail message to an assigned queue directory.
-$ A C I P S +$ A B C G I P S diff --git a/lib/phpmailer/phpdoc/phpmailer.html b/lib/phpmailer/phpdoc/phpmailer.html index 897e222a4c7..ecf7e097adb 100644 --- a/lib/phpmailer/phpdoc/phpmailer.html +++ b/lib/phpmailer/phpdoc/phpmailer.html @@ -1,936 +1,1043 @@ - - - - - - -: Class phpmailer - - - - - - + + + + + + +: Class phpmailer + + + + + + -
- - + + + + + + + + + + + +
+ +
+ + +
+ +

+Class phpmailer

+
+phpmailer
+
+
+
+
public class phpmailer
+ +

+phpmailer - PHP email transport class +

+


+ +

+ + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Field Summary
- string$AltBody - -
-          Sets the text-only body of the message.
- string$Body - -
-          Sets the Body of the message.
- string$CharSet - -
-          Sets the CharSet of the message.
- string$ContentType - -
-          Sets the Content-type of the message.
- string$Encoding - -
-          Sets the Encoding of the message.
- string$ErrorInfo - -
-          Holds the most recent mailer error message.
- string$From - -
-          Sets the From email address for the message.
- string$FromName - -
-          Sets the From name of the message.
- string$Helo - -
-          Sets the SMTP HELO of the message.
- string$Host - -
-          Sets the SMTP hosts.
- string$Mailer - -
-          Method to send mail: ("mail", "sendmail", or "smtp").
- string$Password - -
-          Sets SMTP password.
- int$Port - -
-          Sets the default SMTP server port.
- int$Priority - -
-          Email priority (1 = High, 3 = Normal, 5 = low).
- string$Sender - -
-          Sets the Sender email of the message.
- string$Sendmail - -
-          Sets the path of the sendmail program.
- bool$SMTPAuth - -
-          Sets SMTP authentication.
- string$Subject - -
-          Sets the Subject of the message.
- bool$UseMSMailHeaders - -
-          Turns Microsoft mail client headers on and off.
- string$Username - -
-          Sets SMTP username.
- string$Version - -
-          Holds phpmailer version.
- int$WordWrap - -
-          Sets word wrapping on the message.
-  - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ string$AltBody + +
+          Sets the text-only body of the message.
+ string$Body + +
+          Sets the Body of the message.
+ string$CharSet + +
+          Sets the CharSet of the message.
+ string$ConfirmReadingTo + +
+          Sets the email address that a reading confirmation will be sent.
+ string$ContentType + +
+          Sets the Content-type of the message.
+ string$Encoding + +
+          Sets the Encoding of the message.
+ string$ErrorInfo + +
+          Holds the most recent mailer error message.
+ string$From + +
+          Sets the From email address for the message.
+ string$FromName + +
+          Sets the From name of the message.
+ string$Helo + +
+          Sets the SMTP HELO of the message.
+ string$Host + +
+          Sets the SMTP hosts.
+ string$LE + +
+          Sets the line endings of the message.
+ string$Mailer + +
+          Method to send mail: ("mail", "sendmail", or "smtp").
+ string$Password + +
+          Sets SMTP password.
+ string$PluginDir + +
+          Path to phpmailer plugins.
+ int$Port + +
+          Sets the default SMTP server port.
+ int$Priority + +
+          Email priority (1 = High, 3 = Normal, 5 = low).
+ string$Sender + +
+          Sets the Sender email of the message.
+ string$Sendmail + +
+          Sets the path of the sendmail program.
+ bool$SMTPAuth + +
+          Sets SMTP authentication.
+ string$Subject + +
+          Sets the Subject of the message.
+ bool$UseMSMailHeaders + +
+          Turns Microsoft mail client headers on and off.
+ string$Username + +
+          Sets SMTP username.
+ string$Version + +
+          Holds phpmailer version.
+ int$WordWrap + +
+          Sets word wrapping on the body of the message to a given number of + characters.
+  + + - - - - - - - -
-Constructor Summary
phpmailer() - -
-           
-  - - + + + + + + + +
+Constructor Summary
phpmailer() + +
+           
+  + + - - - - - - +
-Method Summary
- void
+ + + + + - - - + var $name) + +
+          Adds a "To" address. + + + - - - + var $type) + +
+          Adds an attachment from a path on the filesystem. + + + - - - + var $name) + +
+          Adds a "Bcc" address. + + + - - - - - - - + var $name) + +
+          Adds a "Cc" address. + + + + + + + + + + + - - - + var $name) + +
+          Adds a "Reply-to" address. + + + - - - - - - - - + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+Method Summary
+ void AddAddress(var $address, - var $name) - -
-          Adds a "To" address.
- bool
+ bool AddAttachment(var $path, var $name, var $encoding, - var $type) - -
-          Adds an attachment from a path on the filesystem.
- void
+ void AddBCC(var $address, - var $name) - -
-          Adds a "Bcc" address.
- void
+ void AddCC(var $address, - var $name) - -
-          Adds a "Cc" address.
- voidAddCustomHeader(var $custom_header) - -
-          Adds a custom header.
- void
+ voidAddCustomHeader(var $custom_header) + +
+          Adds a custom header.
+ boolAddEmbeddedImage(var $path, + var $cid, + var $name, + var $encoding, + var $type) + +
+          Adds an embedded attachment.
+ void AddReplyTo(var $address, - var $name) - -
-          Adds a "Reply-to" address.
- void
+ void AddStringAttachment(var $string, var $filename, var $encoding, - var $type) - -
-          Adds a string or binary attachment (non-filesystem) to the list.
- voidClearAddresses() - -
-          Clears all recipients assigned in the TO array.
- voidClearAllRecipients() - -
+ var $type) + +
+          Adds a string or binary attachment (non-filesystem) to the list.
+ voidClearAddresses() + +
+          Clears all recipients assigned in the TO array.
+ voidClearAllRecipients() + +
          Clears all recipients assigned in the TO, CC and BCC - array.
- voidClearAttachments() - -
+ array.
+ voidClearAttachments() + +
          Clears all previously set filesystem, string, and binary - attachments.
- voidClearBCCs() - -
-          Clears all recipients assigned in the BCC array.
- voidClearCCs() - -
-          Clears all recipients assigned in the CC array.
- voidClearCustomHeaders() - -
-          Clears all custom headers.
- voidClearReplyTos() - -
-          Clears all recipients assigned in the ReplyTo array.
- voidIsHTML(var $bool) - -
-          Sets message type to HTML.
- voidIsMail() - -
-          Sets Mailer to send message using PHP mail() function.
- voidIsQmail() - -
-          Sets Mailer to send message using the qmail MTA.
- voidIsSendmail() - -
-          Sets Mailer to send message using the $Sendmail program.
- voidIsSMTP() - -
-          Sets Mailer to send message using SMTP.
- boolSend() - -
-          Creates message and assigns Mailer.
-  -

- - - + attachments. + + + + void +ClearBCCs() + +
+          Clears all recipients assigned in the BCC array. + + + + void +ClearCCs() + +
+          Clears all recipients assigned in the CC array. + + + + void +ClearCustomHeaders() + +
+          Clears all custom headers. + + + + void +ClearReplyTos() + +
+          Clears all recipients assigned in the ReplyTo array. + + + + void +IsHTML(var $bool) + +
+          Sets message type to HTML. + + + + void +IsMail() + +
+          Sets Mailer to send message using PHP mail() function. + + + + void +IsQmail() + +
+          Sets Mailer to send message using the qmail MTA. + + + + void +IsSendmail() + +
+          Sets Mailer to send message using the $Sendmail program. + + + + void +IsSMTP() + +
+          Sets Mailer to send message using SMTP. + + + + bool +Send() + +
+          Creates message and assigns Mailer. + + + + string +SendToQueue(var $queue_path, + var $send_time) + +
+          Sends mail message to an assigned queue directory. + + +  +

+ + + - - - - -
-Field Detail
- -

-$Priority

-
-public int $Priority
-
-
Email priority (1 = High, 3 = Normal, 5 = low). Default value is 3.
-
- -

-$CharSet

-
-public string $CharSet
-
-
Sets the CharSet of the message. Default value is "iso-8859-1".
-
- -

-$ContentType

-
-public string $ContentType
-
-
Sets the Content-type of the message. Default value is "text/plain".
-
- -

-$Encoding

-
-public string $Encoding
-
+ + + + +
+Field Detail
+ +

+$Priority

+
+public int $Priority
+
+
Email priority (1 = High, 3 = Normal, 5 = low). Default value is 3.
+
+ +

+$CharSet

+
+public string $CharSet
+
+
Sets the CharSet of the message. Default value is "iso-8859-1".
+
+ +

+$ContentType

+
+public string $ContentType
+
+
Sets the Content-type of the message. Default value is "text/plain".
+
+ +

+$Encoding

+
+public string $Encoding
+
Sets the Encoding of the message. Options for this are "8bit" (default), - "7bit", "binary", "base64", and "quoted-printable".
-
- -

-$ErrorInfo

-
-public string $ErrorInfo
-
-
Holds the most recent mailer error message. Default value is "".
-
- -

-$From

-
-public string $From
-
-
Sets the From email address for the message. Default value is "root@localhost".
-
- -

-$FromName

-
-public string $FromName
-
-
Sets the From name of the message. Default value is "Root User".
-
- -

-$Sender

-
-public string $Sender
-
+ "7bit", "binary", "base64", and "quoted-printable".
+
+ +

+$ErrorInfo

+
+public string $ErrorInfo
+
+
Holds the most recent mailer error message. Default value is "".
+
+ +

+$From

+
+public string $From
+
+
Sets the From email address for the message. Default value is "root@localhost".
+
+ +

+$FromName

+
+public string $FromName
+
+
Sets the From name of the message. Default value is "Root User".
+
+ +

+$Sender

+
+public string $Sender
+
Sets the Sender email of the message. If not empty, will be sent via -f to sendmail - or as 'MAIL FROM' in smtp mode. Default value is "".
-
- -

-$Subject

-
-public string $Subject
-
-
Sets the Subject of the message. Default value is "".
-
- -

-$Body

-
-public string $Body
-
+ or as 'MAIL FROM' in smtp mode. Default value is "".
+
+ +

+$Subject

+
+public string $Subject
+
+
Sets the Subject of the message. Default value is "".
+
+ +

+$Body

+
+public string $Body
+
Sets the Body of the message. This can be either an HTML or text body. - If HTML then run IsHTML(true). Default value is "".
-
- -

-$AltBody

-
-public string $AltBody
-
+ If HTML then run IsHTML(true). Default value is "".
+
+ +

+$AltBody

+
+public string $AltBody
+
Sets the text-only body of the message. This automatically sets the email to multipart/alternative. This body can be read by mail clients that do not have HTML email capability such as mutt. Clients that can read HTML will view the normal Body. - Default value is "".
-
- -

-$WordWrap

-
-public int $WordWrap
-
-
Sets word wrapping on the message. Default value is 0 (off).
-
- -

-$Mailer

-
-public string $Mailer
-
+ Default value is "".
+
+ +

+$WordWrap

+
+public int $WordWrap
+
+
Sets word wrapping on the body of the message to a given number of + characters. Default value is 0 (off).
+
+ +

+$Mailer

+
+public string $Mailer
+
Method to send mail: ("mail", "sendmail", or "smtp"). - Default value is "mail".
-
- -

-$Sendmail

-
-public string $Sendmail
-
+ Default value is "mail".
+
+ +

+$Sendmail

+
+public string $Sendmail
+
Sets the path of the sendmail program. Default value is - "/usr/sbin/sendmail".
-
- -

-$UseMSMailHeaders

-
-public bool $UseMSMailHeaders
-
+ "/usr/sbin/sendmail".
+
+ +

+$UseMSMailHeaders

+
+public bool $UseMSMailHeaders
+
Turns Microsoft mail client headers on and off. Useful mostly - for older clients. Default value is false (off).
-
- -

-$Version

-
-public string $Version
-
-
Holds phpmailer version.
-
- -

-$Host

-
-public string $Host
-
+ for older clients. Default value is false (off).
+
+ +

+$PluginDir

+
+public string $PluginDir
+
+
Path to phpmailer plugins. This is now only useful if the SMTP class + is in a different directory than the PHP include path. + Default is empty ("").
+
+ +

+$Version

+
+public string $Version
+
+
Holds phpmailer version.
+
+ +

+$ConfirmReadingTo

+
+public string $ConfirmReadingTo
+
+
Sets the email address that a reading confirmation will be sent. Default value is "".
+
+ +

+$LE

+
+public string $LE
+
+
Sets the line endings of the message. Default is "\n";
+
+ +

+$Host

+
+public string $Host
+
Sets the SMTP hosts. All hosts must be separated by a semicolon. You can also specify a different port for each host by using this format: [hostname:port] (e.g. "smtp1.domain.com:25;smtp2.domain.com"). Hosts will be tried in order. - Default value is "localhost".
-
- -

-$Port

-
-public int $Port
-
-
Sets the default SMTP server port. Default value is 25.
-
- -

-$Helo

-
-public string $Helo
-
+ Default value is "localhost".
+
+ +

+$Port

+
+public int $Port
+
+
Sets the default SMTP server port. Default value is 25.
+
+ +

+$Helo

+
+public string $Helo
+
Sets the SMTP HELO of the message. - Default value is "localhost.localdomain".
-
- -

-$SMTPAuth

-
-public bool $SMTPAuth
-
+ Default value is "localhost.localdomain".
+
+ +

+$SMTPAuth

+
+public bool $SMTPAuth
+
Sets SMTP authentication. Utilizes the Username and Password variables. - Default value is false (off).
-
- -

-$Username

-
-public string $Username
-
-
Sets SMTP username. Default value is "".
-
- -

-$Password

-
-public string $Password
-
-
Sets SMTP password. Default value is "".
- - - + Default value is false (off).
+
+ +

+$Username

+
+public string $Username
+
+
Sets SMTP username. Default value is "".
+
+ +

+$Password

+
+public string $Password
+
+
Sets SMTP password. Default value is "".
+ + + - - - - -
-Constructor Detail
- -

-phpmailer

-
-public phpmailer()
-
-
- - - + + + + +
+Constructor Detail
+ +

+phpmailer

+
+public phpmailer()
+
+
+ + + - - - - -
-Method Detail
- -

-IsHTML

-
-public void IsHTML(var $bool)
-
-
Sets message type to HTML. Returns void.
-
- -

-IsSMTP

-
-public void IsSMTP()
-
+ + + + +
+Method Detail
+ +

+IsHTML

+
+public void IsHTML(var $bool)
+
+
Sets message type to HTML. Returns void.
+
+ +

+IsSMTP

+
+public void IsSMTP()
+
Sets Mailer to send message using SMTP. - Returns void.
-
- -

-IsMail

-
-public void IsMail()
-
+ Returns void.
+
+ +

+IsMail

+
+public void IsMail()
+
Sets Mailer to send message using PHP mail() function. - Returns void.
-
- -

-IsSendmail

-
-public void IsSendmail()
-
+ Returns void.
+
+ +

+IsSendmail

+
+public void IsSendmail()
+
Sets Mailer to send message using the $Sendmail program. - Returns void.
-
- -

-IsQmail

-
-public void IsQmail()
-
-
Sets Mailer to send message using the qmail MTA. Returns void.
-
- -

-AddAddress

-
+ Returns void.
+
+ +

+IsQmail

+
+public void IsQmail()
+
+
Sets Mailer to send message using the qmail MTA. Returns void.
+
+ +

+AddAddress

+
 public void AddAddress(var $address,
-                       var $name)
-
-
Adds a "To" address. Returns void.
-
Parameters:
$name - Default Value: ""
-
-
-
- -

-AddCC

-
+                       var $name)
+
+
Adds a "To" address. Returns void.
+
Parameters:
$name - Default Value: ""
+
+
+
+ +

+AddCC

+
 public void AddCC(var $address,
-                  var $name)
-
+ var $name) +
Adds a "Cc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer. This is a PHP bug that has been submitted - on http: * functions correctly. Returns void.
-
Parameters:
$name - Default Value: ""
-
-
-
- -

-AddBCC

-
+ on http:     * functions correctly. Returns void.
+
Parameters:
$name - Default Value: ""
+
+
+
+ +

+AddBCC

+
 public void AddBCC(var $address,
-                   var $name)
-
+ var $name) +
Adds a "Bcc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer. This is a PHP bug that has been submitted on http: * functions correctly. - Returns void.
-
Parameters:
$name - Default Value: ""
-
-
-
- -

-AddReplyTo

-
+ Returns void.
+
Parameters:
$name - Default Value: ""
+
+
+
+ +

+AddReplyTo

+
 public void AddReplyTo(var $address,
-                       var $name)
-
-
Adds a "Reply-to" address. Returns void.
-
Parameters:
$name - Default Value: ""
-
-
-
- -

-Send

-
-public bool Send()
-
+ var $name) +
+
Adds a "Reply-to" address. Returns void.
+
Parameters:
$name - Default Value: ""
+
+
+
+ +

+Send

+
+public bool Send()
+
Creates message and assigns Mailer. If the message is not sent successfully then it returns false. Use the ErrorInfo - variable to view description of the error. Returns bool.
-
- -

-AddAttachment

-
+ variable to view description of the error.  Returns bool.
+
+ +

+SendToQueue

+
+public string SendToQueue(var $queue_path,
+                          var $send_time)
+
+
Sends mail message to an assigned queue directory. Has an optional + sendTime argument. This is used when the user wants the + message to be sent from the queue at a predetermined time. + The data must be a valid timestamp like that returned from + the time() or strtotime() functions. Returns false on failure + or the message file name if success.
+
Parameters:
$send_time - Default Value: 0
+
+
+
+ +

+AddAttachment

+
 public bool AddAttachment(var $path,
                           var $name,
                           var $encoding,
-                          var $type)
-
+ var $type) +
Adds an attachment from a path on the filesystem. Checks if attachment is valid and then adds the attachment to the list. Returns false if the file could not be found - or accessed.
-
Parameters:
$name - Default Value: ""
$encoding - Default Value: "base64"
$type - Default Value: "application/octet-stream"
-
-
-
- -

-AddStringAttachment

-
+ or accessed.
+
Parameters:
$name - Default Value: ""
$encoding - Default Value: "base64"
$type - Default Value: "application/octet-stream"
+
+
+
+ +

+AddStringAttachment

+
 public void AddStringAttachment(var $string,
                                 var $filename,
                                 var $encoding,
-                                var $type)
-
+ var $type) +
Adds a string or binary attachment (non-filesystem) to the list. This method can be used to attach ascii or binary data, - such as a BLOB record from a database.
-
Parameters:
$encoding - Default Value: "base64"
$type - Default Value: "application/octet-stream"
-
-
-
- -

-ClearAddresses

-
-public void ClearAddresses()
-
-
Clears all recipients assigned in the TO array. Returns void.
-
- -

-ClearCCs

-
-public void ClearCCs()
-
-
Clears all recipients assigned in the CC array. Returns void.
-
- -

-ClearBCCs

-
-public void ClearBCCs()
-
-
Clears all recipients assigned in the BCC array. Returns void.
-
- -

-ClearReplyTos

-
-public void ClearReplyTos()
-
-
Clears all recipients assigned in the ReplyTo array. Returns void.
-
- -

-ClearAllRecipients

-
-public void ClearAllRecipients()
-
+ such as a BLOB record from a database.
+
Parameters:
$encoding - Default Value: "base64"
$type - Default Value: "application/octet-stream"
+
+
+
+ +

+AddEmbeddedImage

+
+public bool AddEmbeddedImage(var $path,
+                             var $cid,
+                             var $name,
+                             var $encoding,
+                             var $type)
+
+
Adds an embedded attachment. This can include images, sounds, and + just about any other document.
+
Parameters:
cid - this is the Content Id of the attachment. Use this to identify + the Id for accessing the image in an HTML form.
$name - Default Value: ""
$encoding - Default Value: "base64"
$type - Default Value: "application/octet-stream"
+
+
+
+ +

+ClearAddresses

+
+public void ClearAddresses()
+
+
Clears all recipients assigned in the TO array. Returns void.
+
+ +

+ClearCCs

+
+public void ClearCCs()
+
+
Clears all recipients assigned in the CC array. Returns void.
+
+ +

+ClearBCCs

+
+public void ClearBCCs()
+
+
Clears all recipients assigned in the BCC array. Returns void.
+
+ +

+ClearReplyTos

+
+public void ClearReplyTos()
+
+
Clears all recipients assigned in the ReplyTo array. Returns void.
+
+ +

+ClearAllRecipients

+
+public void ClearAllRecipients()
+
Clears all recipients assigned in the TO, CC and BCC - array. Returns void.
-
- -

-ClearAttachments

-
-public void ClearAttachments()
-
+ array. Returns void.
+
+ +

+ClearAttachments

+
+public void ClearAttachments()
+
Clears all previously set filesystem, string, and binary - attachments. Returns void.
-
- -

-ClearCustomHeaders

-
-public void ClearCustomHeaders()
-
-
Clears all custom headers. Returns void.
-
- -

-AddCustomHeader

-
-public void AddCustomHeader(var $custom_header)
-
-
Adds a custom header. Returns void.
- -
- - + attachments. Returns void.
+
+ +

+ClearCustomHeaders

+
+public void ClearCustomHeaders()
+
+
Clears all custom headers. Returns void.
+
+ +

+AddCustomHeader

+
+public void AddCustomHeader(var $custom_header)
+
+
Adds a custom header. Returns void.
+ +
+ + - - - + + + + + + + + + + + +
+ +
+ + +
+ + + diff --git a/lib/phpmailer/test/phpmailer_test.php b/lib/phpmailer/test/phpmailer_test.php new file mode 100644 index 00000000000..545740cffbb --- /dev/null +++ b/lib/phpmailer/test/phpmailer_test.php @@ -0,0 +1,546 @@ +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"); + + 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"]); + + // This is where you might place additional To, Bcc, etc addresses + } + + /** + * Run after each test is completed. + */ + function tearDown() { + // Clean global variables + $this->Mail = false; + $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 = "
"; + $bullet = "
  • "; + $bullet_start = "
      "; + $bullet_end = "
    "; + } + 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"; + $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(); + if(!$this->Mail->Send()) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + $this->assert(true); + } + + /** + * 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(); + if(!$this->Mail->Send()) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + $this->assert(true); + } + + /** + * Simple plain file attachment test. + */ + function test_Plain_FileAttachment() { + + $this->Mail->Body = "Here is the text body"; + $this->Mail->Subject .= ": Plain and FileAttachment"; + + if(!$this->Mail->AddAttachment("phpmailer_test.php", "test_attach.txt")) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + $this->BuildBody(); + if(!$this->Mail->Send()) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + $this->assert(true); + } + + /** + * Simple plain string attachment test. + */ + function test_Plain_StringAttachment() { + + $this->Mail->Body = "Here is the text body"; + $this->Mail->Subject .= ": Plain and 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(); + if(!$this->Mail->Send()) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + $this->assert(true); + } + + /** + * Plain quoted-printable message. + */ + function test_Quoted_Printable() { + + $this->Mail->Body = "Here is the main body"; + $this->Mail->Subject .= ": Plain and Quoted-printable"; + $this->Mail->Encoding = "quoted-printable"; + + $this->BuildBody(); + if(!$this->Mail->Send()) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + $this->assert(true); + } + + /** + * Try a plain message. + */ + function test_Html() { + + $this->Mail->IsHTML(true); + $this->Mail->Subject .= ": HTML only"; + + $this->Mail->Body = "This is a test message written in HTML.
    " . + "Go to " . + "http://phpmailer.sourceforge.net/ for new versions of " . + "phpmailer.

    Thank you!"; + + $this->BuildBody(); + if(!$this->Mail->Send()) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + $this->assert(true); + } + + /** + * Simple HTML and attachment test + */ + function test_HTML_Attachment() { + + $this->Mail->Body = "This is the HTML part of the email."; + $this->Mail->Subject .= ": HTML and Attachment"; + $this->Mail->IsHTML(true); + + if(!$this->Mail->AddAttachment("phpmailer_test.php", "test_attach.txt")) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + $this->BuildBody(); + if(!$this->Mail->Send()) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + $this->assert(true); + } + + /** + * An embedded attachment test. + */ + function test_Embedded_Image() { + + $this->Mail->Body = "Embedded Image: \"phpmailer\"" . + "Here is an image!"; + $this->Mail->Subject .= ": Embedded Image"; + $this->Mail->IsHTML(true); + + if(!$this->Mail->AddEmbeddedImage("rocks.png", "my-attach", "rocks.png")) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + if($this->Mail->EmbeddedImageCount() < 0) + { + $this->assert(false, "Embedded image count below 1"); + return; + } + + $this->BuildBody(); + if(!$this->Mail->Send()) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + $this->assert(true); + } + + /** + * Simple multipart/alternative test. + */ + function test_AltBody() { + + $this->Mail->Body = "This is the HTML part of the email."; + $this->Mail->AltBody = "This is the text part of the email."; + $this->AddNote("This is a mulipart alternative email"); + $this->Mail->Subject .= ": AltBody"; + + $this->BuildBody(); + if(!$this->Mail->Send()) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + $this->assert(true); + } + + /** + * Simple HTML and attachment test + */ + function test_AltBody_Attachment() { + + $this->Mail->Body = "This is the HTML part of the email."; + $this->Mail->AltBody = "This is the text part of the email."; + $this->Mail->Subject .= ": AltBody and Attachment"; + $this->Mail->IsHTML(true); + + if(!$this->Mail->AddAttachment("phpmailer_test.php", "test_attach.txt")) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + $this->BuildBody(); + if(!$this->Mail->Send()) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + $this->assert(true); + } + +} + +/** + * 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:
    "; + $suite = new TestSuite( "phpmailerTest" ); + + $testRunner = new TestRunner; + $testRunner->run($suite); + echo "


    "; +} + +function get($sName) { + global $global_vars; + if(isset($global_vars[$sName])) + return $global_vars[$sName]; + else + return ""; +} + +?> + + + +

    phpmailer Unit Test

    +By entering a SMTP hostname it will automatically perform tests with SMTP. + +
    + +To Address: "/> +
    +Bcc Address: "/> +
    +SMTP Hostname: "/> +

    + + +

    + + diff --git a/lib/phpmailer/test/phpunit.php b/lib/phpmailer/test/phpunit.php new file mode 100644 index 00000000000..1ce4cb9ed54 --- /dev/null +++ b/lib/phpmailer/test/phpunit.php @@ -0,0 +1,376 @@ + +// OntoSys, Inc +// +// $Id$ + +// 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)
    "; + $htmlExpected = htmlspecialchars($expected); + $htmlActual = htmlspecialchars($actual); + $str .= sprintf("
    %s\n--------\n%s
    ", + $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()
    \n"); + } + + function tearDown() /* possible override */ { + //print("TestCase::tearDown()
    \n"); + } + + //////////////////////////////////////////////////////////////// + + + function _createResult() /* protected */ { + /* override this to use specialized subclass of TestResult */ + return new TestResult; + } + + function fail($message=0) { + //printf("TestCase::fail(%s)
    \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('ERROR: ' . $message . '
    '); + $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("

    %s test%s run
    ", $nRun, ($nRun == 1) ? '' : 's'); + printf("%s failure%s.
    \n", $nFailures, ($nFailures == 1) ? '' : 's'); + if ($nFailures == 0) + return; + + print("

      \n"); + $failures = $this->getFailures(); + while (list($i, $failure) = each($failures)) { + $failedTestName = $failure->getTestName(); + printf("
    1. %s\n", $failedTestName); + + $exceptions = $failure->getExceptions(); + print("
        "); + while (list($na, $exception) = each($exceptions)) + printf("
      • %s\n", $exception->getMessage()); + print("
      "); + } + print("
    \n"); + } + + function _startTest($test) { + printf("%s ", $test->name()); + flush(); + } + + function _endTest($test) { + $outcome = $test->failed() + ? "FAIL" + : "ok"; + printf("$outcome
    \n"); + flush(); + } +} + + +class TestRunner { + /* Run a suite of tests and report results. */ + function run($suite) { + $result = new TextTestResult; + $suite->run($result); + $result->report(); + } +} + +?> diff --git a/lib/phpmailer/test/rocks.png b/lib/phpmailer/test/rocks.png new file mode 100644 index 0000000000000000000000000000000000000000..02de5a7aa3507dcec1e4349520ba3e8d8f7da4d6 GIT binary patch literal 1280 zcmeAS@N?(olHy`uVBq!ia0vp^tw5~K!2~4N<;e5_DVB6cUq=Rpjs4tz5?O(Kwj^(N z7lt)J7K6`}lP`c2XMsm#F#`j)5C}6~x?A@LD9B#o>FdgViCLDPN5AUi^*W$IwVp1H zAr*7p&f1@M+e+k^|GQka$^gd77pzXAva3|tw#@qU#D{GY+ZFCDwG1cEE579X#FX@$ z>FgwH&r=2B{84unZkVCiZ2N-g>I8;;hdm>XmCd=c^yvZlCI_MawKnqnCmAdw)?ZJ! z(AIo@e{`ec)BgLq2R?8-ZjY0&|8nTZLh)n#dkyMdw0?Bf?~$)c{BwaDo7B9IhZmN_ zh%E0uYH;3Pyt^=vfg$lt&fag6k0_-)7M*|G)$q*c&0lYID|HLld!D2e%F$=%SRuTY%I{2>Z{`vAZ>PV)}|}nN;w+U!QCIM z%dF3Q&h>n}=zwNb};ib(x>mdBz9tFM3#&2Z?-_RqK4ZYm+e055CrlA)a-UVpFR%v^PFVTssrYu_S`qZP4zZaccRhpt_9sylhjwpf+< z?Unnqytf|Oq_caOTOat-{V}jySM+ZLcry9!jFnfUInkZcQYhKM%L?N z&;!?rRVNa)m=6Fgxg2tDuEA9ET|#r_i?D{h*tzce28%w4!-tRgPZEBrw|%nx;k`%s zmfAYKyY+2b?$bqXn&r8-ISa3Ed-Xbga%WV_rQePT^77kD|K`Wu-}?6KQP#RWxwn}c zwyiVVWYOa4alSPF_O^E6V7L1351I46v}`n=eDeF}VulLinF~}7&9IfYQ}efLn#`@T z=<5}~4|Vgtn(q9aBQi8J`g;4eTzYtu=Z+lD zh7)#nVsqqgZL{jmKBw#CAyMYrd^hQ7_PL8!4qsoNfBW0BM@jw%&i;>o+4}Q$48E+4 clFJ|2pD+7py#+`y85}Sb4q9e08zkVlmGw# literal 0 HcmV?d00001