[wp-hackers] Customize Wordpress Emails
Ryan Bilesky
rbilesky at gmail.com
Thu Dec 9 23:46:46 UTC 2010
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?
More information about the wp-hackers
mailing list