Odoo Help


How to use a limit/hour when sending mass mail

Sid Ahmed DINE
on 2/27/13, 4:54 PM 4,058 views

How to limit the number of email to send per hour when using process email queue?

I've the same problem. I think a cron can make this, but i don't know how. I tell you if I found or tell me if you do.

Bonnet Denis
on 3/12/13, 1:58 PM
Sid Ahmed DINE
On 4/3/13, 8:51 AM

Modify the process_email_queue adding limit argument at the search method (here limit=400)

def process_email_queue(self, cr, uid, ids=None, context=None): """Send immediately queued messages, committing after each message is sent - this is not transactional and should not be called during another transaction!

       :param list ids: optional list of emails ids to send. If passed
                        no search is performed, and these ids are used
       :param dict context: if a 'filters' key is present in context,
                            this value will be used as an additional
                            filter to further restrict the outgoing
                            messages to send (by default all 'outgoing'
                            messages are sent).
    if context is None:
        context = {}
    if not ids:
        filters = ['&', ('state', '=', 'outgoing'), ('type', '=', 'email')]
        if 'filters' in context:
        ids = self.search(cr, uid, filters, context=context, limit=400)
    res = None
        # Force auto-commit - this is meant to be called by
        # the scheduler, and we can't allow rolling back the status
        # of previously sent emails!
        res = self.send(cr, uid, ids, auto_commit=True, context=context)
    except Exception:
        _logger.exception("Failed processing mail queue")
    return res

is this done directly in the code, or is it done in configuration settings?

Landis Arnold
on 11/27/13, 10:48 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 2/27/13, 4:54 PM
Seen: 4058 times
Last updated: 3/16/15, 8:10 AM