First commit

This commit is contained in:
Pierre Hubert
2016-11-19 12:08:12 +01:00
commit 990540b2b9
4706 changed files with 931207 additions and 0 deletions

View File

@ -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
3rdparty/phpmailer/docs/DomainKeys_notes.txt vendored Executable file
View File

@ -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

View File

@ -0,0 +1,17 @@
If you are having problems connecting or sending emails through your SMTP server, the SMTP class can provide more information about the processing/errors taking place.
Use the debug functionality of the class to see what's going on in your connections. To do that, set the debug level in your script. For example:
$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 server responses
$mail->SMTPDebug = 2; ... will echo errors, server responses and client messages
And finally, don't forget to disable debugging before going into production.

129
3rdparty/phpmailer/docs/extending.html vendored Executable file
View File

@ -0,0 +1,129 @@
<html>
<head>
<title>Examples using phpmailer</title>
</head>
<body>
<h2>Examples using PHPMailer</h2>
<h3>1. Advanced Example</h3>
<p>
This demonstrates sending multiple email messages with binary attachments
from a MySQL database using multipart/alternative messages.<p>
<pre>
require 'PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->From = 'list@example.com';
$mail->FromName = 'List manager';
$mail->Host = 'smtp1.example.com;smtp2.example.com';
$mail->Mailer = 'smtp';
@mysqli_connect('localhost','root','password');
@mysqli_select_db("my_company");
$query = "SELECT full_name, email, photo FROM employee";
$result = @mysqli_query($query);
while ($row = mysqli_fetch_assoc($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>
<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, and it's very easy to do:
<p>
Here's a class that extends the phpmailer class and sets the defaults
for the particular site:<br>
PHP include file: my_phpmailer.php
<p>
<pre>
require 'PHPMailerAutoload.php';
class my_phpmailer extends PHPMailer {
// Set default variables for all new objects
public $From = 'from@example.com';
public $FromName = 'Mailer';
public $Host = 'smtp1.example.com;smtp2.example.com';
public $Mailer = 'smtp'; // Alternative to isSMTP()
public $WordWrap = 75;
// Replace the default debug output function
protected function edebug($msg) {
print('My Site Error');
print('Description:');
printf('%s', $msg);
exit;
}
//Extend the send function
public function send() {
$this->Subject = '[Yay for me!] '.$this->Subject;
return parent::send()
}
// Create an additional function
public function do_something($something) {
// Place your new code here
}
}
</pre>
<br>
Now here's a normal PHP page in the site, which will have all the defaults set above:<br>
<pre>
require 'my_phpmailer.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>
</body>
</html>

28
3rdparty/phpmailer/docs/faq.html vendored Executable file
View File

@ -0,0 +1,28 @@
<html>
<head>
<title>PHPMailer FAQ</title>
</head>
<body>
<h2>PHPMailer FAQ</h2>
<ul>
<li><strong>Q: I am concerned that using include files will take up too much
processing time on my computer. How can I make it run faster?</strong><br>
<strong>A:</strong> PHP by itself is fairly fast, but it recompiles scripts every time they are run, which takes up valuable
computer resources. You can bypass this by using an opcode cache which compiles
PHP code and store it in memory to reduce overhead immensely. <a href="http://www.php.net/apc/">APC
(Alternative PHP Cache)</a> is a free opcode cache extension in the PECL library.</li>
<li><strong>Q: Which mailer gives me the best performance?</strong><br>
<strong>A:</strong> On a single machine the <strong>sendmail (or Qmail)</strong> is fastest overall.
Next fastest is mail() to give you the best performance. Both do not have the overhead of SMTP.
If you do not have a local mail server (as is typical on Windows), SMTP is your only option.</li>
<li><strong>Q: When I try to attach a file with on my server I get a
"Could not find {file} on filesystem error". Why is this?</strong><br>
<strong>A:</strong> If you are using a Unix machine this is probably because the user
running your web server does not have read access to the directory in question. If you are using Windows,
then the problem is probably that you have used single backslashes to denote directories (\).
A single backslash has a special meaning to PHP so these are not
valid. Instead use double backslashes ("\\") or a single forward
slash ("/").</li>
</ul>
</body>
</html>

8
3rdparty/phpmailer/docs/generatedocs.sh vendored Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
# Regenerate PHPMailer documentation
# Run from within the docs folder
rm -rf phpdoc/*
phpdoc --directory .. --target ./phpdoc --ignore test/,examples/,extras/,test_script/,vendor/,language/ --sourcecode --force --title PHPMailer --template="clean"
# You can merge regenerated docs into a separate docs working copy without messing up the git status like so:
# rsync -a --delete --exclude ".git" --exclude "phpdoc-cache-*/" --exclude "README.md" phpdoc/ ../../phpmailer-docs
# After updating docs, push/PR them to the phpmailer gh-pages branch: https://github.com/PHPMailer/PHPMailer/tree/gh-pages

50
3rdparty/phpmailer/docs/pop3_article.txt vendored Executable file
View File

@ -0,0 +1,50 @@
This is built for PHP Mailer 1.72 and was not tested with any previous version. It was developed under PHP 4.3.11 (E_ALL). It works under PHP 5 and 5.1 with E_ALL, but not in Strict mode due to var deprecation (but then neither does PHP Mailer either!). It follows the RFC 1939 standard explicitly and is fully commented.
With that noted, here is how to implement it:
I didn't want to modify the PHP Mailer classes at all, so you will have to include/require this class along with the base one. It can sit quite happily in the phpmailer directory.
When you need it, create your POP3 object
Right before I invoke PHP Mailer I activate the POP3 authorisation. POP3 before SMTP is a process whereby you login to your web hosts POP3 mail server BEFORE sending out any emails via SMTP. The POP3 logon 'verifies' your ability to send email by SMTP, which typically otherwise blocks you. On my web host (Pair Networks) a single POP3 logon is enough to 'verify' you for 90 minutes. Here is some sample PHP code that activates the POP3 logon and then sends an email via PHP Mailer:
<?php
$pop->authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1);
$mail = new PHPMailer(); $mail->SMTPDebug = 2; $mail->isSMTP();
$mail->isHTML(false); $mail->Host = 'relay.example.com';
$mail->From = 'mailer@example.com';
$mail->FromName = 'Example Mailer';
$mail->Subject = 'My subject';
$mail->Body = 'Hello world';
$mail->addAddress('rich@corephp.co.uk', 'Richard Davey');
if (!$mail->send()) {
echo $mail->ErrorInfo;
}
?>
The PHP Mailer parts of this code should be obvious to anyone who has used PHP Mailer before. One thing to note - you almost certainly will not need to use SMTP Authentication *and* POP3 before SMTP together. The Authorisation method is a proxy method to all of the others within that class. There are connect, Logon and disconnect methods available, but I wrapped them in the single Authorisation one to make things easier.
The Parameters
The authorise parameters are as follows:
$pop->authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1);
1. pop3.example.com - The POP3 Mail Server Name (hostname or IP address)
2. 110 - The POP3 Port on which to connect (default is usually 110, but check with your host)
3. 30 - A connection time-out value (in seconds)
4. mailer - The POP3 Username required to logon
5. password - The POP3 Password required to logon
6. 1 - The class debug level (0 = off, 1+ = debug output is echoed to the browser)
Final Comments + the Download
1) This class does not support APOP connections. This is only because I did not have an APOP server to test with, but if you'd like to see that added just contact me.
2) Opening and closing lots of POP3 connections can be quite a resource/network drain. If you need to send a whole batch of emails then just perform the authentication once at the start, and then loop through your mail sending script. Providing this process doesn't take longer than the verification period lasts on your POP3 server, you should be fine. With my host that period is 90 minutes, i.e. plenty of time.
3) If you have heavy requirements for this script (i.e. send a LOT of email on a frequent basis) then I would advise seeking out an alternative sending method (direct SMTP ideally). If this isn't possible then you could modify this class so the 'last authorised' date is recorded somewhere (MySQL, Flat file, etc) meaning you only open a new connection if the old one has expired, saving you precious overhead.
4) There are lots of other POP3 classes for PHP available. However most of them implement the full POP3 command set, where-as this one is purely for authentication, and much lighter as a result. However using any of the other POP3 classes to just logon to your server would have the same net result. At the end of the day, use whatever method you feel most comfortable with.
Download
My thanks to Chris Ryan for the inspiration (even if indirectly, via his SMTP class)