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