At 12:21 PM 5/28/02 -0500, rory oconnor wrote: >I manage my mailing lists (yes, the are opt-in) in mysql and operate on >it with perl. However, the missing piece right now is the mailing >execution element. I'd like to create a perl script that will mail each >one of my receipients a personalized message. > >I can create and send the message, but the part I'm wondering about is >the processing. If i just do a query for all e-mails and then execute >the mailing in a "while" loop, does that tie up the table and/or put a >heavy strain on the mysql server or the web server itself? it's a >pretty fast server with plenty of RAM. > >Would it be better to loop through the table and write all the >recipients to a temp file, then loop thru the file and execute the >mailing? > >The reason I'm so concerned about it is that some of my lists are quite >large, like, over 100,000. I don't want to kill mysql, the web server, >or the mailserver by overburdening it. If anyone's done anything like >this, any help is appreciated!
I wouldn't be surprised if there were canned programs or modules for doing this already. But I think if I were doing it myself I would start two processes: one to retrieve the email addresses from mysql and pass them over to the second process, which batches them up into groups of N addresses (best value for N depends on factors I am not qualified to determine) and sends them to sendmail with the option set to queue the mail; that will ensure the most rapid return from sendmail. Then make sure you have plenty of queue space. This will minimize the connection time to the database. Although I don't know why you're worried about straining the mysql server; if you do everything in one process that sends mail synchronously you've expended just as much (well a bit less) total resources, you've just remained connected to the database longer. Unless there's some issue with that, why not do it the simple way, then you don't have to worry about making sure you have a big enough mail spool. -- Peter Scott Pacific Systems Design Technologies Boston Perl Classes in July: http://www.perldebugged.com/ http://stemsystems.com/class/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]