Skip to content

Commit

Permalink
Import PHPMailer 5.2.0 from apache project
Browse files Browse the repository at this point in the history
  • Loading branch information
Synchro committed Aug 23, 2011
1 parent 5b66110 commit cca7fc2
Show file tree
Hide file tree
Showing 63 changed files with 7,418 additions and 5,997 deletions.
338 changes: 169 additions & 169 deletions aboutus.html

Large diffs are not rendered by default.

823 changes: 415 additions & 408 deletions changelog.txt

Large diffs are not rendered by default.

539 changes: 346 additions & 193 deletions class.phpmailer.php

Large diffs are not rendered by default.

29 changes: 16 additions & 13 deletions class.pop3.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
/*~ class.pop3.php
.---------------------------------------------------------------------------.
| Software: PHPMailer - PHP email class |
| Version: 5.1 |
| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
| Info: http://phpmailer.sourceforge.net |
| Support: http://sourceforge.net/projects/phpmailer/ |
| Version: 5.2 |
| Site: https://code.google.com/a/apache-extras.org/p/phpmailer/ |
| ------------------------------------------------------------------------- |
| Admin: Andy Prevost (project admininistrator) |
| Admin: Jim Jagielski (project admininistrator) |
| Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net |
| : Marcus Bointon (coolbru) coolbru@users.sourceforge.net |
| : Jim Jagielski (jimjag) jimjag@gmail.com |
| Founder: Brent R. Matzelle (original founder) |
| Copyright (c) 2010-2011, Jim Jagielski. All Rights Reserved. |
| Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved. |
| Copyright (c) 2001-2003, Brent R. Matzelle |
| ------------------------------------------------------------------------- |
Expand All @@ -19,11 +19,6 @@
| This program is distributed in the hope that it will be useful - WITHOUT |
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. |
| ------------------------------------------------------------------------- |
| We offer a number of paid services (www.codeworxtech.com): |
| - Web Hosting on highly optimized fast and secure servers |
| - Technology Consulting |
| - Oursourcing (highly qualified programmers and graphic designers) |
'---------------------------------------------------------------------------'
*/

Expand All @@ -33,14 +28,16 @@
* @package PHPMailer
* @author Andy Prevost
* @author Marcus Bointon
* @author Jim Jagielski
* @copyright 2010 - 2011 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL)
* @version $Id$
* @version $Id: class.pop3.php 450 2010-06-23 16:46:33Z coolbru $
*/

/**
* POP Before SMTP Authentication Class
* Version 5.0.0
* Version 5.2.0
*
* Author: Richard Davey (rich@corephp.co.uk)
* Modifications: Andy Prevost
Expand Down Expand Up @@ -114,6 +111,12 @@ class POP3 {
*/
public $password;

/**
* Sets the POP3 PHPMailer Version number
* @var string
*/
public $Version = '5.2';

/////////////////////////////////////////////////
// PROPERTIES, PRIVATE AND PROTECTED
/////////////////////////////////////////////////
Expand Down Expand Up @@ -404,4 +407,4 @@ private function catchWarning ($errno, $errstr, $errfile, $errline) {

// End of class
}
?>
?>
27 changes: 15 additions & 12 deletions class.smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
/*~ class.smtp.php
.---------------------------------------------------------------------------.
| Software: PHPMailer - PHP email class |
| Version: 5.1 |
| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
| Info: http://phpmailer.sourceforge.net |
| Support: http://sourceforge.net/projects/phpmailer/ |
| Version: 5.2 |
| Site: https://code.google.com/a/apache-extras.org/p/phpmailer/ |
| ------------------------------------------------------------------------- |
| Admin: Andy Prevost (project admininistrator) |
| Admin: Jim Jagielski (project admininistrator) |
| Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net |
| : Marcus Bointon (coolbru) coolbru@users.sourceforge.net |
| : Jim Jagielski (jimjag) jimjag@gmail.com |
| Founder: Brent R. Matzelle (original founder) |
| Copyright (c) 2010-2011, Jim Jagielski. All Rights Reserved. |
| Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved. |
| Copyright (c) 2001-2003, Brent R. Matzelle |
| ------------------------------------------------------------------------- |
Expand All @@ -19,11 +19,6 @@
| This program is distributed in the hope that it will be useful - WITHOUT |
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. |
| ------------------------------------------------------------------------- |
| We offer a number of paid services (www.codeworxtech.com): |
| - Web Hosting on highly optimized fast and secure servers |
| - Technology Consulting |
| - Oursourcing (highly qualified programmers and graphic designers) |
'---------------------------------------------------------------------------'
*/

