Setting the FROM address in Drupal hosted on Bluehost
I wrote an article recently on some email issues I faced when hosting my Drupal site on Bluehost.....well guess what - I came up against some more fun. The problem that arose is that the Bluehost setup does not really allow you to set the FROM address of an email from Drupal. For a variety of reasons I needed to be able to configure this on a per form basis but try as I might all I could get was something like <accountname>@box822.bluehost.com which is just ugly.
I spend ages trying to find an answer to this problem and no-one was very specific. I contacted Bluehost eventually told me that I could improve on this by uncommenting the line: ;from="email@example.com" in the PHP ini file and replacing the email address with the one I wanted to use. However this was still no good to me as I wanted to be able change it.
In the end I decided to brave it out and install the PHPMailer module....actually I should say I first tried the SMTP authentication support module but that didn't want to play and also only seems to use an old version on PHPMailer so I'd recommend giving that a miss.
My intention was to use an external SMTP provider like Google or something however here's the good news; On Bluehost I discovered you don't have to. All you need to do is:
- Install the module (make sure you read the instructions and get the PHPMailer library (NOTE: The URL in the instructions is wrong you actually want: https://github.com/Synchro/PHPMailer)
- Set your SMTP server as "localhost" and DON'T put anything in the authentication box like this:
Easy as that! You can now send mail FROM any address you like from your Drupal site on Bluehost. I really spent ages trying to solve this so I hope this helps other people.