![]() |
On Friday 24 Mar 2006 03:02, Charlie Chaklam wrote: > hi, > > Every first of the month i have to fax out a price list to my customers, i > some one can please tell me if i can use a list is mysql or postgres and > fax the same document to every one on that list. Edit this and save it as /usr/bin/faxcusts: #!/usr/bin/perl use DBI; die "Price list not found!" unless -e "/home/charlie/pricelist.ps"; $dbh=DBI->connect("DBI:mysql:database=stuff;host=localhost","root",""); $query = "SELECT fax FROM customers WHERE !(fax = '')"; $sth=$dbh->prepare($query); $sth->execute; while (($fax) = $sth->fetchrow_array) { $fax =~ s/\D//; `sendfax -n -d $fax /home/charlie/pricelist.ps`; }; $sth->finish; $dbh->disconnect; exit; And put this in some user's crontab: 30 4 1 * * /usr/bin/faxcusts As long as /home/charlie/pricelist.ps exists, the faxes will be sent out to every customer with a fax number in the `fax` field of `stuff`.`customers` at 04:30 on the first day of each month. The sending script as given above really needs fleshing out a bit, but you should get the idea ..... -- AJS ____________________ HylaFAX(tm) Users Mailing List _______________________ To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*