Unsubscribe

Tarun Arora

New Member
Hi, my requirement is as below
if any email id is unsubscribed from any list, then email should not be sent to him from any other list which is already added or to be added.

If this requires some custom code to be added, pls suggest. after reading other forums I added the below code where its marking it an blacklist but from other list email is being sent.

Backend > Settings > Customers > Lists > Use own blacklist (same in customer group).

PHP:
Yii::app()->hooks->addAction('frontend_lists_after_track_campaign_unsubscribe', function($controller, CampaignTrackUnsubscribe $track) {
$exists = CustomerEmailBlacklist::model()->findByAttributes([
'email' => $track->subscriber->email,
'customer_id' => $track->campaign->customer_id,
]);
if (!empty($exists)) {
return;
}

$model = new CustomerEmailBlacklist();
$model->email = $track->subscriber->email;
$model->customer_id = $track->campaign->customer_id;
$model->reason = 'Add your message here';
$model->save(false);

$track->subscriber->saveStatus(ListSubscriber::STATUS_BLACKLISTED);
});
 
Are new records added in the customer backlist?
Where exactly and how did you add the abioe PHP code?
 
Back
Top