Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 8 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
WPMail | |
0.00% |
0 / 8 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
register_hooks | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
mail_succeeded | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace NewfoldLabs\WP\Module\Data\Listeners; |
4 | |
5 | /** |
6 | * Monitors wp_mail events. |
7 | */ |
8 | class WPMail extends Listener { |
9 | |
10 | /** |
11 | * Register wp_mail_* hooks for the subscriber. |
12 | * |
13 | * @return void |
14 | */ |
15 | public function register_hooks() { |
16 | add_action( 'wp_mail_succeeded', array( $this, 'mail_succeeded' ), 10, 1 ); |
17 | } |
18 | |
19 | /** |
20 | * Mail sent successfully. |
21 | * |
22 | * @param array $mail_data An array containing the email recipient(s), subject, message, headers, and attachments. |
23 | * @return void |
24 | */ |
25 | public function mail_succeeded( $mail_data ) { |
26 | $this->push( |
27 | 'wp_mail', |
28 | array( |
29 | 'label_key' => 'subject', |
30 | 'subject' => $mail_data['subject'], |
31 | ) |
32 | ); |
33 | } |
34 | } |