コード例 #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();
         }
     }
 }
コード例 #2
0
 public function makePrimary($id)
 {
     /**
      * @var $email Email
      */
     $email = Email::find($id);
     if (is_null($email)) {
         return redirect('/')->withErrors(['Invalid email.']);
     }
     Auth::user()->email = $email->email;
     Auth::user()->save();
     return redirect('/');
 }
コード例 #3
0
ファイル: SettingsController.php プロジェクト: sislex/cat
 public function updateEmail()
 {
     $input = \Request::all();
     if ($input['id']) {
         $email = Email::find($input['id'])->update($input);
         ///            $email['id'] = $input['id'];
     } else {
         Email::create($input);
     }
     return \Redirect::action('Admin\\SettingsController@email');
 }
コード例 #4
0
 public function destroy($id)
 {
     $email = Email::find($id);
     $contact = $email->contact;
     $email->delete();
     return redirect()->back()->with('warning', "email to {$contact->email} deleted");
 }
コード例 #5
0
 public function receive_notifications()
 {
     $post = file_get_contents('php://input');
     // $test = new Test;
     // $test->content = $post;
     // $test->save();
     $noti = json_decode($post);
     $message = json_decode($noti->Message);
     $mail_id = $message->mail->messageId;
     $mail_status = $message->notificationType;
     $mail = Email::find($mail_id);
     if ($mail == null) {
         $mail = new Email();
     }
     $mail->status = email_status_str_to_int($mail_status);
     $mail->save();
 }
コード例 #6
0
ファイル: web.php プロジェクト: Dimimo/Booklet
//facebook registration and login
Route::get('auth/facebook', 'Auth\\AuthController@redirectToProvider')->name('facebook.login');
Route::get('auth/facebook/callback', 'Auth\\AuthController@handleProviderCallback')->name('facebook.callback');
/*
|--------------------------------------------------------------------------
| help files
|--------------------------------------------------------------------------
|*/
Route::get('help/index', 'HelpController@index')->name('help.index');
Route::get('help/why-register', 'HelpController@whyRegister')->name('help.why-register');
/*
|--------------------------------------------------------------------------
| helper for debugging ajax request and replies
|--------------------------------------------------------------------------
|*/
Route::get('emailtest', function () {
    $user = \App\User::find(4);
    $email = \App\Email::find(1);
    \App\Email::sendNewEmailNotification($user, $email, true);
    //$email = new \App\Mail\ForgotPassword();
    //Mail::to('*****@*****.**')->send($email);
});
Route::get('error', function () {
    return view('error');
});
//Route::get('google/page', 'ApiController@googleCoordsPage')->name('google.page');
//Route::get('google/coords/{city}', 'ApiController@getGoogleCoords')->name('google.coords');
//for compiling JS
Route::get('compiler', function () {
    return view('compiler');
});
コード例 #7
0
ファイル: ContactController.php プロジェクト: Dimimo/Booklet
 /**
  * Safe the email to the database, both for new emails as for replies
  *
  * @param Request $request
  *
  * @return $this
  */
 public function emailPosted(Request $request)
 {
     $email = $request->all();
     //the email has to be saved twice, for the sender and the receiver
     $receiver = $this->_getModelAndId($email['model'], $email['id']);
     $sender = Auth::user();
     if ($sender->id == $receiver->id) {
         return redirect(route('email.inbox'))->with(['error' => 'You can not email yourself!']);
     }
     //create a subject if empty
     if ($email['subject'] == '') {
         $email['subject'] = '(no title)';
     }
     //for replied emails, set has_replied
     if (isset($email['email_id'])) {
         DB::table('emails')->where('id', $email['email_id'])->update(['has_replied' => 1]);
         //for inbox
         DB::table('emails')->where('id', $email['email_id'] + 1)->update(['has_replied' => 1]);
         //for send box other user
     }
     //sender
     $send_email_id = DB::table('emails')->insertGetId(['subject' => $email['subject'], 'box_id' => '2', 'user_id' => $sender->id, 'sender_id' => $sender->id, 'receiver_id' => $receiver->id, 'body' => $email['body'], 'has_read' => 1, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]);
     //receiver
     DB::table('emails')->insert(['subject' => $email['subject'], 'box_id' => '1', 'user_id' => $receiver->id, 'sender_id' => $sender->id, 'receiver_id' => $receiver->id, 'body' => $email['body'], 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]);
     $user = User::find($receiver->id);
     //the user is the receiver, if a copy must be send, do that as well
     $post = Email::find($send_email_id);
     //send the email
     Email::sendNewEmailNotification($user, $post, $email['copy']);
     if ($email['copy']) {
         $copy_send = ' A copy has been mailed to ' . Auth::user()->email . '.';
     } else {
         $copy_send = '';
     }
     return redirect(route('email.inbox'))->with(['success' => 'Your email has been send.' . $copy_send]);
 }