Expand All @@ -34,8 +29,10 @@
* @author Andy Prevost
* @author Marcus Bointon
* @copyright 2004 - 2008 Andy Prevost
* @author Jim Jagielski
* @copyright 2010 - 2011 Jim Jagielski
* @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL)
* @version $Id$
* @version $Id: class.smtp.php 450 2010-06-23 16:46:33Z coolbru $
*/

/**
Expand Down Expand Up @@ -71,6 +68,12 @@ class SMTP {
*/
public $do_verp = false;

/**
* Sets the SMTP PHPMailer Version number
* @var string
*/
public $Version = '5.2';

/////////////////////////////////////////////////
// PROPERTIES, PRIVATE AND PROTECTED
/////////////////////////////////////////////////
Expand Down Expand Up @@ -811,4 +814,4 @@ private function get_lines() {

}

?>
?>
17 changes: 17 additions & 0 deletions docs/Callback_function_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
NEW CALLBACK FUNCTION:
======================

We have had requests for a method to process the results of sending emails
through PHPMailer. In this new release, we have implemented a callback
function that passes the results of each email sent (to, cc, and/or bcc).
We have provided an example that echos the results back to the screen. The
callback function can be used for any purpose. With minor modifications, the
callback function can be used to create CSV logs, post results to databases,
etc.

Please review the test.php script for the example.

It's pretty straight forward.

Enjoy!
Andy
55 changes: 55 additions & 0 deletions docs/DomainKeys_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
CREATE DKIM KEYS and DNS Resource Record:
=========================================

To create DomainKeys Identified Mail keys, visit:
http://dkim.worxware.com/
... read the information, fill in the form, and download the ZIP file
containing the public key, private key, DNS Resource Record and instructions
to add to your DNS Zone Record, and the PHPMailer code to enable DKIM
digital signing.

/*** PROTECT YOUR PRIVATE & PUBLIC KEYS ***/

You need to protect your DKIM private and public keys from being viewed or
accessed. Add protection to your .htaccess file as in this example:

# secure htkeyprivate file
<Files .htkeyprivate>
order allow,deny
deny from all
</Files>

# secure htkeypublic file
<Files .htkeypublic>
order allow,deny
deny from all
</Files>

