HtmlReporter.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /*
  3. * This file is part of SwiftMailer.
  4. * (c) 2004-2009 Chris Corbyn
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. /**
  10. * A HTML output reporter for the Reporter plugin.
  11. *
  12. * @author Chris Corbyn
  13. */
  14. class Swift_Plugins_Reporters_HtmlReporter implements Swift_Plugins_Reporter
  15. {
  16. /**
  17. * Notifies this ReportNotifier that $address failed or succeeded.
  18. *
  19. * @param Swift_Mime_Message $message
  20. * @param string $address
  21. * @param int $result from {@see RESULT_PASS, RESULT_FAIL}
  22. */
  23. public function notify(Swift_Mime_Message $message, $address, $result)
  24. {
  25. if (self::RESULT_PASS == $result) {
  26. echo "<div style=\"color: #fff; background: #006600; padding: 2px; margin: 2px;\">" . PHP_EOL;
  27. echo "PASS " . $address . PHP_EOL;
  28. echo "</div>" . PHP_EOL;
  29. flush();
  30. } else {
  31. echo "<div style=\"color: #fff; background: #880000; padding: 2px; margin: 2px;\">" . PHP_EOL;
  32. echo "FAIL " . $address . PHP_EOL;
  33. echo "</div>" . PHP_EOL;
  34. flush();
  35. }
  36. }
  37. }