Categories

 

February 2010
M T W T F S S
« Jan   Mar »
1234567
891011121314
15161718192021
22232425262728

What I'm Doing...

PlaytimePriya and KunalIMG00015.jpgIMG00017.jpgFallColors.jpgSpring

How to change admin email address @boxXXX.bluehost.com to @mydomain.com on a bluehost hosted wordpress

I currently have hosting through bluehost.com. I was surprised to see all blog notification emails were coming from username@boxXXX.bluehost.com instead of the email address defined during setup. After a lot of searching online and trying out different things, I think this bug is due to a combination of my hosting company bluehost and wordpress. I found a couple of ways to fix this -

  1. Use an smtp plugin to define the Sender email. You can search for them on wordpress.
  2. Create a wordpress@mydomain.com email address where mydomain.com is the domain where you are hosting wordpress. This is the default email address used by wordpress which is hard coded in the wordpress code. This is used when wordpress can’t figure out the admin email address.
  3. Modify the php.ini from your bluehost cpanel to have a default email address. The reasoning behind this is that wordpress uses the php mail() function and you are defining the sender in the php settings file. By modifying this, you are defining the default email for all youu php based sites. Modify the variable to appear like the following:
    sendmail_path = “/usr/sbin/sendmail -t -i -f’myemail@mydomain.com’ “
  4. Dig into the wordpress code and set the email address to your desire.

There are pros and cons on each method. Going the plugin route is the easiest way, but the con on that method is that if one looked at the header of the email, they would see the ugly bluehost email addres.

Creating the wordpress@mydomain.com address is also another easy way to fix this. The con on this method is – If you have multiple wordpress installations you only get one default admin address to share between the two install. I didn’t want that. That’s also why the third option wouldn’t work for me.

You know me, I went with the 4th option :)

You need to edit the file /wp-includes/pluggable.php located in your wordpress installation.

Search for this code snippet

        if ( !isset( $from_email ) ) {
                // Get the site domain and get rid of www.
                $sitename = strtolower( $_SERVER['SERVER_NAME'] );
                if ( substr( $sitename, 0, 4 ) == 'www.' ) {
                        $sitename = substr( $sitename, 4 );
                }

                $from_email = 'wordpress@' . $sitename;
        }

and replace with the email address of your choice. e.g. myemail@mydomain.com

        /*if ( !isset( $from_email ) ) {
                // Get the site domain and get rid of www.
                $sitename = strtolower( $_SERVER['SERVER_NAME'] );
                if ( substr( $sitename, 0, 4 ) == 'www.' ) {
                        $sitename = substr( $sitename, 4 );
                }

                $from_email = 'wordpress@' . $sitename;
        }*/
        $from_email = 'myemail@mydomain.com';

in the same file, look for

	$wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));

and replace with

        //$wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
	$wp_email = 'myemail@mydomain.com';

That’s it!! Now all your notifications will go from myemail@mydomain.com instead of the ugly username@boxXXX.bluehost.com. If anybody knows of a better way to do this, do let me know.

Share

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

8 comments to How to change admin email address @boxXXX.bluehost.com to @mydomain.com on a bluehost hosted wordpress

  • Bernice Franklin

    This article was very useful for a paper I am writing for my thesis.

    Thanks

    Bernice Franklin

    ReplyReply

    [Reply]

    srini Reply:

    Glad this was of any help.

    Srini

    ReplyReply

    [Reply]

  • Garretot

    Gracias

    ReplyReply

    [Reply]

  • Thanks for summarizing all the different options! Question about option #4 – will this need to be redone every time WordPress upgrades its core files?

    ReplyReply

    [Reply]

    srini Reply:

    Unfortunately you would have to update the core files when you update WordPress.

    ReplyReply

    [Reply]

  • Hi Srini,

    First off, thank you for making your instructions so clear. I don’t know ANYTHING about programming and was able to do what you said so my emails from my site look more professional than the ugly bluehost box emails that were being sent.

    I noticed that the emails now say that they are coming from “WordPress” (which is WAY better than before) and it has my admin email address in place. Do you know if its possible to change the “WordPress” to my name or something else?

    If not, no big deal. You’ve already helped me a lot. Even the Bluehost people couldn’t help me the way you did! (they did try their best)

    Chris

    ReplyReply

    [Reply]

  • Does this still work? I just tried and now my website is a white screen. Not sure what to change to make it work.
    thanks.

    ReplyReply

    [Reply]

  • srini

    Hi Chris
    This still works for me.

    ReplyReply

    [Reply]

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>