Re: Database viewpoint of subject - Sending e-mails from database table with Cronjob

From: Andre Lopes <lopes80andre(at)gmail(dot)com>
To: Allan Kamau <kamauallan(at)gmail(dot)com>
Cc: A B <gentosaker(at)gmail(dot)com>, postgresql Forums <pgsql-general(at)postgresql(dot)org>
Subject: Re: Database viewpoint of subject - Sending e-mails from database table with Cronjob
Date: 2010-04-21 15:05:36
Message-ID: m2q18f98e681004210805tcaab9958he014672a3dead20e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

It is not for SPAM, the 100.000 e-mails is only for example purposes. But I
must to draw the code to be possible to send this volume, just in case if it
happens.

There are examples on how can I do this?

Best Regards,

On Wed, Apr 21, 2010 at 4:01 PM, Allan Kamau <kamauallan(at)gmail(dot)com> wrote:

> On Wed, Apr 21, 2010 at 3:41 PM, Andre Lopes <lopes80andre(at)gmail(dot)com>
> wrote:
> > Hi,
> >
> > Thanks for the reply.
> >
> > [quote]
> > The other way is to let the cron job spawn new processes (up to a
> > limited number of child proceses) as long as there are mails to send.
> > These child processes runs as long as there are mails to send, then
> > they die. The cron job will then mostly do process controll/start new
> > processes.
> > [/quote]
> >
> > How can I do this. I'am thinking to use a PHP Script?
> >
> > Best Regards,
> >
> >
> > On Wed, Apr 21, 2010 at 12:35 PM, A B <gentosaker(at)gmail(dot)com> wrote:
> >>
> >> > I generate e-mail messages to a database table and then with a CronJob
> I
> >> > sent the e-mails.
> >> >
> >> > My doubt is... The CronJob runs every 10 minutes, but If I have
> 100.000
> >> > e-mails to send the script will not be able to send all the 100.000
> >> > e-mails
> >> > in 10 minutes.
> >> >
> >> > How can I deal with this problem? There is no problem to have multiple
> >> > CronJobs runing in background?
> >>
> >> If N is the number of mails you can send per cronjob in 10 minutes,
> >> then run 100 000/N cron jobs.
> >> You will be very happy if you also add som kind of "sleep" (for a
> >> growing number of seconds) to the cronjobs when there are currently no
> >> more mails to send. Otherwise you will end up with a very annoying CPU
> >> load.
> >>
> >> The other way is to let the cron job spawn new processes (up to a
> >> limited number of child proceses) as long as there are mails to send.
> >> These child processes runs as long as there are mails to send, then
> >> they die. The cron job will then mostly do process controll/start new
> >> processes.
> >>
> >> That ought to do the trick.
> >
> >
>
>
> I really hope this is not for SPAM mail.
>
> Allan.
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-04-21 15:07:22 Re: Tablespace Problem
Previous Message Allan Kamau 2010-04-21 15:01:38 Re: Database viewpoint of subject - Sending e-mails from database table with Cronjob