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.

Comments

comments