(the actual .htaccess additions are in the ZIP file sent back to you from
http://dkim.worxware.com/

A few notes on using DomainKey Identified Mail (DKIM):

You do not need to use PHPMailer to DKIM sign emails IF:
- you enable DomainKey support and add the DNS resource record
- you use your outbound mail server

If you are a third-party emailer that works on behalf of domain owners to
send their emails from your own server:
- you absolutely have to DKIM sign outbound emails
- the domain owner has to add the DNS resource record to match the
private key, public key, selector, identity, and domain that you create
- use caution with the "selector" ... at least one "selector" will already
exist in the DNS Zone Record of the domain at the domain owner's server
you need to ensure that the "selector" you use is unique
Note: since the IP address will not match the domain owner's DNS Zone record
you can be certain that email providers that validate based on DomainKey will
check the domain owner's DNS Zone record for your DNS resource record. Before
sending out emails on behalf of domain owners, ensure they have entered the
DNS resource record you provided them.

Enjoy!
Andy

PS. if you need additional information about DKIM, please see:
http://www.dkim.org/info/dkim-faq.html
23 changes: 23 additions & 0 deletions docs/Note_for_SMTP_debugging.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
If you are having problems connecting or sending emails through your SMTP server, please note:

1. The new rewrite of class.smtp.php provides more information about the processing/errors taking place
2. Use the debug functionality of class.smtp.php. To do that, in your own script add the debug level you wish to use. An example of that is:

$mail->SMTPDebug = 1;
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 26; // set the SMTP port
$mail->Host = "mail.yourhost.com"; // SMTP server
$mail->Username = "name@yourhost.com"; // SMTP account username
$mail->Password = "your password"; // SMTP account password

Notes on this:
$mail->SMTPDebug = 0; ... will disable debugging (you can also leave this out completely, 0 is the default
$mail->SMTPDebug = 1; ... will echo errors and messages
$mail->SMTPDebug = 2; ... will echo messages only
... and finally, the options are 0, 1, and 2 ... any number greater than 2 will be interpreted as 2

And finally, don't forget to disable debugging before going into production.

Enjoy!
Andy
148 changes: 148 additions & 0 deletions docs/extending.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<html>
<head>
<title>Examples using phpmailer</title>
</head>

<body bgcolor="#FFFFFF">

<h2>Examples using phpmailer</h2>

<h3>1. Advanced Example</h3>
<p>

This demonstrates sending out multiple email messages with binary attachments
from a MySQL database with multipart/alternative support.<p>
<table cellpadding="4" border="1" width="80%">
<tr>
<td bgcolor="#CCCCCC">
<pre>
require("class.phpmailer.php");

$mail = new phpmailer();

$mail->From = "list@example.com";
$mail->FromName = "List manager";
$mail->Host = "smtp1.example.com;smtp2.example.com";
$mail->Mailer = "smtp";

@MYSQL_CONNECT("localhost","root","password");
@mysql_select_db("my_company");
$query  = "SELECT full_name, email, photo FROM employee WHERE id=$id";
$result = @MYSQL_QUERY($query);

while ($row = mysql_fetch_array ($result))
{
// HTML body
$body = "Hello &lt;font size=\"4\"&gt;" . $row["full_name"] . "&lt;/font&gt;, &lt;p&gt;";
$body .= "&lt;i&gt;Your&lt;/i&gt; personal photograph to this message.&lt;p&gt;";
$body .= "Sincerely, &lt;br&gt;";
$body .= "phpmailer List manager";

// Plain text body (for mail clients that cannot read HTML)
$text_body = "Hello " . $row["full_name"] . ", \n\n";
$text_body .= "Your personal photograph to this message.\n\n";
$text_body .= "Sincerely, \n";
$text_body .= "phpmailer List manager";

$mail->Body = $body;
$mail->AltBody = $text_body;
$mail->AddAddress($row["email"], $row["full_name"]);
$mail->AddStringAttachment($row["photo"], "YourPhoto.jpg");

if(!$mail->Send())
echo "There has been a mail error sending to " . $row["email"] . "&lt;br&gt;";

// Clear all addresses and attachments for next loop
$mail->ClearAddresses();
$mail->ClearAttachments();
}
</pre>
</td>
</tr>
</table>
<p>

<h3>2. Extending phpmailer</h3>
<p>

Extending classes with inheritance is one of the most
powerful features of object-oriented
programming. It allows you to make changes to the
original class for your
own personal use without hacking the original
classes. Plus, it is very
easy to do. I've provided an example:

<p>
Here's a class that extends the phpmailer class and sets the defaults
for the particular site:<br>
PHP include file: <b>mail.inc.php</b>
<p>

<table cellpadding="4" border="1" width="80%">
<tr>
<td bgcolor="#CCCCCC">
<pre>
require("class.phpmailer.php");

class my_phpmailer extends phpmailer {
// Set default variables for all new objects
var $From = "from@example.com";
var $FromName = "Mailer";
var $Host = "smtp1.example.com;smtp2.example.com";
var $Mailer = "smtp"; // Alternative to IsSMTP()
var $WordWrap = 75;

// Replace the default error_handler
function error_handler($msg) {
print("My Site Error");
print("Description:");
printf("%s", $msg);
exit;
}

// Create an additional function
function do_something($something) {
// Place your new code here
}
}
</td>
</tr>
</table>
<br>

Now here's a normal PHP page in the site, which will have all the defaults set
above:<br>
Normal PHP file: <b>mail_test.php</b>
<p>

<table cellpadding="4" border="1" width="80%">
<tr>
<td bgcolor="#CCCCCC">
<pre>
require("mail.inc.php");

// Instantiate your new class
$mail = new my_phpmailer;

// Now you only need to add the necessary stuff
$mail->AddAddress("josh@example.com", "Josh Adams");
$mail->Subject = "Here is the subject";
$mail->Body = "This is the message body";
$mail->AddAttachment("c:/temp/11-10-00.zip", "new_name.zip"); // optional name

if(!$mail->Send())
{
echo "There was an error sending the message";
exit;
}

echo "Message was sent successfully";
</pre>
</td>
</tr>
</table>
</p>

</body>
</html>
Loading

0 comments on commit cca7fc2

Please sign in to comment.