2013-08-07 08:38:38 +02:00
|
|
|
<?php
|
|
|
|
require_once( ABSPATH . '/wp-includes/class-phpmailer.php' );
|
|
|
|
|
|
|
|
class MockPHPMailer extends PHPMailer {
|
|
|
|
var $mock_sent = array();
|
|
|
|
|
2014-03-03 21:24:31 +01:00
|
|
|
/**
|
|
|
|
* Override send() so mail isn't actually sent.
|
|
|
|
*/
|
|
|
|
function send() {
|
2013-08-07 08:38:38 +02:00
|
|
|
try {
|
2014-03-03 21:24:31 +01:00
|
|
|
if ( ! $this->preSend() )
|
2013-08-07 08:38:38 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
$this->mock_sent[] = array(
|
|
|
|
'to' => $this->to,
|
|
|
|
'cc' => $this->cc,
|
|
|
|
'bcc' => $this->bcc,
|
|
|
|
'header' => $this->MIMEHeader,
|
|
|
|
'body' => $this->MIMEBody,
|
|
|
|
);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} catch ( phpmailerException $e ) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|