FINAL suepr merge step : added all modules to this super repos
This commit is contained in:
20
sites/all/libraries/phpmailer/examples/contents.html
Normal file
20
sites/all/libraries/phpmailer/examples/contents.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<body style="margin: 10px;">
|
||||
<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
|
||||
<div align="center"><img src="images/phpmailer.gif" style="height: 90px; width: 340px"></div><br>
|
||||
<br>
|
||||
This is a test of PHPMailer.<br>
|
||||
<br>
|
||||
This particular example uses <strong>HTML</strong>, with a <div> tag and inline<br>
|
||||
styles.<br>
|
||||
<br>
|
||||
Also note the use of the PHPMailer logo above with no specific code to handle
|
||||
including it.<br />
|
||||
Included are two attachments:<br />
|
||||
phpmailer.gif is an attachment and used inline as a graphic (above)<br />
|
||||
phpmailer_mini.gif is an attachment<br />
|
||||
<br />
|
||||
PHPMailer:<br />
|
||||
Author: Andy Prevost (codeworxtech@users.sourceforge.net)<br />
|
||||
Author: Marcus Bointon (coolbru@users.sourceforge.net)<br />
|
||||
</div>
|
||||
</body>
|
BIN
sites/all/libraries/phpmailer/examples/images/phpmailer.gif
Normal file
BIN
sites/all/libraries/phpmailer/examples/images/phpmailer.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
BIN
sites/all/libraries/phpmailer/examples/images/phpmailer_mini.gif
Normal file
BIN
sites/all/libraries/phpmailer/examples/images/phpmailer_mini.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
49
sites/all/libraries/phpmailer/examples/index.html
Normal file
49
sites/all/libraries/phpmailer/examples/index.html
Normal file
@@ -0,0 +1,49 @@
|
||||
This release of PHPMailer (v5.0.0) sets a new milestone in the development
|
||||
cycle of PHPMailer. First, class.phpmailer.php has a small footprint (65.7 Kb),
|
||||
while class.smtp.php is even smaller than before (at only 25.0 Kb).<br />
|
||||
<br />
|
||||
We have maintained all functionality and added Exception handling unique to
|
||||
PHP 5/6.<br />
|
||||
<br />
|
||||
There is only one function that has been removed: that is getFile(). The reason
|
||||
for this is that getFile() became a wrapper for the PHP function 'file_get_contents()'
|
||||
and nothing more. Rather than burden the class with a function already available
|
||||
in PHP, we decided to remove it.<br />
|
||||
<br />
|
||||
Our new Exception handling provides your own scripts far more power than ever.<br />
|
||||
<br />
|
||||
We have also enhanced the "packaging" of PHPMailer with an entirely new set of
|
||||
examples. Included are both basic and advanced examples showing how you can take
|
||||
advantage of PHP Exception handling to improve your own scripts.<br />
|
||||
<br />
|
||||
A few things to note about PHPMailer:
|
||||
<ul>
|
||||
<li>the use of $mail->AltBody is completely optional. If not used, PHPMailer
|
||||
will use the HTML text with htmlentities().<br />
|
||||
We also highly recommend using HTML2Text authored by Jon Abernathy. The class description
|
||||
and download can be viewed at: http://www.chuggnutt.com/html2text.php.
|
||||
</li>
|
||||
<li>there is no specific code to define image or attachment types ... that is handled
|
||||
automatically by PHPMailer when it parses the images</li>
|
||||
</ul>
|
||||
A note to users that want to use SMTP with PHPMailer. The most common problems are:
|
||||
<ul>
|
||||
<li>wrong port ... most ISP (Internet Service Providers) will not allow relaying through
|
||||
their servers. If that's the case with your ISP, try using port 26.
|
||||
</li>
|
||||
<li>wrong authentication information (username and/or password) ... don't forget that
|
||||
many servers require the account name to be in the format of the full email address.
|
||||
</li>
|
||||
<li>... if these tips do not get your SMTP settings working, we have a debug mode
|
||||
for helping you determine the problem. Insert this after $mail->IsSMTP();<br />
|
||||
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)<br />
|
||||
note that a setting of 2 will display all errors and messages generated by the SMTP
|
||||
server<br />
|
||||
</li>
|
||||
</ul>
|
||||
Our examples all use an HTML file in the /examples folder. To see what the email SHOULD
|
||||
look like in your HTML compatible email viewer: <a href="contents.html">click here</a><br>
|
||||
<br />
|
||||
From the PHPMailer team:<br />
|
||||
Author: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net (and Project Administrator)<br />
|
||||
Author: Marcus Bointon (coolbru) coolbru@users.sourceforge.net<br />
|
@@ -0,0 +1,58 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>PHPMailer - MySQL Database - SMTP basic test with authentication</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
|
||||
//error_reporting(E_ALL);
|
||||
error_reporting(E_STRICT);
|
||||
|
||||
date_default_timezone_set('America/Toronto');
|
||||
|
||||
require_once('../class.phpmailer.php');
|
||||
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
|
||||
|
||||
$mail = new PHPMailer();
|
||||
|
||||
$body = file_get_contents('contents.html');
|
||||
$body = eregi_replace("[\]",'',$body);
|
||||
|
||||
$mail->IsSMTP(); // telling the class to use SMTP
|
||||
$mail->Host = "smtp1.site.com;smtp2.site.com";
|
||||
$mail->SMTPAuth = true; // enable SMTP authentication
|
||||
$mail->SMTPKeepAlive = true; // SMTP connection will not close after each email sent
|
||||
$mail->Host = "mail.yourdomain.com"; // sets the SMTP server
|
||||
$mail->Port = 26; // set the SMTP port for the GMAIL server
|
||||
$mail->Username = "yourname@yourdomain"; // SMTP account username
|
||||
$mail->Password = "yourpassword"; // SMTP account password
|
||||
$mail->SetFrom('list@mydomain.com', 'List manager');
|
||||
$mail->AddReplyTo('list@mydomain.com', 'List manager');
|
||||
|
||||
$mail->Subject = "PHPMailer Test Subject via smtp, basic with authentication";
|
||||
|
||||
@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)) {
|
||||
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
|
||||
$mail->MsgHTML($body);
|
||||
$mail->AddAddress($row["email"], $row["full_name"]);
|
||||
$mail->AddStringAttachment($row["photo"], "YourPhoto.jpg");
|
||||
|
||||
if(!$mail->Send()) {
|
||||
echo "Mailer Error (" . str_replace("@", "@", $row["email"]) . ') ' . $mail->ErrorInfo . '<br />';
|
||||
} else {
|
||||
echo "Message sent to :" . $row["full_name"] . ' (' . str_replace("@", "@", $row["email"]) . ')<br />';
|
||||
}
|
||||
// Clear all addresses and attachments for next loop
|
||||
$mail->ClearAddresses();
|
||||
$mail->ClearAttachments();
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,31 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>PHPMailer - Mail() advanced test</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
require_once '../class.phpmailer.php';
|
||||
|
||||
$mail = new PHPMailer(true); //defaults to using php "mail()"; the true param means it will throw exceptions on errors, which we need to catch
|
||||
|
||||
try {
|
||||
$mail->AddReplyTo('name@yourdomain.com', 'First Last');
|
||||
$mail->AddAddress('whoto@otherdomain.com', 'John Doe');
|
||||
$mail->SetFrom('name@yourdomain.com', 'First Last');
|
||||
$mail->AddReplyTo('name@yourdomain.com', 'First Last');
|
||||
$mail->Subject = 'PHPMailer Test Subject via mail(), advanced';
|
||||
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
|
||||
$mail->MsgHTML(file_get_contents('contents.html'));
|
||||
$mail->AddAttachment('images/phpmailer.gif'); // attachment
|
||||
$mail->AddAttachment('images/phpmailer_mini.gif'); // attachment
|
||||
$mail->Send();
|
||||
echo "Message Sent OK</p>\n";
|
||||
} catch (phpmailerException $e) {
|
||||
echo $e->errorMessage(); //Pretty error messages from PHPMailer
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(); //Boring error messages from anything else!
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
43
sites/all/libraries/phpmailer/examples/test_mail_basic.php
Normal file
43
sites/all/libraries/phpmailer/examples/test_mail_basic.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>PHPMailer - Mail() basic test</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
|
||||
require_once('../class.phpmailer.php');
|
||||
|
||||
$mail = new PHPMailer(); // defaults to using php "mail()"
|
||||
|
||||
$body = file_get_contents('contents.html');
|
||||
$body = eregi_replace("[\]",'',$body);
|
||||
|
||||
$mail->AddReplyTo("name@yourdomain.com","First Last");
|
||||
|
||||
$mail->SetFrom('name@yourdomain.com', 'First Last');
|
||||
|
||||
$mail->AddReplyTo("name@yourdomain.com","First Last");
|
||||
|
||||
$address = "whoto@otherdomain.com";
|
||||
$mail->AddAddress($address, "John Doe");
|
||||
|
||||
$mail->Subject = "PHPMailer Test Subject via mail(), basic";
|
||||
|
||||
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
|
||||
|
||||
$mail->MsgHTML($body);
|
||||
|
||||
$mail->AddAttachment("images/phpmailer.gif"); // attachment
|
||||
$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
|
||||
|
||||
if(!$mail->Send()) {
|
||||
echo "Mailer Error: " . $mail->ErrorInfo;
|
||||
} else {
|
||||
echo "Message sent!";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,40 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>POP before SMTP Test</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
require_once('../class.phpmailer.php');
|
||||
require_once('../class.pop3.php'); // required for POP before SMTP
|
||||
|
||||
$pop = new POP3();
|
||||
$pop->Authorise('pop3.yourdomain.com', 110, 30, 'username', 'password', 1);
|
||||
|
||||
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
|
||||
|
||||
$mail->IsSMTP();
|
||||
|
||||
try {
|
||||
$mail->SMTPDebug = 2;
|
||||
$mail->Host = 'pop3.yourdomain.com';
|
||||
$mail->AddReplyTo('name@yourdomain.com', 'First Last');
|
||||
$mail->AddAddress('whoto@otherdomain.com', 'John Doe');
|
||||
$mail->SetFrom('name@yourdomain.com', 'First Last');
|
||||
$mail->AddReplyTo('name@yourdomain.com', 'First Last');
|
||||
$mail->Subject = 'PHPMailer Test Subject via mail(), advanced';
|
||||
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
|
||||
$mail->MsgHTML(file_get_contents('contents.html'));
|
||||
$mail->AddAttachment('images/phpmailer.gif'); // attachment
|
||||
$mail->AddAttachment('images/phpmailer_mini.gif'); // attachment
|
||||
$mail->Send();
|
||||
echo "Message Sent OK</p>\n";
|
||||
} catch (phpmailerException $e) {
|
||||
echo $e->errorMessage(); //Pretty error messages from PHPMailer
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(); //Boring error messages from anything else!
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,49 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>POP before SMTP Test</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
require_once('../class.phpmailer.php');
|
||||
require_once('../class.pop3.php'); // required for POP before SMTP
|
||||
|
||||
$pop = new POP3();
|
||||
$pop->Authorise('pop3.yourdomain.com', 110, 30, 'username', 'password', 1);
|
||||
|
||||
$mail = new PHPMailer();
|
||||
|
||||
$body = file_get_contents('contents.html');
|
||||
$body = eregi_replace("[\]",'',$body);
|
||||
|
||||
$mail->IsSMTP();
|
||||
$mail->SMTPDebug = 2;
|
||||
$mail->Host = 'pop3.yourdomain.com';
|
||||
|
||||
$mail->SetFrom('name@yourdomain.com', 'First Last');
|
||||
|
||||
$mail->AddReplyTo("name@yourdomain.com","First Last");
|
||||
|
||||
$mail->Subject = "PHPMailer Test Subject via POP before SMTP, basic";
|
||||
|
||||
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
|
||||
|
||||
$mail->MsgHTML($body);
|
||||
|
||||
$address = "whoto@otherdomain.com";
|
||||
$mail->AddAddress($address, "John Doe");
|
||||
|
||||
$mail->AddAttachment("images/phpmailer.gif"); // attachment
|
||||
$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
|
||||
|
||||
|
||||
if(!$mail->Send()) {
|
||||
echo "Mailer Error: " . $mail->ErrorInfo;
|
||||
} else {
|
||||
echo "Message sent!";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,34 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>PHPMailer - Sendmail advanced test</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
|
||||
require_once('../class.phpmailer.php');
|
||||
|
||||
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
|
||||
$mail->IsSendmail(); // telling the class to use SendMail transport
|
||||
|
||||
try {
|
||||
$mail->AddReplyTo('name@yourdomain.com', 'First Last');
|
||||
$mail->AddAddress('whoto@otherdomain.com', 'John Doe');
|
||||
$mail->SetFrom('name@yourdomain.com', 'First Last');
|
||||
$mail->AddReplyTo('name@yourdomain.com', 'First Last');
|
||||
$mail->Subject = 'PHPMailer Test Subject via mail(), advanced';
|
||||
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
|
||||
$mail->MsgHTML(file_get_contents('contents.html'));
|
||||
$mail->AddAttachment('images/phpmailer.gif'); // attachment
|
||||
$mail->AddAttachment('images/phpmailer_mini.gif'); // attachment
|
||||
$mail->Send();
|
||||
echo "Message Sent OK</p>\n";
|
||||
} catch (phpmailerException $e) {
|
||||
echo $e->errorMessage(); //Pretty error messages from PHPMailer
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(); //Boring error messages from anything else!
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,45 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>PHPMailer - Sendmail basic test</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
|
||||
require_once('../class.phpmailer.php');
|
||||
|
||||
$mail = new PHPMailer(); // defaults to using php "mail()"
|
||||
|
||||
$mail->IsSendmail(); // telling the class to use SendMail transport
|
||||
|
||||
$body = file_get_contents('contents.html');
|
||||
$body = eregi_replace("[\]",'',$body);
|
||||
|
||||
$mail->AddReplyTo("name@yourdomain.com","First Last");
|
||||
|
||||
$mail->SetFrom('name@yourdomain.com', 'First Last');
|
||||
|
||||
$mail->AddReplyTo("name@yourdomain.com","First Last");
|
||||
|
||||
$address = "whoto@otherdomain.com";
|
||||
$mail->AddAddress($address, "John Doe");
|
||||
|
||||
$mail->Subject = "PHPMailer Test Subject via Sendmail, basic";
|
||||
|
||||
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
|
||||
|
||||
$mail->MsgHTML($body);
|
||||
|
||||
$mail->AddAttachment("images/phpmailer.gif"); // attachment
|
||||
$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
|
||||
|
||||
if(!$mail->Send()) {
|
||||
echo "Mailer Error: " . $mail->ErrorInfo;
|
||||
} else {
|
||||
echo "Message sent!";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,43 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>PHPMailer - SMTP advanced test with authentication</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
|
||||
require_once('../class.phpmailer.php');
|
||||
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
|
||||
|
||||
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
|
||||
|
||||
$mail->IsSMTP(); // telling the class to use SMTP
|
||||
|
||||
try {
|
||||
$mail->Host = "mail.yourdomain.com"; // SMTP server
|
||||
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
|
||||
$mail->SMTPAuth = true; // enable SMTP authentication
|
||||
$mail->Host = "mail.yourdomain.com"; // sets the SMTP server
|
||||
$mail->Port = 26; // set the SMTP port for the GMAIL server
|
||||
$mail->Username = "yourname@yourdomain"; // SMTP account username
|
||||
$mail->Password = "yourpassword"; // SMTP account password
|
||||
$mail->AddReplyTo('name@yourdomain.com', 'First Last');
|
||||
$mail->AddAddress('whoto@otherdomain.com', 'John Doe');
|
||||
$mail->SetFrom('name@yourdomain.com', 'First Last');
|
||||
$mail->AddReplyTo('name@yourdomain.com', 'First Last');
|
||||
$mail->Subject = 'PHPMailer Test Subject via mail(), advanced';
|
||||
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
|
||||
$mail->MsgHTML(file_get_contents('contents.html'));
|
||||
$mail->AddAttachment('images/phpmailer.gif'); // attachment
|
||||
$mail->AddAttachment('images/phpmailer_mini.gif'); // attachment
|
||||
$mail->Send();
|
||||
echo "Message Sent OK</p>\n";
|
||||
} catch (phpmailerException $e) {
|
||||
echo $e->errorMessage(); //Pretty error messages from PHPMailer
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(); //Boring error messages from anything else!
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,37 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>PHPMailer - SMTP advanced test with no authentication</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
require_once('../class.phpmailer.php');
|
||||
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
|
||||
|
||||
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
|
||||
|
||||
$mail->IsSMTP(); // telling the class to use SMTP
|
||||
|
||||
try {
|
||||
$mail->Host = "mail.yourdomain.com"; // SMTP server
|
||||
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
|
||||
$mail->AddReplyTo('name@yourdomain.com', 'First Last');
|
||||
$mail->AddAddress('whoto@otherdomain.com', 'John Doe');
|
||||
$mail->SetFrom('name@yourdomain.com', 'First Last');
|
||||
$mail->AddReplyTo('name@yourdomain.com', 'First Last');
|
||||
$mail->Subject = 'PHPMailer Test Subject via mail(), advanced';
|
||||
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
|
||||
$mail->MsgHTML(file_get_contents('contents.html'));
|
||||
$mail->AddAttachment('images/phpmailer.gif'); // attachment
|
||||
$mail->AddAttachment('images/phpmailer_mini.gif'); // attachment
|
||||
$mail->Send();
|
||||
echo "Message Sent OK</p>\n";
|
||||
} catch (phpmailerException $e) {
|
||||
echo $e->errorMessage(); //Pretty error messages from PHPMailer
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(); //Boring error messages from anything else!
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
58
sites/all/libraries/phpmailer/examples/test_smtp_basic.php
Normal file
58
sites/all/libraries/phpmailer/examples/test_smtp_basic.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>PHPMailer - SMTP basic test with authentication</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
|
||||
//error_reporting(E_ALL);
|
||||
error_reporting(E_STRICT);
|
||||
|
||||
date_default_timezone_set('America/Toronto');
|
||||
|
||||
require_once('../class.phpmailer.php');
|
||||
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
|
||||
|
||||
$mail = new PHPMailer();
|
||||
|
||||
$body = file_get_contents('contents.html');
|
||||
$body = eregi_replace("[\]",'',$body);
|
||||
|
||||
$mail->IsSMTP(); // telling the class to use SMTP
|
||||
$mail->Host = "mail.yourdomain.com"; // SMTP server
|
||||
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
|
||||
// 1 = errors and messages
|
||||
// 2 = messages only
|
||||
$mail->SMTPAuth = true; // enable SMTP authentication
|
||||
$mail->Host = "mail.yourdomain.com"; // sets the SMTP server
|
||||
$mail->Port = 26; // set the SMTP port for the GMAIL server
|
||||
$mail->Username = "yourname@yourdomain"; // SMTP account username
|
||||
$mail->Password = "yourpassword"; // SMTP account password
|
||||
|
||||
$mail->SetFrom('name@yourdomain.com', 'First Last');
|
||||
|
||||
$mail->AddReplyTo("name@yourdomain.com","First Last");
|
||||
|
||||
$mail->Subject = "PHPMailer Test Subject via smtp, basic with authentication";
|
||||
|
||||
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
|
||||
|
||||
$mail->MsgHTML($body);
|
||||
|
||||
$address = "whoto@otherdomain.com";
|
||||
$mail->AddAddress($address, "John Doe");
|
||||
|
||||
$mail->AddAttachment("images/phpmailer.gif"); // attachment
|
||||
$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
|
||||
|
||||
if(!$mail->Send()) {
|
||||
echo "Mailer Error: " . $mail->ErrorInfo;
|
||||
} else {
|
||||
echo "Message sent!";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,53 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>PHPMailer - SMTP basic test with no authentication</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
|
||||
//error_reporting(E_ALL);
|
||||
error_reporting(E_STRICT);
|
||||
|
||||
date_default_timezone_set('America/Toronto');
|
||||
|
||||
require_once('../class.phpmailer.php');
|
||||
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
|
||||
|
||||
$mail = new PHPMailer();
|
||||
|
||||
$body = file_get_contents('contents.html');
|
||||
$body = eregi_replace("[\]",'',$body);
|
||||
|
||||
$mail->IsSMTP(); // telling the class to use SMTP
|
||||
$mail->Host = "mail.yourdomain.com"; // SMTP server
|
||||
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
|
||||
// 1 = errors and messages
|
||||
// 2 = messages only
|
||||
|
||||
$mail->SetFrom('name@yourdomain.com', 'First Last');
|
||||
|
||||
$mail->AddReplyTo("name@yourdomain.com","First Last");
|
||||
|
||||
$mail->Subject = "PHPMailer Test Subject via smtp, basic with no authentication";
|
||||
|
||||
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
|
||||
|
||||
$mail->MsgHTML($body);
|
||||
|
||||
$address = "whoto@otherdomain.com";
|
||||
$mail->AddAddress($address, "John Doe");
|
||||
|
||||
$mail->AddAttachment("images/phpmailer.gif"); // attachment
|
||||
$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
|
||||
|
||||
if(!$mail->Send()) {
|
||||
echo "Mailer Error: " . $mail->ErrorInfo;
|
||||
} else {
|
||||
echo "Message sent!";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,43 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>PHPMailer - SMTP (Gmail) advanced test</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
require_once('../class.phpmailer.php');
|
||||
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
|
||||
|
||||
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
|
||||
|
||||
$mail->IsSMTP(); // telling the class to use SMTP
|
||||
|
||||
try {
|
||||
$mail->Host = "mail.yourdomain.com"; // SMTP server
|
||||
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
|
||||
$mail->SMTPAuth = true; // enable SMTP authentication
|
||||
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
|
||||
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
|
||||
$mail->Port = 465; // set the SMTP port for the GMAIL server
|
||||
$mail->Username = "yourusername@gmail.com"; // GMAIL username
|
||||
$mail->Password = "yourpassword"; // GMAIL password
|
||||
$mail->AddReplyTo('name@yourdomain.com', 'First Last');
|
||||
$mail->AddAddress('whoto@otherdomain.com', 'John Doe');
|
||||
$mail->SetFrom('name@yourdomain.com', 'First Last');
|
||||
$mail->AddReplyTo('name@yourdomain.com', 'First Last');
|
||||
$mail->Subject = 'PHPMailer Test Subject via mail(), advanced';
|
||||
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
|
||||
$mail->MsgHTML(file_get_contents('contents.html'));
|
||||
$mail->AddAttachment('images/phpmailer.gif'); // attachment
|
||||
$mail->AddAttachment('images/phpmailer_mini.gif'); // attachment
|
||||
$mail->Send();
|
||||
echo "Message Sent OK</p>\n";
|
||||
} catch (phpmailerException $e) {
|
||||
echo $e->errorMessage(); //Pretty error messages from PHPMailer
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(); //Boring error messages from anything else!
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,59 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>PHPMailer - SMTP (Gmail) basic test</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
|
||||
//error_reporting(E_ALL);
|
||||
error_reporting(E_STRICT);
|
||||
|
||||
date_default_timezone_set('America/Toronto');
|
||||
|
||||
require_once('../class.phpmailer.php');
|
||||
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
|
||||
|
||||
$mail = new PHPMailer();
|
||||
|
||||
$body = file_get_contents('contents.html');
|
||||
$body = eregi_replace("[\]",'',$body);
|
||||
|
||||
$mail->IsSMTP(); // telling the class to use SMTP
|
||||
$mail->Host = "mail.yourdomain.com"; // SMTP server
|
||||
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
|
||||
// 1 = errors and messages
|
||||
// 2 = messages only
|
||||
$mail->SMTPAuth = true; // enable SMTP authentication
|
||||
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
|
||||
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
|
||||
$mail->Port = 465; // set the SMTP port for the GMAIL server
|
||||
$mail->Username = "yourusername@gmail.com"; // GMAIL username
|
||||
$mail->Password = "yourpassword"; // GMAIL password
|
||||
|
||||
$mail->SetFrom('name@yourdomain.com', 'First Last');
|
||||
|
||||
$mail->AddReplyTo("name@yourdomain.com","First Last");
|
||||
|
||||
$mail->Subject = "PHPMailer Test Subject via smtp (Gmail), basic";
|
||||
|
||||
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
|
||||
|
||||
$mail->MsgHTML($body);
|
||||
|
||||
$address = "whoto@otherdomain.com";
|
||||
$mail->AddAddress($address, "John Doe");
|
||||
|
||||
$mail->AddAttachment("images/phpmailer.gif"); // attachment
|
||||
$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
|
||||
|
||||
if(!$mail->Send()) {
|
||||
echo "Mailer Error: " . $mail->ErrorInfo;
|
||||
} else {
|
||||
echo "Message sent!";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user