You can use your gmail but dont forget, gmail has limits and verifications (for example amount of emails being sent by hour), also it uses SSL in the connections so the normal codes you see around for mailing people from within your server won't suit you, you gona need a socket or imap code in order to succefull connect to gmail or maybe even using their api not sure if you can do that from normal accounts but you should check about it, might be easier then the 2 options above.
You can see some php samples here: http://php.net/manual/en/function.mail.php
Some perl sample here: http://www.perlfect.com/articles/sendmail.shtml
I am not aware of any samples connecting to gmail so i am sorry on that one...
EDIT about the smtp server:
If you are not able to use gmail then yes, you will need a stmp server (but if you have a hosting plan anywhere you might have access to it, so dont worry), if you make your own depending on how your connection is, it won't be a good approch because of how most system classify emails specially comming from a dynamic ip for example.