WordPress.org

Ready to get started?Download WordPress

Forums

Admin email help (19 posts)

  1. knoxjon
    Member
    Posted 7 years ago #

    I searched for this but couldn't find anything more recent than a year and a half ago, and it didn't seem to apply to now.

    How can you change the address WP emails from? IE when I get an email saying someone replied to a topic, it comes from the default account on my server, and I'd like to change that if possible.

    Any suggestions?

  2. knoxjon
    Member
    Posted 7 years ago #

    Nobody knows anything?

    This seems fairly easy, although perhaps unusual. Somebody's got to know something....

  3. Doodlebee
    Member
    Posted 7 years ago #

    Admin>users - look in the BIG box on the right that says "contact info" - first line is your email address.

  4. Trent Adams
    Member
    Posted 7 years ago #

    The change you need to make is in the file pluggable-functions.php in your /wp-includes/ folder.

    Trent

  5. Doodlebee
    Member
    Posted 7 years ago #

    The change you need to make is in the file pluggable-functions.php in your /wp-includes/ folder.

    Truly? Because I've never had to do that - all I've ever done is change my email address in the settings.

  6. Trent Adams
    Member
    Posted 7 years ago #

    If you want to add an address that the admin emails come from yes, if you just want to change the address that the emails actually arive at no.

    Trent

  7. Trent Adams
    Member
    Posted 7 years ago #

    Example, the user will be sent an email from wordpress@mydomain.com unless I change this in that file:

    if ( !function_exists('wp_mail') ) :
    function wp_mail($to, $subject, $message, $headers = '') {
    if( $headers == '' ) {
    $headers = "MIME-Version: 1.0n" .
    "From: wordpress@" . preg_replace('#^www.#', '', strtolower($_SERVER['SERVER_NAME'])) . "n" .
    "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"n";
    }

    Unless I am missing something....(which is possible)

    Trent

  8. Doodlebee
    Member
    Posted 7 years ago #

    Huh. Guess I never noticed that before. I'll go put my dollar in the jar now! :)

  9. Trent Adams
    Member
    Posted 7 years ago #

    I could be wrong about this as well because I really haven't tested it, but it makes sense, so hold onto that dollar for now ;)

    Trent

  10. knoxjon
    Member
    Posted 7 years ago #

    I think you're on the right track, Trent.

    Most people have told me what doodlebee said, but I'm not missing anything that obvious. But I can't figure out how to get it configured right. Something's not right, because spam karma emails from the right addy, but wp itself emails from my hosting username @ the box I'm on at hosting dot com.

    Heck if I know.

    Thanks!

  11. Doodlebee
    Member
    Posted 7 years ago #

    I got an email from my site today, and by God, Trent, you're right - it emails me from wordpress @ mydomainname. com (trying to make this *not* link...) I never noticed that before! Nice tip - whodathunkit? I'll have to file that away in my "cool things to know" drawer :)

  12. knoxjon
    Member
    Posted 7 years ago #

    I wish I knew why mine didn't do that.

    And I've never had it do that on either server/host I've used.

    Interesting.

  13. wifiman01
    Member
    Posted 7 years ago #

    Hi,

    Thank you very much for this post Trent it have help me configuring mine !

    PS : For those who have a several domain and wouldn't that appear the defaut one use the line like this :

    if( $headers == '' ) {
    $headers = "MIME-Version: 1.0n" .
    "From: info @ planet-sansfil.com" . "\n" .
    annd it will show only the email you have inserted.

    Cya.

  14. Ted Roche
    Member
    Posted 7 years ago #

    There's a couple conflicting things going on here. First, wp_mail explicitly hardcodes 'wordpress' @ yourservername.tld in the _header_ of the email, that's the outside envelope, but not necessarily what the recipient will see.

    function wp_mail($to, $subject, $message, $headers = '') {
    if( $headers == '' ) {
    $headers = "MIME-Version: 1.0\n" .
    "From: " . get_settings('admin_email') . "\n" .
    "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
    # was: "From: wordpress@" . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])) . "\n" .
    }

    return @mail($to, $subject, $message, $headers);
    }

    The second problem is PHP's tendency to send mail with a "Return-Path" setting of 'apache@example.com' or whatever the name of your name server is. You can fix that with the fix described here:

    http://drupal.org/project/returnpath

    You might be able to override this for multiple named-hosts on a server with php_value settings for each host configuration file, but I haven't tried that.

    There's a good chance that all of this will be moot if you upgrade to the 2.2 version.

  15. Dgold
    Member
    Posted 7 years ago #

    knoxjon, where are you seeing the resulting address?

    I'm curious because I use the WP-GotLucky plugin (it emails me when my site is Top in Google). I recently changed servers and noticed the plugin now emails me from USERNAME @ HOST and I don't like it, I would rather it uses my Domain name instead of an unsightly Host server address for the domain. However, I'm thinking this is coded in the Plugin. It isn't using my Admin email, which is my Gmail account and not associated to the host name or domain.

    The only place I can think of that uses the hardcoded wordpress@ address, is the Password/Confirm email you get when you register or click Lost Password. This also doesn't use the Admin Contact email, AFIK. I'm going to have to test that on my new server and see what the addy is.

  16. kalico
    Member
    Posted 7 years ago #

    In 2.1.3, the file you need to change is /wp-includes/pluggable.php

    In addition to changing the "From" line as indicated above, check for the variable $wp_email, which is set to wordpress@

    Also, if a plugin is generating the undesired from address, check all the files for "wordpress@". I found 4 occurrences in cforms2.

    Use an editor like Notepad++ to do a "find all in all files" to make your life a little easier.

    HTH :)

  17. corrijo
    Member
    Posted 6 years ago #

    I did what tedroche did, with one exception and then it worked (v2.2 of wordpress):

    in pluggable.php in wp-includes

    function wp_mail($to, $subject, $message, $headers = '') {
    if( $headers == '' ) {
    $headers = "MIME-Version: 1.0\n" .
    "From: " . get_settings('admin_email') . "\n" .
    "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
    # was: "From: wordpress@" . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])) . "\n" .
    /*}<---HEY DELETE THIS LINE!*/

    return @mail($to, $subject, $message, $headers);
    }

  18. bondageradio
    Member
    Posted 6 years ago #

    This thread has been addressed with Andrew Hamilton's plugin 'Mail From'

    Here is the plugin's homepage:
    http://labs.saruken.com/

    You can download the plugin from here:
    http://wordpress.org/extend/plugins/mail-from/

  19. ehab
    Member
    Posted 6 years ago #

    Yeah Trent's method should work just fine, I was actually looking for a solution for this mess. I dont want to reveal too much to anyone.

    Specially, if you are on a shared hosting account, things get messy :)

Topic Closed

This topic has been closed to new replies.

About this Topic