[wp-hackers] Customize Wordpress Emails

William P. Davis will.davis at gmail.com
Thu Dec 9 23:48:32 UTC 2010


Using the SMTP plugin tells wp_mail() to send using SMTP. Then you can create and send your own e-mails using the wp_mail function. 
Sent from my BlackBerry® wireless device

-----Original Message-----
From: Ryan Bilesky <rbilesky at gmail.com>
Sender: wp-hackers-bounces at lists.automattic.com
Date: Thu, 9 Dec 2010 15:46:46 
To: <wp-hackers at lists.automattic.com>
Reply-To: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] Customize Wordpress Emails

Here's the thing, I'd need one plugin to send via SMTP, another to do HTML
emails, and still another to support non-standard emails I may want to
send.  I'd much rather just write my own single plugin to do all of that,
keeps things simple for me and shouldn't be too hard.

Now I kinda shot that email off from my phone, now that I am at my computer
I have looked over the source of WP and some of the plugins.  It appears to
me that the function wp_mail() is used to send the emails, and it has
several filters including one called wp_mail.  Now my thinking is this:

1) I can look at the email address it is being sent to and the subject to
gather the details I need to know what type of email it is and who its for
2) I can use the wp_mail filter to get those details and return null values
in their place, like this:

$to = '';
$subject = '';
$message = '';
$headers = '';
$attachments = array ();
return compact('to', 'subject', 'message', 'headers', 'attachments');

3) That should effectively prevent wordpress from sending the mail, then I
can create and send my own.

Does this all sound about right?
_______________________________________________
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