Tagged Open MS Office 2007 apps with MS office 2003 or earlier
Jun 05



On recently changing my webhost to ‘HostMonster’, I found that my blog, powered by Wordpress, doesnt send out the email the way I want it to.

Devesh had subscribed to one of my posts, and he received an email from me with the ID username@host#.hostmonster.com, when ideally it should have been sent by my email id.

The hostmonster forums have already discussed this problem, and the solution they mention on the website is

This is because our servers require you (or your script) to use a properly formatted, valid From: header in your email. If the From: header is not formatted correctly, empty or invalid our system will change the from address to be @.hostmonster.com. To stop this, you must change the script you are using to correctly use a valid From header.

Examples of headers that should work would be:
From: user@domain.com
From:
From: “name”

Examples of headers that will NOT work:
From: “user@domain.com”
From: user @ domain.com

Now, the above didnt make sense to me, so I searched for some other ways out.

Here is a quick solution to help you out of this problem.

Login to your Cpanel account, and open your ‘File Manager’.

Locate the php.ini file, which you can find under public_html/mail folder.

Copy this file to the root directory of your wordpress installation.

Now you need to search for the below line. Ideally it will be Line 604.

sendmail_path = /usr/sbin/sendmail -t -i

Change this line to

sendmail_path = /usr/sbin/sendmail -t -i -fusername@domain.com

-f is the command option, followed by the email that you wish to use to send out emails.

Note: There is no space between -f and your email id.

Update: The email Id that you mention above should be already existing within your CPanle account, otherwise the above settings will not work.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Technorati
  • TwitThis
  • StumbleUpon


written by Ritesh \\ tags:

