[wp-hackers] Customize Wordpress Emails

Paul paul at codehooligans.com
Fri Dec 10 17:06:17 UTC 2010


On Dec 10, 2010, at 11:51 AM, Scot Hacker wrote:

>> From: Ryan McCue <lists at rotorised.com>
>> 
>> Although, it doesn't leverage a lot of its functionality, nor easily
>> expose it. For example, it's not possible to send a HTML email using
>> wp_mail() (unless you do all sorts of trickery using the filters in it),
>> despite how easy PHPMailer makes this. (#15448)
> 
> That's disappointing to hear. Can the bundled phpmailer be called directly rather than through the WP API to make sending HTML email easier?

Just looking at the class under wp-includes/class-phpmailer.php

You can instantiate your own instance of PHPMailer. And this class has functions like isHTML(). 

  function IsHTML($bool) {
    if($bool == true) {
      $this->ContentType = 'text/html';
    } else {
      $this->ContentType = 'text/plain';
    }
  }

Similarly, there is isSMTP()

 function IsSMTP() {
    $this->Mailer = 'smtp';
  }

Not seeing what the issue is for you. I would advise not the start including duplication of functionality local to your plugin which is already in WordPress. Sort of like developers shipping their plugin with a local copy of jQuery. Just adds bloat and many times conflict to the user's system. My opinion anyway for what it is worth. 

P-



More information about the wp-hackers mailing list