If you want to avoid redundant mails, you can set a sequence of sent
id's and compare them at every loop iteration

for message to send:
    if not (the message was sent):
        send the email

Also, you should store email sent info between actions/task instances
to be able to query the sent list before sending. You can use a
special table or an extra field.

On 6 mar, 09:29, Sanjeet Kumar <sanjeet....@gmail.com> wrote:
> i am able to send the mail through the cron job but when i am going to send
> the mail by fetching the email id from the database i got confused in the
> logic :-
>
> i have the followng code :
>
> list = []
> import datetime
> currentdate = datetime.datetime.now()
> for row in db(db.employee.time == currentdate).select():
>     list.append(row.empdetail)
> here is my send mail function it is sending only the last id i know the for
> loop scope is ended that is the reason its happening but i am not be able
> to get the proper solution to send the mail to the each of the id only once
> with the all details when the date will be matched in the same table more
> than one emp details are there so i want to send the mail to the
> each individual employee at a time.

Reply via email to