forked from PHPMailer/PHPMailer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major overhaul and cleanup of example code
Update test_script to use some recently changed features, rename to code_generator Generated code actually works! Update SyntaxHighlighter New PHPMailer graphic
- Loading branch information
Showing
94 changed files
with
2,336 additions
and
5,421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
<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 ([email protected])<br /> | ||
Author: Marcus Bointon ([email protected])<br /> | ||
</div> | ||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<title>PHPMailer Test</title> | ||
</head> | ||
<body> | ||
<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;"> | ||
<h1>This is a test of PHPMailer.</h1> | ||
<div align="center"> | ||
<a href="https://github.com/PHPMailer/PHPMailer/"><img src="images/phpmailer.png" height="90" width="340" alt="PHPMailer rocks"></a> | ||
</div> | ||
<p>This example uses <strong>HTML</strong>.</p> | ||
<p>The PHPMailer image at the top has been embedded automatically.</p> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<title>PHPMailer - Exceptions test</title> | ||
</head> | ||
<body> | ||
<?php | ||
require '../class.phpmailer.php'; | ||
|
||
//Create a new PHPMailer instance | ||
//Passing true to the constructor enables the use of exceptions for error handling | ||
$mail = new PHPMailer(true); | ||
try { | ||
//Set who the message is to be sent from | ||
$mail->SetFrom('[email protected]', 'First Last'); | ||
//Set an alternative reply-to address | ||
$mail->AddReplyTo('[email protected]','First Last'); | ||
//Set who the message is to be sent to | ||
$mail->AddAddress('[email protected]', 'John Doe'); | ||
//Set the subject line | ||
$mail->Subject = 'PHPMailer Exceptions test'; | ||
//Read an HTML message body from an external file, convert referenced images to embedded, | ||
//and convert the HTML into a basic plain-text alternative body | ||
$mail->MsgHTML(file_get_contents('contents.html'), dirname(__FILE__)); | ||
//Replace the plain text body with one created manually | ||
$mail->AltBody = 'This is a plain-text message body'; | ||
//Attach an image file | ||
$mail->AddAttachment('images/phpmailer-mini.gif'); | ||
//Send the message | ||
//Note that we don't need check the response from this because it will throw an exception if it has trouble | ||
$mail->Send(); | ||
echo "Message sent!"; | ||
} 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<title>PHPMailer - GMail SMTP test</title> | ||
</head> | ||
<body> | ||
<?php | ||
|
||
//SMTP needs accurate times, and the PHP time zone MUST be set | ||
//This should be done in your php.ini, but this is how to do it if you don't have access to that | ||
date_default_timezone_set('Etc/UTC'); | ||
|
||
require '../class.phpmailer.php'; | ||
|
||
//Create a new PHPMailer instance | ||
$mail = new PHPMailer(); | ||
//Tell PHPMailer to use SMTP | ||
$mail->IsSMTP(); | ||
//Enable SMTP debugging | ||
// 0 = off (for production use) | ||
// 1 = client messages | ||
// 2 = client and server messages | ||
$mail->SMTPDebug = 2; | ||
//Ask for HTML-friendly debug output | ||
$mail->Debugoutput = 'html'; | ||
//Set the hostname of the mail server | ||
$mail->Host = 'smtp.gmail.com'; | ||
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission | ||
$mail->Port = 587; | ||
//Set the encryption system to use - ssl (deprecated) or tls | ||
$mail->SMTPSecure = 'tls'; | ||
//Whether to use SMTP authentication | ||
$mail->SMTPAuth = true; | ||
//Username to use for SMTP authentication - use full email address for gmail | ||
$mail->Username = "[email protected]"; | ||
//Password to use for SMTP authentication | ||
$mail->Password = "yourpassword"; | ||
//Set who the message is to be sent from | ||
$mail->SetFrom('[email protected]', 'First Last'); | ||
//Set an alternative reply-to address | ||
$mail->AddReplyTo('[email protected]','First Last'); | ||
//Set who the message is to be sent to | ||
$mail->AddAddress('[email protected]', 'John Doe'); | ||
//Set the subject line | ||
$mail->Subject = 'PHPMailer GMail SMTP test'; | ||
//Read an HTML message body from an external file, convert referenced images to embedded, convert HTML into a basic plain-text alternative body | ||
$mail->MsgHTML(file_get_contents('contents.html'), dirname(__FILE__)); | ||
//Replace the plain text body with one created manually | ||
$mail->AltBody = 'This is a plain-text message body'; | ||
//Attach an image file | ||
$mail->AddAttachment('images/phpmailer-mini.gif'); | ||
|
||
//Send the message, check for errors | ||
if(!$mail->Send()) { | ||
echo "Mailer Error: " . $mail->ErrorInfo; | ||
} else { | ||
echo "Message sent!"; | ||
} | ||
?> | ||
</body> | ||
</html> |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.