/** * @param string $fromName * @param string $replyTo * @param string $subject * @param string $html * @param string $listName * @param array $options * @param array $contentOptions * * @return array|bool * * @throws \Bonsi\GetResponse\Newsletter\Exceptions\InvalidNewsletterList */ public function createCampaign($fromName, $replyTo, $subject, $html = '', $listName = '', $options = [], $contentOptions = []) { $list = $this->lists->findByName($listName); $defaultOptions = ['type' => 'regular', 'recipients' => ['list_id' => $list->getId()], 'settings' => ['subject_line' => $subject, 'from_name' => $fromName, 'reply_to' => $replyTo]]; $options = array_merge($defaultOptions, $options); $response = $this->getResponse->post('campaigns', $options); if (!$this->lastActionSucceeded()) { return false; } if ($html === '') { return $response; } if (!$this->updateContent($response['id'], $html, $contentOptions)) { return false; } return $response; }