On 12/09/2011 14:37, Jon Harris wrote:
Hi List
I don't know if this is possible....
But we have developed a website for a customer with a CRM backend,
without around 72,000 subscribers.
We want to update and manage the subscriber list on the webserver and
generate the weekly mailshot, all these processes are running fine.
Our solution was to create threads on the web server (running IIS) to
generate emails to be sent by the middleware (a PHP like language). This
does work fine up to around a couple of thousand emails, then it runs
out of memory and the process dies. I am looking at some kind of
throttle, but its not a very elegant solution.
I thought if I could generate a postfix friendly file, I could create an
SMB share and drop the 72,000 files into a folder that Postfix would
"see" and then process.
I may be missing something obvious here, but I don't see why a program
that can't create 72,000 email messages without running out of memory
will be able to create 72,000 files without failing for exactly the same
reason. An email is, after all, merely a file which is written to an
external process (an SMTP server, in this example example) rather than a
physical location. In fact, I'm having difficulty imagining a reason why
any competently written program can't send an arbitrarily large number
of emails anyway - all it's doing is running round a loop repeatedly,
and it doesn't matter whether it does it 72 times or 72,000 times. The
real constraints are the capacity of your mail servers to handle that
many emails.
It sounds to me, therefore, is if what you've got is a serious flaw in
your mail-generation program, and I'd be inclined to address that rather
than trying to find a workaround for the problem that involves injecting
mail directly into the queue.
If you really can't fix the mail-generation program's sending limit (eg,
because it's a third-party CMS that comes with the bug built-in), then,
as has already been suggested, the simplest option is to use an
intermediate program which takes files from your storage directory and
then sends them out by email. That's not Postfix-specific; any program
which can read a file and then write to SMTP will work with any MTA. It
would be pretty trivial to code that in PHP or Perl, I'm presuming it
would be equally simple in Python, Ruby, ASP or your programming
language of choice. The only complex part of it is error handling to
ensure that you don't send the same message twice to the same person or
that you don't miss anyone out if any email fails to send.
Mark
--
Sent from my Babbage Difference Engine
http://mark.goodge.co.uk
http://www.ratemysupermarket.com