mock-mailer.php 548 B

1234567891011121314151617181920212223242526
  1. <?php
  2. require_once( ABSPATH . '/wp-includes/class-phpmailer.php' );
  3. class MockPHPMailer extends PHPMailer {
  4. var $mock_sent = array();
  5. // override the Send function so it doesn't actually send anything
  6. function Send() {
  7. try {
  8. if ( ! $this->PreSend() )
  9. return false;
  10. $this->mock_sent[] = array(
  11. 'to' => $this->to,
  12. 'cc' => $this->cc,
  13. 'bcc' => $this->bcc,
  14. 'header' => $this->MIMEHeader,
  15. 'body' => $this->MIMEBody,
  16. );
  17. return true;
  18. } catch ( phpmailerException $e ) {
  19. return false;
  20. }
  21. }
  22. }