You can specify an SMTP server if the OS is Windows. If the OS is *nix, the path to sendmail is required. In fact on a *nix server it isn't possible to specify an SMTP server in the same way that it is possible for Windows, it must be the path to sendmail. Without a proper configuration the mail function won't work. You can also bypass the mail() function by connecting to an SMTP server directly.
A PHP/C-Client/PEAR solution for webmail