[wp-hackers] Customize Wordpress Emails

Andrew Nacin wp at andrewnacin.com
Sun Dec 12 11:22:14 UTC 2010


On Sun, Dec 12, 2010 at 6:12 AM, Ryan Bilesky <rbilesky at gmail.com> wrote:

> 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.


Um, okay. So any time we add a new wp_mail() call in core (which we surely
will), or whenever a plugin wants to send mail, no mail gets sent.

That's a cheap hack and I would not recommend that. I say this bluntly
because while it might suit your specific needs, there are a few hundred
other people who read this list, and I really would hate to see them picking
up bad techniques such as this one.

Nacin


More information about the wp-hackers mailing list