On the Web Development Blog there's a recent post about using the PHPMailer package to send email out via the Google Mail servers.
These days I tried some plugin to send mail message within bbpress via SMTP. Since my domains email is hosted with Google applications I decided to send my messages via the SMTP server from Gmail. I found several articles and tutorials, but a lot of them didnâ€™t work for me. [...] You need for this code example a PHP5 enabled web host (I tested only on Linux), the port 465 need to be open and of course you need a Gmail or Google applications account.
Complete code is provided - a smtpmailer function that takes in the standard mail parameters (to, from, subject, msg) and ships the message off to the Gmail STMP servers (on their custom port 465).