You say you’re emailing to wordpress@mywebsite.com, but your error message shows wordpress@website.co.uk
In any case, email addresses are created on the server, not through WordPress.
soz, i just didnt want my website posted here:
somewhere, it has a default emailing address of ‘wordpress@’
If i have set it up in the settings and in the ‘admin’ user why is it not working?
So, to be clear, you’ve gone into the admin user’s settings and specified an email address for example: theadminguy@example.com
But WordPress is sending out emails to wordpress@example.com instead of using theadminguy@example.com
Sound right?
Right, im getting a comment come through from the website and it says in the subject:
WordPress [wordpress@website.co.uk]
and when you press reply it says in the address bar:
wordpress@website.co.uk
Otherwise, its emailing to the correct email as specified in the admin settings
Okay, I understand. It’s actually expected behavior — just went back and checked on some of my emails and they also come from wordpress@tddewey.com.
I suppose there’s probably a way to hook into and change the email address, but I don’t see a particular reason to need to do so. To what purpose are you trying to email your blog back? Perhaps we can find a way around it.
Its because it is a commercial website. I dont want users to see wordpress. maybe ‘noreply@’
Thanks
Gotcha. Looks like there’s a filter already set-up for you called wp_mail_from.
So, we can add a filter hook and modify the wp_mail_from if it’s from wordpress@whatever as well as the wp_mail_from_name to be “noreply” or similar.
This can be put in your theme’s functions.php — it was tested with WordPress 3.0b1 — it should work on 2.9…
function changedefaultemail($from_email) {
$sitename = strtolower( $_SERVER['SERVER_NAME'] );
if ( substr( $sitename, 0, 4 ) == 'www.' ) {
$sitename = substr( $sitename, 4 );
}
if (strtolower($from_email) == 'wordpress@'.$sitename) {
$from_email = 'noreply@'.$sitename;
return $from_email;
}
}
function changedefaultname ($wp_mail_from_name) {
if (strtolower($wp_mail_from_name) == 'wordpress') {
$wp_mail_from_name = 'noreply';
return $wp_mail_from_name;
}
}
add_filter ( 'wp_mail_from', 'changedefaultemail' );
add_filter ( 'wp_mail_from_name','changedefaultname');
These functions of course, could be modified to get the site administrator’s email address and use that instead.
Hi taylorde,
Thank you for the code. However, i have had the following error:
Warning: Cannot modify header information - headers already sent by (output started at xx/wp-content/themes/default/functions.php:864) in xx/wp-comments-post.php on line 82
Warning: Cannot modify header information - headers already sent by (output started at xx/wp-content/themes/default/functions.php:864) in xx/wp-comments-post.php on line 83
Warning: Cannot modify header information - headers already sent by (output started at xx/wp-content/themes/default/functions.php:864) in xx/wp-comments-post.php on line 84
Warning: Cannot modify header information - headers already sent by (output started at xx/wp-content/themes/default/functions.php:864) in xx/wp-includes/pluggable.php on line 865
Is this because the system i have installed isnt 2.9.2?
You may have accidentally introduced a blank space into functions.php — there cannot be anything outside of <?php and ?> including blank spaces or newlines (returns).
Thank you kindly.
I will definately bookmark this article.
Thank you for your help
Glad it worked, you’re welcome