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