Opened 3 years ago

Last modified 14 months ago

#2875 new defect

Newsletter email send-limit per minute

Reported by: nicola.tommasi Owned by: cloudrexx
Priority: normal Milestone: Cloudrexx 5.0
Component: Newsletter Version: 5.0
Severity: normal Keywords: Newsletter, Send-Limit
Cc:

Description (last modified by thomas.daeppen)

Some hosting providers have a limit for the amount of sent emails per minute. This can cause the newsletter send functionality to fail, when it tries to send more mails than that limit.

The following is a workaround to limit the number of sent emails per time.

Make the following changes to the file modules/Newsletter/View/Template/Backend/module_newsletter_mail_send.html (for Contrexx: modules/newsletter/template/module_newsletter_mail_send.html):

  1. Go to the newsletter settings (Home > Email Marketing > Settings) and change "Maximum Newsletter Batch Size" to 1.

  1. Add "async: true" to the $J.ajax call (around line 116):
    Before:
        $J.ajax({
          url: 'index.php?cmd=newsletter&act=send&standalone=true&id={NEWSLETTER_MAIL_ID}',
          data: {id: {NEWSLETTER_MAIL_ID}, send: 1},
          type: 'POST',
          dataType: 'json',
          success: function(data){
    

After:

    $J.ajax({
      url: 'index.php?cmd=newsletter&act=send&standalone=true&id={NEWSLETTER_MAIL_ID}',
      data: {id: {NEWSLETTER_MAIL_ID}, send: 1},
      type: 'POST',
      dataType: 'json',
      async: true,
      success: function(data){
  1. Wrap the call of the newsletterSend-method in a setTimeout (Around line 135):
    Before:
              newsletterCycleTime = (new Date()).getTime() - newsletterCycleStartTime;
              newsletterCycleIncrement = newsletterCycleAmount / newsletterCycleTime * newsletterCycleSpeed;
    
              newsletterSend();
            } else {
    

After:

          newsletterCycleTime = (new Date()).getTime() - newsletterCycleStartTime;
          newsletterCycleIncrement = newsletterCycleAmount / newsletterCycleTime * newsletterCycleSpeed;

          setTimeout(newsletterSend, 2000);
        } else {

Of course the second parameter of the setTimeout call must be set with a value (in miliseconds, e.g 2 seconds = 2000) that makes sure the limit of the provider isn't exceeded.

I.e. if the provider's limit is 250 emails per hour, then the timeout should be set to 14000 (~ 14s).

Change History (3)

comment:1 Changed 3 years ago by michael.ritter

  • Milestone set to Cloudrexx 5.0

comment:2 Changed 3 years ago by thomas.daeppen

  • Description modified (diff)

comment:3 Changed 14 months ago by thomas.daeppen

  • Description modified (diff)
Note: See TracTickets for help on using tickets.