[wp-hackers] Customize Wordpress Emails

William Davis will.davis at gmail.com
Fri Dec 10 17:18:47 UTC 2010


I've sent HTML e-mail using wp_mailer():

$headers = "From: Me, yo\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";

wp_mail($email, $subject, $body, $headers)

William P. Davis
will.davis at gmail.com
207.660.5342
http://twitter.com/williampd
http://www.wpdavis.com



On Dec 10, 2010, at 12:06 PM, Paul wrote:

>
> 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-
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list