Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
14488 Lượt xem

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

Ảnh đại diện
Huỷ bỏ

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.

Tác giả Câu trả lời hay nhất

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
                        instead.
       :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:
            filters.extend(context['filters'])
        ids = self.search(cr, uid, filters, context=context, limit=400)
    res = None
    try:
        # 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
Ảnh đại diện
Huỷ bỏ

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 7 25
882
5
thg 5 25
18304
0
thg 4 25
1162
1
thg 4 25
1605
0
thg 3 25
1446