Is port 25 enabled and available? For example this thread explains that is is possible for another service to have exclusive access to it.
Have you tried this code in another machine (with less security)? I don't mean that as part of a fix, but just to make sure that the code is OK by itself.