I think EquityPHP's code will help you with connecting to a different MySQL port, not mail port. We do probably need slightly more information, mymoney26. I'm no export on SMTP servers or anything, but what are you using to send mail in PHP? Are you using the PHP mail function
or maybe the PHPMailer classes
Also, are you using sendmail or postfix or some other server? Is SMTP Authentication required? If you're using Windows, you may even be able to edit the php.ini file and change the smtp_port (default 25) directive.
There's a lot involved in sending email from a webserver, a lot more than I think most people realize if you're not on a shared host. Still, try to answer some of these questions and maybe we can help you further.