Announcement

Collapse
No announcement yet.

Sending each mail in every 5 minutes.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sending each mail in every 5 minutes.

    Hello, Is there any way to send an email every 5 minutes rather than send emails after an hour at once?
    I think this would be a nice feature in mass email.

  • #2
    i think it would be great option. also it would be great even to specify a timeframe when to send email e.g send 10 emails every hour between 8 am and 5 pm.
    Rabii
    Web Dev

    Comment


    • minhaj
      minhaj commented
      Editing a comment
      Also option for the turn of sending mass emails on weekends like Saturday and Sunday.

  • #3
    Be aware, that such function not only depends on espoCRM but also on your server configuration. My provider allows as default only 60 Mails per hour. Ths is possible spam prevention.

    Comment


    • rabii
      rabii commented
      Editing a comment
      most providers will allow you to take control over how many emails to send per hour (excluding shared hosting).

    • cdmindya
      cdmindya commented
      Editing a comment
      Server code should not be changed at all.

      but just to check code with all its risks, you can change the email send rate from per hour to per minute in the "SendingProcessor"
      change the threshold from per hour to per minute ($threshold->modify('-1 hour'); to ($threshold->modify('-1 minute')

      public function process(MassEmail $massEmail, bool $isTest = false): void
      {
      $maxBatchSize = $this->config->get('massEmailMaxPerMinuteCount', self::MAX_PER_MINUTE_COUNT);

      if (!$isTest) {
      $threshold = new DateTime();
      $threshold->modify('-1 minute'); // Change from '-1 hour' to '-1 minute'

      $sentLastMinuteCount = $this->entityManager
      ->getRDBRepositoryByClass(EmailQueueItem::class)
      ->where([
      'status' => EmailQueueItem::STATUS_SENT,
      'sentAt>' => $threshold->format(DateTimeUtil::SYSTEM_DATE_TIME_FORMAT),
      ])
      ->count();

      if ($sentLastMinuteCount >= $maxBatchSize) {
      return;
      }

      $maxBatchSize = $maxBatchSize - $sentLastMinuteCount;
      }
Working...
X