for the mail part, you can use PHPs built in mail function
http://www.phpbuilder.com/manual/ref.mail.php
This will work through localhost as long as you have the server configured with sendmail or whatever. Coming from localhost though, some providers may see it as spam, so even though it's getting sent it may be filtered before it makes it to your yahoo account or whatever.
The SMS part you can use any number of APIs for the code part, but you will need to go through an SMS gateway. I'm not overly familiar with that stuff, but last time I took a look, it was a few pennies a message. There might be better free alternatives now a days.
http://www.google.com/#hl=en&source=hp&q=php+sms+gateway&aq=f&aqi=g3g-m2&aql=&oq=&gs_rfai=CGb9lPVcATIWvHJ-yMeqlscUHAAAAqgQFT9BejOM&fp=1a3caa30e0a876cf