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