Thursday, January 7, 2010

GoDaddy disallows 3rd party SMTP relay

My wife has been using GoDaddy to host her web site, Helen's Kitchen, for about four years now. She's generally been happy with it. That is, until now.

First, I should clarify. The web and mysql server services provided by GoDaddy are still solid---besides occasional slowness and an occasional brief outage, there has been little to complain about (though wading through the 1000 useless offers in order to do anything on the GoDaddy site is a bit of a pain). The problem has been with email relaying. Helen's site sends her and customers email(s) when users sign up for classes. Once or twice in the past, there have been multi-hour email backups where emails would not be sent from GoDaddy's servers until many hours after they were entered into the mail queue by Helen's web site. These were annoying, but GoDaddy was responsive and addressed the problem fairly quickly.

E-mail is once again a problem. But, whereas GoDaddy has fixed the problem quickly in the past, Helen is now waiting on emails that were queued 4 days ago. And, it is very clearly a problem of GoDaddy simply getting the messages out-the-door and not due to intermediate servers. As of 2 days ago, GoDaddy had officially recognized the problem and was "working on it." But, the problem still hadn't been resolved as of late last night. Our first response was to seek a 3rd party SMTP relay provider. But after signing-up with AuthSMTP, and running a successful test from my home machine, we learned that GoDaddy blocks all outgoing TCP connections from their shared web hosting servers, making it quite challenging to send email via a 3rd party provider.

GoDaddy representatives keep telling us that we should just upgrade to a virtual dedicated server (for 5x the price!). This would allow us to make outgoing TCP connections. But, a quick chat with a justhost representative indicates that they would allow an outgoing TCP connection (so that we could do 3rd party SMTP relaying) once we convince them we aren't going to use it to spam. So, I don't understand why we should pay GoDaddy more money when the level of service seems to be falling. What I find especially surprising about all this is that the requirements for my wife's web site are tiny: 1000s of uniques/month; the entire database is less than 100k uncompressed. So, we might just have to switch to another web provider...

Monday, October 12, 2009

Better access to properties/attributes

Iterating through an object's properties/attributes is something you can easily do with __dict__ in Python. PHP doesn't automatically give you this feature, but you can build it in via the __get and __set overloads. It requires that you follow a certain class definition pattern, but it should not be hard to add this pattern after a class is established:
class Foo {
  private $data = array();
  function __get($k) {
    return $this->data[$k];
  }
  function __set($k, $v) {
    $this->data[$k] = $v;
  }
  function __isset($k) {
    return isset($this->data[$k]);
  }
  function __unset($k) {
    unset($this->data[$k]);
  }
}
The $data attribute acts as the object itself; __get and __set translate between object property and array entry requests. __isset and __unset handle sset() and unset() calls (only PHP 5.1.0+). Documentation can be found in the Overloading section of the PHP manual. Once you've implemented this pattern, it's trivial to access the object's attributes as an array which means that it's easy to iterate over entries.