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