From ea42b599cd62aae98d4b686fdae6750e1f807d72 Mon Sep 17 00:00:00 2001 From: Marcus Bointon Date: Tue, 26 Apr 2016 22:33:02 +0200 Subject: [PATCH] Clean up documentation and examples --- README.md | 60 +++++++++++++++++++++++++++++----------------------- changelog.md | 11 +++++----- 2 files changed, 39 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 43f3a2df..491adde9 100644 --- a/README.md +++ b/README.md @@ -69,41 +69,47 @@ While installing the entire package manually or with composer is simple, conveni ```php SMTPDebug = 3; // Enable verbose debug output +$mail = new PHPMailer(true); +try { + //Server settings + $mail->SMTPDebug = 2; // Enable verbose debug output + $mail->isSMTP(); // Set mailer to use SMTP + $mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers + $mail->SMTPAuth = true; // Enable SMTP authentication + $mail->Username = 'user@example.com'; // SMTP username + $mail->Password = 'secret'; // SMTP password + $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted + $mail->Port = 587; // TCP port to connect to -$mail->isSMTP(); // Set mailer to use SMTP -$mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers -$mail->SMTPAuth = true; // Enable SMTP authentication -$mail->Username = 'user@example.com'; // SMTP username -$mail->Password = 'secret'; // SMTP password -$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted -$mail->Port = 587; // TCP port to connect to + //Recipients + $mail->setFrom('from@example.com', 'Mailer'); + $mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient + $mail->addAddress('ellen@example.com'); // Name is optional + $mail->addReplyTo('info@example.com', 'Information'); + $mail->addCC('cc@example.com'); + $mail->addBCC('bcc@example.com'); -$mail->setFrom('from@example.com', 'Mailer'); -$mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient -$mail->addAddress('ellen@example.com'); // Name is optional -$mail->addReplyTo('info@example.com', 'Information'); -$mail->addCC('cc@example.com'); -$mail->addBCC('bcc@example.com'); + //Attachments + $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments + $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name -$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments -$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name -$mail->isHTML(true); // Set email format to HTML + //Content + $mail->isHTML(true); // Set email format to HTML + $mail->Subject = 'Here is the subject'; + $mail->Body = 'This is the HTML message body in bold!'; + $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; -$mail->Subject = 'Here is the subject'; -$mail->Body = 'This is the HTML message body in bold!'; -$mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; - -if(!$mail->send()) { + $mail->send(); + echo 'Message has been sent'; +} catch (Exception $e) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; -} else { - echo 'Message has been sent'; } ``` diff --git a/changelog.md b/changelog.md index 5051f0c8..88ffa056 100644 --- a/changelog.md +++ b/changelog.md @@ -1,14 +1,14 @@ -# ChangeLog +# PHPMailer Change Log ## Version 6.0 This is a major update that breaks backwards compatibility. -* Requires PHP 5.5 or later +* **Requires PHP 5.5 or later** * Uses the `PHPMailer\PHPMailer` namespace * File structure simplified, classes live in the `src/` folder -* The custom autoloader has been removed, now PSR-4 compatible: **use composer**! +* The custom autoloader has been removed, now PSR-4 compatible: [**use composer**](https://getcomposer.org)! * Classes & Exceptions renamed to make use of the namespace -* `Extras` classes have been removed - use packages from packagist.org instead +* `Extras` classes have been removed - use packages from [packagist.org](https://packagist.org) instead * All elements previously marked as deprecated have been removed: * `PHPMailer->Version` * `PHPMailer->ReturnPath` @@ -26,9 +26,10 @@ This is a major update that breaks backwards compatibility. * `parseAddresses()` is now static * `validateAddress()` is now called statically from `parseAddresses()` * `PHPMailer->SingleToArray` is now protected -* Extensive reworking of XOAUTH2, adding support for Google, Yahoo and Microsoft providers in the standard PHPMailer class, thanks to @sherryl4george +* Extensive reworking of XOAUTH2, adding support for Google, Yahoo and Microsoft providers, thanks to @sherryl4george * Fix extra line break in getSentMIMEMessage() * Improve DKIM signing to use SHA-2 +* Major cleanup of docs and examples ## Version 5.2.14 (Nov 1st 2015) * Allow addresses with IDN (Internationalized Domain Name) in PHP 5.3+, thanks to @fbonzon