2 Pings to “Wordpress Sender Email incorrect on HostMonster”

  1. Wordpress Sender Email incorrect on HostMonster Ritesh Sapra | internet marketing tools Says:

    [...] Wordpress Sender Email incorrect on HostMonster Ritesh Sapra Posted by root 51 minutes ago (http://riteshsapra.net) Jun 5 2008 powered by wordpress doesnt send out the email the way i want it to i changed that line in the ini file and made a comment on a story that was wordpress v2 7 allows you to set a return path email address Discuss  |  Bury |  News | Wordpress Sender Email incorrect on HostMonster Ritesh Sapra [...]

  2. Shonari » Blog Archive » Changing the Admin sending email address in Wordpress Says:

    [...] Another possible solution can be found here. [...]


28 Responses to “Wordpress Sender Email incorrect on HostMonster”

  1. 1. devesh Says:

    This is excellent resource mate :) Just Dugg it for ya, and will be Stumbling it after :)

  2. 2. Ritesh Says:

    Thanks for the digg Devesh - Am glad you found it useful.

    I’m sure others hosted on Host Monster will find this useful.

  3. 3. GOVO Says:

    I have tried it before, but it seems no sense too….let me try again….

  4. 4. Ritesh Says:

    @GOVO - This worked absolutely fine for me. Are you following all the steps correctly?

  5. 5. GOVO Says:

    The problem maybe the unexist email account under cpanel.
    I have make a simple mail.php there, it work with phpmailer like wordpress, But no such a problem.
    your can download it here and have a test, you will find the sender is what I want :
    http://guitarbean.com/mail2.phpx
    (PS: I rename the file to phpx inorder it can’t be run on my server)

  6. 6. Ritesh Says:

    @GOVO - If you dont have the email created in CPanel, the above steps wont work. So I’d suggest you create the email in CPanel, and then test. It should work.

  7. 7. GOVO Says:

    Mybe, but I thing it is better to let it be….

  8. 8. Ritesh Says:

    If you’re happy getting the email from host#.hostmonster.com, you can let it be. The reason I changed the setting was so I & my readers get the email from my own mail ID.

  9. 9. John Says:

    Thanks. This is useful for me.

  10. 10. Nandan Jha Says:

    I am on HM and I have a WP installation. When some one writes a comment then the Author of the story was getting mails from shoppin8@hostmonster…… kind of address.

    I changed that line in the ini file and made a comment on a story that was written by me. But I have not received a mail so far.

    It may be that the mail would come after some time. I would wait till evening, few more hours, and then revert the change.

    I hope i read this post correctly and doing the right thing. The new mail-id is present at cpanel but its not my login id (shoppin8 is my login though). When I say its present, I mean that I have configured that mail id under ‘E-mail accounts’.

  11. 11. Ritesh Says:

    @Nandan - Try publishing a new post, and then comment on the new post. I think from then onwards it will work. Doesnt work for existing posts. (I THINK - not sure)

  12. 12. Nandan Jha Says:

    Ok. I would try this for one of my other blogs as well and would get back on whether the above is true 100% or not.

    I do not have a new travel story to share at ghumakkar :) so it would need to wait for some time. I think it would hurt the old posts since the authors wont get the notification but I guess its a very nice solution in long term.

    thanks again.

  13. 13. Nandan Jha Says:

    So I wrote a new one (read it in your spare time) , a story on Banaras and still the mails are from .hostmonster kind of address.

    I read your post again and it was really dumb of me to not read well. I did change the php.ini file but that was at root of main domain. So i have now copied the same file at ghumakar blog root, and would wait to see the result.

  14. 14. Nandan Jha Says:

    It works. on old posts as well I guess. Great tip. and thanks for your comment.

  15. 15. Ritesh Says:

    Im glad it works for you :-)

  16. 16. Nandan Jha Says:

    One more query.

    The mail id which I have configured is called write@ghumakkar.com , when I receive the e-mail, the sender name is shown as ‘write’.

    Can I change that to something more meaningful ?

    I noticed that in your case, its your blog name.

  17. 17. Ritesh Says:

    I did think about that issue too - but didnt have time to explore it.

    A quick workaround though could be if you save the email address in your address book with a meaningful name. When you get an email form write@ghumakar.com, it should display the meaningful name.

    This will work in gmail - havent tried with any other service.

    Hope that helps.

  18. 18. Nandan Jha Says:

    I spent some time on this. It seems that writing another parameter -F does the trick. Look at http://jhaji.blogspot.com for more details please.

  19. 19. Ritesh Says:

    Thanks Nandan, thats great :-)

  20. 20. Aaron Says:

    Wordpress v2.7 allows you to set a Return-Path email address directly in the /wp-includes/class-phpmailer.php at the top.

    Look for the variable $Sender and set it to a valid email address.

    This will activate the -f (fifth parameter) for sendmail, and your return path will be as you want it to be.

    Thanks
    Aaron

  21. 21. Ritesh Says:

    Thanks Aaron for the great tip. I havent yet tried it though.

  22. 22. Michael JB Says:

    Ritesh! THANKS SO MUCH FOR THIS TIP! I have been bothered and wondering about how to fix this and your tip has set me up nicely. I added the php.ini file with the proper settings and everything is working like a charm. yes, it would be nice to get my name in the FROM line, but an email address other than blahblah@host999.hostmonster.com is good enough for me!

    I looked into Aaron’s suggestion and that looks like it may work. I’m wondering, though, would this change need to be made with each upgrade of Wordpress? If so, I prefer the php.ini solution!

    Thanks again!

    Michael

  23. 23. Aaron Dwyer Says:

    My method outlined a few comments above, will work, but when you upgrade wordpress you had best check that the file hasn’t been overwritten. Since it may have been.

    Some web hosts don’t allow individual php.ini files in your account, so you may be forced to use the method I mentioned.

    Aaron

  24. 24. Matthew Conley Says:

    Thanks I?ll give that a go!,

  25. 25. Organizasyon Says:

    It works. on old posts as well I guess. Great tip. and thanks for your comment…

  26. 26. Shonari Says:

    Hello this fix did not work for me, i dont know why but here is another that works:

    http://shonari.net/tutorials/changing-the-admin-sending-email-address-in-wordpress/

  27. 27. Carolyn Says:

    Awesome! Thank you - Thank you - Thank you!

  28. 28. Sam Says:

    Guys probably the problem is in wp_mail function that alters the headers incorrectly. I replaced wp_mail function with my own using phpmailer class and everything started to work fine. For some reason hostmonster doesn’t like the way wordpress format senders header. Another solution is to add “Sender” email in phpmailer class declaration (just go to wp-include folder and find class-phpmailer.php and on 89 line replace empty sender string with email u want to use as a sender and it will work the same way as editing php.ini file). It still sucks since now all your email will be coming from that preset email (no name, just email) instead of the normal way wordpress was doing it on any other hosting server. Sure it’s better then user324@host345.hostmonster.com email… I’m still looking for a solution to make it work normal. I’m trying to figure out where exactly wordpress messes that header or which part hostmonster doesn’t like… if you have any ideas, please share.

Leave a Reply