1. PHPMailer - PHPMailer is a library that allows you to easily send emails from your PHP script using SMTP.
Example Code:
$mail = new PHPMailer; $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'example@gmail.com'; // SMTP username $mail->Password = 'password'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to
$mail->setFrom('example@gmail.com', 'Example'); $mail->addAddress('johndoe@example.com', 'John Doe'); // Add a recipient $mail->isHTML(true); // Set email format to HTML
'; $mail->AltBody = 'Your plain text message here';
if(!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent'; }
2. HTMLPurifier - HTMLPurifier is a library that helps you clean up and sanitize HTML code to prevent cross-site scripting attacks and other security vulnerabilities.
Example Code:
require_once '../library/HTMLPurifier.auto.php'; $config = HTMLPurifier_Config::createDefault(); $purifier = new HTMLPurifier($config);
$html = "
This is a test sentence.
";
echo $purifier->purify($html);
3. PHPExcel - PHPExcel is a library that allows you to manipulate and export Excel files using PHP.
Example Code:
require_once '../library/PHPExcel.php'; $objPHPExcel = new PHPExcel();
// Save file $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save('test.xlsx');
These examples use the following package libraries:
1. PHPMailer - This library can be downloaded from GitHub.
2. HTMLPurifier - This library can be downloaded from the official HTMLPurifier website or installed using Composer.
3. PHPExcel - This library can be downloaded from the official PHPExcel website or installed using Composer.
PHP HTMl - 3 examples found. These are the top rated real world PHP examples of HTMl extracted from open source projects. You can rate examples to help us improve the quality of examples.