Changeset 1300 in tests for trunk/includes/mock-mailer.php
- Timestamp:
- 06/29/2013 10:31:15 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/includes/mock-mailer.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/mock-mailer.php
r903 r1300 1 1 <?php 2 3 require_once(ABSPATH . '/wp-includes/class-phpmailer.php'); 2 require_once( ABSPATH . '/wp-includes/class-phpmailer.php' ); 4 3 5 4 class MockPHPMailer extends PHPMailer { … … 8 7 // override the Send function so it doesn't actually send anything 9 8 function Send() { 10 if ( (count($this->to) + count($this->cc) + count($this->bcc)) < 1 ) { 11 $this->SetError( 'You must provide at least one recipient email address.' ); 9 try { 10 if ( ! $this->PreSend() ) 11 return false; 12 13 $this->mock_sent[] = array( 14 'to' => $this->to, 15 'cc' => $this->cc, 16 'bcc' => $this->bcc, 17 'header' => $this->MIMEHeader, 18 'body' => $this->MIMEBody, 19 ); 20 21 return true; 22 } catch ( phpmailerException $e ) { 12 23 return false; 13 24 } 14 15 // Set whether the message is multipart/alternative 16 if( ! empty($this->AltBody) ) 17 $this->ContentType = 'multipart/alternative'; 18 19 $this->error_count = 0; // reset errors 20 $this->SetMessageType(); 21 $header = $this->CreateHeader(); 22 $body = $this->CreateBody(); 23 24 if ( $body == '' ) { 25 $this->SetError( 'Message body empty' ); 26 return false; 27 } 28 29 $this->mock_sent[] = array( 30 'to' => $this->to, 31 'cc' => $this->cc, 32 'bcc' => $this->bcc, 33 'header' => $header, 34 'body' => $body, 35 ); 36 37 return true; 38 } 25 } 39 26 } 40 41 ?>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)