woothemes/woocommerce — pull request #6383 by BFTrick (2014-09-24 16:12:27+00:00)
Title: Refactoring Email Classes to Use One Send Method

As per #6358 we're refactoring the email classes so we don't have two send methods. This PR reroutes the email handlers `send()` method through `WC_Email`'s `send()` method. So now all instances of `send()` go through that method.

Any extension or core WC functionality can send a WC email like this:

``` php
// set subject
$subject = 'WC Send Mail Test';

// load the mailer
$mailer = WC()->mailer();
$mailer->send( get_option( 'admin_email' ), $subject, $mailer->wrap_message( $subject, 'a test message' ), '', '' );
```

And it looks something like this:

![wc_send_mail_test_-_patrick_r_woothemes_com_-_woothemes_mail](https://cloud.githubusercontent.com/assets/1065372/4376318/88db2748-4344-11e4-97f6-f3d560f7ff26.jpg)

If the code doesn't use the `$mailer->wrap_message( $subject, $message )` functionality and instead just puts sends the `$message` variable as is it will just be plain text.

![wc_send_mail_test_-_patrick_r_woothemes_com_-_woothemes_mail 2](https://cloud.githubusercontent.com/assets/1065372/4376378/1e7bdd24-4345-11e4-8c50-2d5f84c6467d.jpg)

So now if we ever want to modify the `send()` functionality we just have to modify the one in the `WC_Email` class (used to be `includes/abstracts/abstract-wc-email.php`).