Chicken McNuggets! I've been through this whole same fiasco today.
You can either go to the php.ini and change the value of SMTP to your isp's smtp thing, or do it in the script likesy:
ini_set("SMTP","smtp.mail.yahoo.co.uk");
If your server needs authorisation I've heard ( a rumour ) that you can't do this with PHP as from version 4-point-something. For that you have to do it yourself with fsockopen and send
"auth login\r\n"
"username" (but base64 encoded)
"password" (also base64 encoded)
I'd like to know if you can do the authenticated this with mail() though, just in case I've been fed a trail of mukky breadcrumbs. Or told point blank it's right out of it, clearly.