This shows you how to send mails from a - in this case virtual debian server inside VirtualBox - server to an external SMTP server. You can use your own server, Gmail or any other SMTP server you have access to.
This can then be used to send mail from PHP, Rails, Python, console or whatever you like.
The steps are for a debian wheezy server.