diff --git a/src/services/SendoutsService.php b/src/services/SendoutsService.php index 872081d2..306ecffb 100755 --- a/src/services/SendoutsService.php +++ b/src/services/SendoutsService.php @@ -18,7 +18,6 @@ use DOMDocument; use DOMElement; use putyourlightson\campaign\Campaign; -use putyourlightson\campaign\controllers\TrackerController; use putyourlightson\campaign\elements\ContactElement; use putyourlightson\campaign\elements\MailingListElement; use putyourlightson\campaign\elements\SendoutElement; @@ -101,17 +100,6 @@ public function getSendoutBySid(string $sid): ?SendoutElement return $this->getSendoutById($sendoutId); } - /** - * Returns sendout send status by ID. - */ - public function getSendoutSendStatusById(int $sendoutId): bool|string|null - { - return SendoutRecord::find() - ->select(['sendStatus']) - ->where(['id' => $sendoutId]) - ->scalar(); - } - /** * Returns the sendout’s pending recipients. */ @@ -313,17 +301,13 @@ public function sendEmail(SendoutElement $sendout, ContactElement $contact, int Campaign::$plugin->mailer->useFileTransport = true; } - /** - * Use the one-click unsubscribe controller action. - * - * @see TrackerController::actionOneClickUnsubscribe() - */ - $oneClickUnsubscribeUrl = str_replace('campaign/t/unsubscribe', 'campaign/t/one-click-unsubscribe', $contact->getUnsubscribeUrl($sendout)); - /** @var Message $message */ $message = Campaign::$plugin->mailer->compose(); if (Campaign::$plugin->settings->addOneClickUnsubscribeHeaders) { + // Use the one-click unsubscribe controller action. + $oneClickUnsubscribeUrl = str_replace('campaign/t/unsubscribe', 'campaign/t/one-click-unsubscribe', $contact->getUnsubscribeUrl($sendout)); + $message->setHeader('List-Unsubscribe-Post', 'List-Unsubscribe=One-Click') ->setHeader('List-Unsubscribe', $oneClickUnsubscribeUrl); }