twisted1919
Administrator
Staff memberI think this is my bad....
In apps/frontend/DswhController.php, processElasticemail() should look like:
Once you change it like so, it'll start working.
Thanks.
In apps/frontend/DswhController.php, processElasticemail() should look like:
PHP:
protected function processElasticemail()
{
$request = Yii::app()->request;
$category = trim($request->getQuery('category'));
$transaction = trim($request->getQuery('transaction'));
if (empty($transaction) || empty($category)) {
Yii::app()->end();
}
$deliveryLog = CampaignDeliveryLog::model()->findByAttributes(array(
'email_message_id' => $transaction,
'status' => CampaignDeliveryLog::STATUS_SUCCESS,
));
if (empty($deliveryLog)) {
$deliveryLog = CampaignDeliveryLogArchive::model()->findByAttributes(array(
'email_message_id' => $transaction,
'status' => CampaignDeliveryLogArchive::STATUS_SUCCESS,
));
}
if (empty($deliveryLog)) {
Yii::app()->end();
}
$campaign = Campaign::model()->findByPk($deliveryLog->campaign_id);
if (empty($campaign)) {
Yii::app()->end();
}
$subscriber = ListSubscriber::model()->findByAttributes(array(
'list_id' => $campaign->list_id,
'subscriber_id' => $deliveryLog->subscriber_id,
'status' => ListSubscriber::STATUS_CONFIRMED,
));
if (empty($subscriber)) {
Yii::app()->end();
}
$bounceLog = CampaignBounceLog::model()->findByAttributes(array(
'campaign_id' => $campaign->campaign_id,
'subscriber_id' => $subscriber->subscriber_id,
));
if (!empty($bounceLog)) {
Yii::app()->end();
}
if (in_array($category, array('Ignore', 'NoMailbox', 'AccountProblem', 'ConnectionTerminated', 'ContentFilter'))) {
$softBounce = in_array($category, array('AccountProblem', 'ConnectionTerminated', 'ContentFilter'));
$bounceLog = new CampaignBounceLog();
$bounceLog->campaign_id = $campaign->campaign_id;
$bounceLog->subscriber_id = $subscriber->subscriber_id;
$bounceLog->message = 'BOUNCED BACK';
$bounceLog->bounce_type = $softBounce ? CampaignBounceLog::BOUNCE_SOFT : CampaignBounceLog::BOUNCE_HARD;
$bounceLog->save();
if ($bounceLog->bounce_type == CampaignBounceLog::BOUNCE_HARD) {
$subscriber->addToBlacklist($bounceLog->message);
}
Yii::app()->end();
}
if ($category == 'Spam') {
if (Yii::app()->options->get('system.cron.process_feedback_loop_servers.subscriber_action', 'unsubscribe') == 'delete') {
$subscriber->delete();
Yii::app()->end();
}
$subscriber->status = ListSubscriber::STATUS_UNSUBSCRIBED;
$subscriber->save(false);
$trackUnsubscribe = new CampaignTrackUnsubscribe();
$trackUnsubscribe->campaign_id = $campaign->campaign_id;
$trackUnsubscribe->subscriber_id = $subscriber->subscriber_id;
$trackUnsubscribe->note = 'Unsubscribed via Web Hook!';
$trackUnsubscribe->save(false);
Yii::app()->end();
}
Yii::app()->end();
}
Once you change it like so, it'll start working.
Thanks.