from_email = 'andrey.belyy@gmail.com'; $this->mailer = new sender\unisender($this->public_key, $this->list_id); } public function test(){ die("you in ".__DIR__); } public function reloadSender(){ $this->mailer = new sender\unisender($this->public_key,$this->list_id); } public function changePublicKey($key){ $this->public_key = $key; } public function changeListId($list_id){ $this->list_id = $list_id; } function setFromName($name) { return $this->from_name = $name; } function setFromEmail($email) { return $this->from_email = $email; } function setToMail($email = array(), $string = false) { if($string) { $sendTo = array(); foreach($email as $user){ $sendTo[] = $user['email']; } $email =implode(",", $sendTo); return $this->to_email = $email; } else { return $this->to_email = $email; } } function setTitle($title) { return $this->title = $title; } function setMailMessage($mailMessage) { return $this->mailMessage = $mailMessage; } function setToName($to_name) { return $this->to_name = $to_name; } public function SendEmail() { $this->mailer->SendMail($this->to_email, '', $this->from_email, $this->from_name, $this->title, $this->mailMessage); } public function getDeliveryStatus( $campaign_id) { return $this->mailer->getCampaignStatus($campaign_id); } public function getCampaignDeliveryStats($campaign_id) { $status = $this->mailer->getCampaignDeliveryStats($campaign_id); return $status; } public function getVisitedLinks($campaign_id) { $status = $this->mailer->getVisitedLinks($campaign_id); } public function updateDeliveryData($campaign_id) { return $this->getDelivService()->save($campaign_id); } public function getDelivService() { $delivery_db = $this->getDi()->get('models')->getDelivery(); $delivery_email_db = $this->getDi()->get('models')->getDeliveryEmail(); if($this->deliveryService instanceof \deliveryServ) { return $this->deliveryService; } else { return $this->deliveryService = new \deliveryServ($delivery_db,$delivery_email_db); } } function getUsers($id='') { $model = new \customersEmailList(); if(!empty($id)){ $id = implode(",", $id); $model = array($model->findFirst("id = '$id'")->toArray()); } else { $model = $model->find()->toArray(); } return $model; } }