PDA

View Full Version : Getting Forums/Blogs/etc. to Send Emails...



PainKiller
04-26-2008, 08:45 PM
I've been working to migrate some sites that I host at home over to Bluehost.com, and I've had problems getting the mail function to work. I've tried searching their knowledge base and searching here, but did not find my answers either place. So I experimented. The nice thing about using the command line is, you get immediate feedback when something doesn't work.

I wanted to share what I've learned, in case someone else might need the info. I apologize if this is disjointed, but I'm trying to document the information as I learn. That doesn't always happen in nice "how-to" fashion.

If you're trying to set up a php-based site like phpBB3, Wordpress, etc. you will have to configure how outgoing mail is to be sent. Most packages (and for sure phpBB3) offer the option of using either the php mail() function, or using SMTP. The simplest way, IMO, is to use the php mail() function. In phpBB3, this isn't specified, but it's what happens if you select "No" for using SMTP.

From the command line, when using the php mail() function, I learned that the script is not required to provide a "From" email address. If it is not specified, the system uses the default email address for your account ($LOGNAME@HOST, not @$DOMAINNAME). However, if you DO supply a "From:" email address, it MUST be one that is a valid email address that is hosted by Bluehost.com (that's important--see next paragraph). I was able to use my default one, and another one as well -- both from my default domain (painfreecomputing.com). I still need to check to see if (and how) add-on domains work with this.

From within an application (like phpBB3), you can generally assume that the application itself WILL provide a "From" address (whatever you have specified during the setup), so you MUST choose a valid one that is hosted by Bliuehost.com. I believe subdomains will work, but I have not determined the proper syntax yet to make them work.

I was told that SMTP works as well, but it definitely expects some sort of AUTH scheme, and does not prompt. Based on the errors in the SMTP transaction, I'm guessing it's looking for a POP connection before allowing an SMTP transaction (this is commonly called the "POP-before-SMTP" form of authentication). Applications like phpBB3 can do this, but I did not try it. I did not pursue this further, because testing this would be tricky from the command line, as it requires two separate connections -- POP on port 110 and SMTP on 25. That's just too much work when php mail() seems to work fine.

Jack