You might find these when using BuddPress, Contact Form 7, WPMUDEV Supporter Form and no doubt it annoys you!
First of all if you are runing a vanilla install of WordPress you will have no doubt noticed that when system e-mails are sent out that the address is usually wordpress@yourdomain.com and of course you could most likely find a plugin to combat this but is a another plugin bloating your install really what you need?
So, where can you change this in the core code?
/wp-include/pluggable.php
Around line 391:
391 | $from_email = 'wordpress@' . $sitename; |
Around line 1057:
1057 | $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])); |
So that is the default out of the way!
Now you are running BuddyPress and you notice that your “Contact Form 7″ or Supporter form is sending out e-mails with a sent address from noreply@yourdomain.com, of course this is damn annoying, it makes it more time consuming when you make replies, often you send an e-mail to yours noreply address and then get angry clients asking why you haven’t contacted them back, or if you use a support desk so you can’t just reply to that ticket. Its most annoying when all you need to do is reply yes or no and especially so when using the supporter form for your clients.
So the problem! It is actually buddypress causing the issue here. At least in 1.2.8 (Not checked other versions) You see it ads filters to the default WP_Mail function forcing its own headers. What you need to do is remove those filters and everything will be back working as it should.
Contact Form 7, Add the following:
remove_filter('wp_mail_from', 'bp_core_email_from_address_filter' ); remove_filter('wp_mail_from_name', 'bp_core_email_from_name_filter');
In the compose_and_send_mail() function around line 693:
693 694 695 696 697 698 | function compose_and_send_mail( $mail_template ) { remove_filter('wp_mail_from', 'bp_core_email_from_address_filter' ); remove_filter('wp_mail_from_name', 'bp_core_email_from_name_filter'); $regex = '/\[\s*([a-zA-Z_][0-9a-zA-Z:._-]*)\s*\]/'; |
Now it will use what ever you stipulate in the admin area of Contact 7 which is usually the e-mail address for the person contacting you!
And the WPMUDEV Supporter plugin, open the following:
/wp-content/mu-plugins/supporter-premium-support.php
Add it to the supporter_support_page() function which is approx. line 94 it should then look like this:
94 95 96 97 98 | function supporter_support_page() { global $current_user; remove_filter('wp_mail_from', 'bp_core_email_from_address_filter' ); remove_filter('wp_mail_from_name', 'bp_core_email_from_name_filter'); |
You could if you wished wrap it up in some conditional statements to check for BuddPress first, but for me it is always installed, at least for now!
If you are not using BuddyPress or you still have this issue after removing the filters then chances are there is another plugin or even theme which is forcing its use of the wp_mail() function.
Note: One thing to remember is that making changes directly to the main files of WP, a plugin or theme means that when you come to upgrade you will need to remember to make those changes again! I prefer this over bloating an install with plugin after plugin.
WordPress on a whole is one the most popular platforms around for hosting your website with, it has so many options with regards to themes and plugins but occasionally it lacks a little especially when it comes to plugins for a multi user install (WordPress MU) which is now titled multisite. What options are available for multisite are often restrictive, buggy or hard to use and not always actively maintained which makes it hard for you to offer a service to end users or even manage your own group of sites consistently.
There has always been a constant shining beacon of light through out the darkness which shrouds WordPress MU and that is of course WPMUDEV, One thing I have to take note of is that they responded to every question I’ve asked in their forums so far even when they don’t immediately have the answer or when their answer might not be so popular which I believe shows integrity.
Out of all the plugins and themes they have on offer there is one which I love more than any other, don’t get me wrong I use many of them and they are all very useful, some are amazing but this one is so simple and gave me something which in my honest opinion should be part of the multisite core install. Site Wide RSS aka Recent Global Posts Feed – upload, pop over to widget and place it where you need, jobs a good en!
How could it be improved?
- Currently the widget which comes with this plugin points to /wp-content/recent-global-posts-feed.php whereas I would prefer it use a permalink out of the box, something like /site-feed/
- One pet peeve is that there are is also a site wide comments RSS (which equally as cool!) and this is a separate plugin, personally I would like to see these bundled together as one plugin thus lowering the amount of included extra files. I think the same could be said for their branding plugings (which are also amazing!).
The great thing is they welcome suggestions and if it is something their membership want then it goes on the development list!
I love that the WPMUDEV plugins just work!