Sending an email via cron

view story

http://serverfault.com – I'd like some advice on how best to send an email after running a SQL query. Every day, I would like to run a PHP/SQL script to identify users who should be emailed. After this runs, I would like to email those users and attach a file for each user (which is the output of another PHP/SQL process). My approach thus far is to use use cron to call the php script and to write the csv output to a unique temporary directory for each user. However, I'm not sure how best to email the users this data. I'm using a CentOS server and using PostGreSQL for my database. (HowTos)