Esempio n. 1
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $mail = new SendMailController();
     $cam = $this->campaign;
     //        $list_ids = $cam->subscribers_lists()->select('id')->get()->pluck('id')->toArray();
     $str = implode(',', $this->list_ids);
     $query = "select distinct email from subscribers where id in " . "(select subscriber_id from subscriber_subscribers_list where subscribers_list_id in ({$str})) limit " . $this->take . " offset " . $this->skip;
     $subscribers = DB::select($query);
     //        $subscribers = $l->subscribers()->take($this->take)->skip($this->skip)->get();
     foreach ($subscribers as $subscriber) {
         if (filter_var($subscriber->email, FILTER_VALIDATE_EMAIL)) {
             $url = 'http://colorme.vn/manage/email/open?cam_id=' . $cam->id . '&to=' . $subscriber->email;
             $content = $cam->template->content . '<img src="' . $url . '" width="1" height="1"/>';
             $result = $mail->sendAllEmail([$subscriber->email], $cam->subject, $content);
             $email_id = $result->get('MessageId');
             $email = Email::find($email_id);
             if ($email == null) {
                 $email = new Email();
                 $email->id = $email_id;
                 $email->status = 0;
             }
             $email->campaign_id = $cam->id;
             $email->to = $subscriber->email;
             $email->save();
         }
     }
 }
 public function store(Request $request, Feedback $feedback, SendMailController $sendMailController)
 {
     $messages = ['required' => 'Поле  должно быть заполнено.', 'email' => 'Некорректно введенный email', 'max:255' => 'Максимально допустимое значение 255 символов', 'captcha' => 'Введите правильно символы с картинки!'];
     $v = Validator::make($request->all(), ['name' => 'required|max:255', 'email' => 'required|email', 'message' => 'required', 'captcha' => 'required|captcha'], $messages);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors())->withInput();
     } else {
         $feedback->insertFeedback($request->all());
         $sendMailController->sendFeedbackToAdmin($request->all());
         //Input::clearResolvedInstances();
         $info = "Спасибо за вопрос, в ближайшее время мы Вам ответим!";
         return redirect()->route('feedbackCreate', [$info]);
     }
 }
Esempio n. 3
0
 public function buy(Delivery $delivery, OrderController $orderController, OrderItemController $orderItemController, SendMailController $sendMailController)
 {
     $products = Input::get('basked');
     $deliveryId = Input::get('deliveryId');
     $deliveryInfo = $delivery->getPriceDelivery($deliveryId);
     $user = Input::get('user');
     $info = $orderController->Order($user, $deliveryInfo, $products, $orderItemController);
     $id = $info['id'];
     Session::forget('product');
     Session::forget('bascedCount');
     $sendMailController->checkMail($user, $info, $deliveryInfo);
     return $id;
 }