Uploaded image for project: 'Blesta Core'
  1. Blesta Core
  2. CORE-4776

Prevent emails to empty recipient list

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.7.0-b1
    • Component/s: None
    • Labels:
      None

      Description

      Add a validation rule to prevent emails from being sent to empty recipient list.

        Activity

        jonathan Jonathan Reissmueller created issue -
        jonathan Jonathan Reissmueller made changes -
        Field Original Value New Value
        Rank Ranked higher
        jonathan Jonathan Reissmueller made changes -
        Story Points 2
        jonathan Jonathan Reissmueller made changes -
        Sprint 5.7.0 Sprint 1 [ 169 ]
        jonathan Jonathan Reissmueller made changes -
        Assignee Jonathan Reissmueller [ jonathan ]
        Hide
        jonathan Jonathan Reissmueller added a comment -

        In app/models/emails.php around line 1262 change

                // Set the to addresses
                $rules['to_addresses'] = [
                    'format' => [
                        'rule' => [[$this, 'validateEmailAddresses'], (isset($vars['to_addresses']) ? $vars['to_addresses'] : null)],
                        'message' => $this->_('Emails.!error.to_addresses.format')
                    ]
                ];
        

        To

                // Set the to addresses
                $rules['to_addresses'] = [
                    'empty' => [
                        'rule' => 'isEmpty',
                        'negate' => true,
                        'message' => $this->_('Emails.!error.to_addresses.empty')
                    ],
                    'format' => [
                        'rule' => [[$this, 'validateEmailAddresses'], (isset($vars['to_addresses']) ? $vars['to_addresses'] : null)],
                        'message' => $this->_('Emails.!error.to_addresses.format')
                    ]
                ];
        

        In language/en_us/emails.php around line 40 change

        $lang['Emails.!error.action.exists'] = 'The action given is an invalid email group action.';
        

        To

        $lang['Emails.!error.action.exists'] = 'The action given is an invalid email group action.';
        $lang['Emails.!error.to_addresses.empty'] = 'At least one To address must be provided.';
        
        Show
        jonathan Jonathan Reissmueller added a comment - In app/models/emails.php around line 1262 change // Set the to addresses $rules['to_addresses'] = [ 'format' => [ 'rule' => [[$ this , 'validateEmailAddresses'], (isset($vars['to_addresses']) ? $vars['to_addresses'] : null )], 'message' => $ this ->_('Emails.!error.to_addresses.format') ] ]; To // Set the to addresses $rules['to_addresses'] = [ 'empty' => [ 'rule' => 'isEmpty', 'negate' => true , 'message' => $ this ->_('Emails.!error.to_addresses.empty') ], 'format' => [ 'rule' => [[$ this , 'validateEmailAddresses'], (isset($vars['to_addresses']) ? $vars['to_addresses'] : null )], 'message' => $ this ->_('Emails.!error.to_addresses.format') ] ]; In language/en_us/emails.php around line 40 change $lang['Emails.!error.action.exists'] = 'The action given is an invalid email group action.'; To $lang['Emails.!error.action.exists'] = 'The action given is an invalid email group action.'; $lang['Emails.!error.to_addresses.empty'] = 'At least one To address must be provided.';
        abdy Abdy Franco made changes -
        Status Open [ 1 ] In Review [ 5 ]
        Resolution Fixed [ 1 ]
        abdy Abdy Franco made changes -
        Status In Review [ 5 ] Closed [ 6 ]
        abdy Abdy Franco made changes -
        Sprint 5.7.0 Sprint 1 [ 169 ]

          People

          • Assignee:
            jonathan Jonathan Reissmueller
            Reporter:
            jonathan Jonathan Reissmueller
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Fix Release Date:
              4/May/23