Smtp vs php mail instant delivery & avoiding spam

im having around 5000 subscribers, all are legit , all emails sent to my subscribers has an unsubscribe link
No timeframe i.e No weekly or monthly email …the emails are sent based on a result produced by a php script [the script runs as a cron job]

All emails are time sensitive i.e they have to be delivered within a few minutes to all the subscribed users
Hence i cannot split the mails over a day

i have the below code which works perfectly
The problem is sometimes the mails are getting marked as spam [may be because content is same and is sent to thousands]

i saw some third party services but for 5000-10000 subscriber they charge a lot , i can spend only around $5-$10 for this service…

i d like to know whats the best method to send bulk mail plus avoiding getting marked spam ??
SMTP vs PHP mail function which would be recommended??

if its SMTP, please try giving a sample code as i dont have any experience with dat…
If u have any other options u can metion dat too…

$headers = "Content-Type: text/html" . "\\r\
" .
    'From:' . "\\r\
" .
    'Reply-To:' . "\\r\
" .
    'X-Mailer: PHP/' . phpversion();

$msg= "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /><title>Email</title></head>

$subscriber_result=mysql_query("select * from subscriber'");


mail($emailid, 'Email Alert Service', $msg,$headers);