Quantcast
Viewing all articles
Browse latest Browse all 2

noreply@ wordpress@ Ripping Your Hair Out And Want To Change These?

You might find these when using BuddPress, Contact Form 7, WPMUDEV Supporter Form and no doubt it annoys you! Image may be NSFW.
Clik here to view.
;-)

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! Image may be NSFW.
Clik here to view.
;-)

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. Image may be NSFW.
Clik here to view.
;-)


Viewing all articles
Browse latest Browse all 2

Trending Articles