Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <?php
  2. /**
  3. * Display errors
  4. */
  5. if ( ! function_exists('debug_wpmail')) :
  6.  
  7. function debug_wpmail( $result = false ) {
  8.  
  9. if ( ! $result ) {
  10.  
  11. global $ts_mail_errors;
  12. global $phpmailer;
  13.  
  14. if ( ! isset($ts_mail_errors) )
  15. $ts_mail_errors = array();
  16.  
  17. if ( isset($phpmailer) ) {
  18. $ts_mail_errors[] = $phpmailer->ErrorInfo;
  19. }
  20.  
  21. print_r('<pre>');
  22. print_r($ts_mail_errors);
  23. print_r('</pre>');
  24. }
  25. }
  26. endif;
  27.  
  28.  
  29. /**
  30. * Usage
  31. */
  32. $res = wp_mail($to, $subject, $message);
  33. debug_wpmail($res); // Will print_r array of errors
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement