esteemed monks,
so, mailman is finally causing unbearable load on my little server because of a rather active one-way mailinglist with 8000 members that get a 300kb mail each (are loads > 3 normal on a 2GHz processor because of this, by the way? why do mailman's python processes use incredible amounts of RAM even when nobody's using them?)
So i decided to write my own little bulkmailer that simply mails a file that was received via some .forward or .qmail to a list of people registered in a mysql table.
I don't think i'm reinventing too many wheels doing this, since i want very fine-grained information on the progress of any on-going mailing, and need very customizable throttle-control, so that i can tune the script until i can rest assured that there will be no load-spikes no matter what my crazy clients think everybody should know (it's not spam, obviously).
So, my plan up to now is to do the following:
have a minimalistic script receive the complete email via STDIN by using .forward or .qmail files. this script simply stores the email source, unaltered, somewhere on disk, stores the filename in a mysql table, and sends a confirmation mail to the owner of the list, asking him to click on a link in order to start the sending process.
behind the above mentioned link is a a CGI script that, upon confirmation by the list's owner, fires off another perl script that goes into a daemon-esque mode and actually sends the mails
this 'sender' program reads in the email source from a file, deletes the 'To:' line in the header, opens a SMTP connection, { slaps the receiver's email address ontop of the message source and sends it to the SMTP server } foreach list member
now, i have a couple of doubts:
what is the 'correct' way to start a long-running program from a CGI script? ( exec()|system() ) and detaching from STD(IN|OUT|ERR)? some kind of fork? letting some other, cron-run program check whether there are pending mailings, and start the daemon from there instead of from the CGI (the CGI script runs as apache or nobody, which might pose problems later on?)
would simply deleting the 'To:' line of the email's source, and slapping on a custom 'To:' for each receipient, and handing that of to SMTP be enough for what i am trying to accomplish? (one 'To:' per email - not 8000 per email, as one might read)
how do i send these emails? should i inject them directly into qmail's queue (how?), send them directly via Net::SMTP to the receiver's server, or should i connect to localhost's SMTP server using any of the standard modules, and let that SMTP server handle the rest?
I'm still looking into using the great Mail::Bulkmail, but it seems almost too powerful, and i can't seem to find a way to have some 'callback' called after each mail so that i can update progress information, handle errors, etc.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.