Jump to content


Scheduled Campaigns do not honor unsubscribed campaign category

unsubscribe campaign category scheduled campaign

  • Please log in to reply
2 replies to this topic

#1 rordallas



  • Members
  • PipPip
  • 16 posts

Posted 04 August 2020 - 10:51 AM

X2CRM version 8.0


Scenario 1:

A contact unsubscribes from a specific campaign category email, such as Marketing. The contact email address is then listed in the appropriate x2_list_items table as unsubscribed.


Create a new campaign with the Marketing category specified.  Include the Contact that has unsubscribed in the contact list for the campaign.


Launch the campaign from the interface by clicking the 'Launch' button.


The result of this is the contact is not emailed because they have already unsubscribed.  THIS IS THE EXPECTED RESULT


Scenario 2:

Same as above except schedule the campaign for some time in the future.


When the campaign fires, the result is the contact is emailed.  UNEXPECTED RESULT

#2 jack



  • Administrators
  • 61 posts

Posted 06 August 2020 - 10:58 AM

Thank you for the bug report rordallas,

I have writen a fix that will now be in the next update.



If you need it now add this function to "protected/modules/marketing/models/Campaign.php

    //check to make sure unsubscribe list exsist, if not make the list
    public static function checkUnsubList($Category) {
        $FullName = 'Unsubscribe_' . $Category . '_X2_internal_list';
        $list = CActiveRecord::model('X2List')
                        ->findByAttributes(array('name' => $FullName));
        if (empty($list)){
            $NewUNSub = new X2List;
            $NewUNSub->modelName = 'Contacts';
            $NewUNSub->type = 'UnSubscribe';
            $NewUNSub->assignedTo = 'Anyone';
            $NewUNSub->visibility = 1;
            $NewUNSub->name = $FullName;
            $NewUNSub->nameId = $FullName;
            $NewUNSub->createDate = time();
            $NewUNSub->lastUpdated = time();
            $NewUNSub->logicType = 'AND';

and add to the file protected/modules/marketing/components/CampaignMailingBehavior.php

                        //check catagory
                        $FullName = 'Unsubscribe_' . $campaign->category . '_X2_internal_list';
                        $catlist = CActiveRecord::model('X2List')->findByAttributes(array('name' => $FullName));
                        $campaign->categoryListId = $catlist->id;
under the line 
                                          if($newList->save()) {
in the function 
                             public static function sendMail($id = null, $t0 = null)

#3 rordallas



  • Members
  • PipPip
  • 16 posts

Posted 18 August 2020 - 01:13 AM

Thanks for your prompt response to this matter!

Also tagged with one or more of these keywords: unsubscribe, campaign category, scheduled campaign

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users