[wp-hackers] Customize Wordpress Emails

Ryan Bilesky rbilesky at gmail.com
Sun Dec 12 11:12:07 UTC 2010


Ultimately I looked at every reference to wp_mail() and only found 2 that
send actual emails that I personally would find useful for my needs, the
forgot password emails and new user welcome emails.

I have opted to use the pluggability of the function to replace it with my
own version:

if ( !function_exists('wp_mail') ) :
function wp_mail($to, $subject, $message, $headers = '', $attachments =
array()) {
 return true;
}
endif;

and to take care of those emails I want I am using a hook for the forgot
password emails, and the new users emails are done in another pluggable
function I am replacing.

So that's how I've decided to deal with this, thanks all for your help.
I've learned something new about Wordpress, pluggable functions.

On Fri, Dec 10, 2010 at 6:42 PM, Ryan McCue <lists at rotorised.com> wrote:

> William Davis wrote:
> > 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)
>
> If you want to send multipart emails, you're essentially screwed though.
> phpmailer will add an extra Content-Type header (Content-Type:
> multipart/alternative; charset=""), which will override your original
> Content-Type with the boundary. This will still work in Thunderbird, but
> Outlook will fail to see the boundary and spew your entire body out
> (including boundaries) as text.
>
> I'm working on this on #15448, but be aware of it if you're trying to
> send multipart emails through wp_mail()
>
> --
> Ryan McCue
> <http://ryanmccue.info/>
>
> _______________________________________________
>  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