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.
2 Pings to “Wordpress Sender Email incorrect on HostMonster”
28 Responses to “Wordpress Sender Email incorrect on HostMonster”
-
1.
devesh Says:
June 5th, 2008 at 3:36 pmThis is excellent resource mate
Just Dugg it for ya, and will be Stumbling it after 
-
2.
Ritesh Says:
June 5th, 2008 at 3:48 pmThanks for the digg Devesh - Am glad you found it useful.
I’m sure others hosted on Host Monster will find this useful.
-
3.
GOVO Says:
June 10th, 2008 at 12:47 pmI have tried it before, but it seems no sense too….let me try again….
-
4.
Ritesh Says:
June 10th, 2008 at 12:50 pm@GOVO - This worked absolutely fine for me. Are you following all the steps correctly?
-
5.
GOVO Says:
June 10th, 2008 at 1:07 pmThe 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.
Ritesh Says:
June 10th, 2008 at 2:19 pm@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.
GOVO Says:
June 10th, 2008 at 2:55 pmMybe, but I thing it is better to let it be….
-
8.
Ritesh Says:
June 10th, 2008 at 3:00 pmIf 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.
John Says:
June 10th, 2008 at 9:36 pmThanks. This is useful for me.
-
10.
Nandan Jha Says:
August 1st, 2008 at 4:04 pmI 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.
Ritesh Says:
August 1st, 2008 at 4:22 pm@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.
Nandan Jha Says:
August 1st, 2008 at 5:35 pmOk. 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.
Nandan Jha Says:
August 5th, 2008 at 5:21 pmSo 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.
Nandan Jha Says:
August 5th, 2008 at 5:27 pmIt works. on old posts as well I guess. Great tip. and thanks for your comment.
-
15.
Ritesh Says:
August 5th, 2008 at 5:29 pmIm glad it works for you

-
16.
Nandan Jha Says:
August 5th, 2008 at 5:35 pmOne 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.
Ritesh Says:
August 5th, 2008 at 7:53 pmI 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.
Nandan Jha Says:
August 8th, 2008 at 3:07 pmI 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.
Ritesh Says:
August 11th, 2008 at 5:25 pmThanks Nandan, thats great

-
20.
Aaron Says:
January 9th, 2009 at 12:08 pmWordpress 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.
Ritesh Says:
February 3rd, 2009 at 9:04 amThanks Aaron for the great tip. I havent yet tried it though.
-
22.
Michael JB Says:
May 8th, 2009 at 5:18 amRitesh! 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.
Aaron Dwyer Says:
July 9th, 2009 at 8:27 amMy 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.
Matthew Conley Says:
July 21st, 2009 at 7:28 amThanks I?ll give that a go!,
-
25.
Organizasyon Says:
July 24th, 2009 at 6:26 pmIt works. on old posts as well I guess. Great tip. and thanks for your comment…
-
26.
Shonari Says:
August 2nd, 2009 at 7:44 pmHello 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.
Carolyn Says:
September 29th, 2009 at 8:44 amAwesome! Thank you - Thank you - Thank you!
-
28.
Sam Says:
October 11th, 2009 at 1:47 pmGuys 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.







June 16th, 2009 at 10:22 am
[...] 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 [...]
August 2nd, 2009 at 7:41 pm
[...] Another possible solution can be found here. [...]