protected static function email($template, $title, $data, $receivers, $sender, $bcc = null, $file = null)
 {
     $data['app_name'] = Config::get('app.name');
     $data['base'] = Config::get('app.url');
     $data['title'] = $title;
     $data['receivers'] = $receivers;
     $data['user_name'] = $sender['name'];
     $data['user_email'] = $sender['email'];
     $data['bcc'] = (array) $bcc;
     $data['file'] = $file;
     $success = false;
     try {
         Log::info('<!> Sending new email...');
         Mail::queue('emails.' . $template, $data, function ($message) use($data) {
             $message->from($data['user_email'], $data['user_name'])->subject($data['app_name'] . ' - ' . $data['title']);
             if (!empty($data['receivers'])) {
                 $message->to($data['receivers']);
             }
             if (!empty($data['bcc'])) {
                 $message->bcc($data['bcc']);
             }
             if (!empty($data['file'])) {
                 $message->attach($data['file']);
             }
         });
         Log::info('...DONE!');
         // Log::info( json_encode($data) );
         $success = true;
     } catch (Exception $e) {
         Log::warning('<!!!> ...FAILED! Exception while sending email: ' . $e->getMessage());
     }
     return $success;
 }
Example #2
0
 /**
  * @param string $email
  * @param string $error
  */
 private static function sendEmail($email, $error)
 {
     \Mail::queue('emails.optimise.error', ['error' => $error], function ($message) use($email) {
         $message->from(config('mail.from.address'), config('mail.from.name'));
         $message->to($email)->subject('Problems during optimisation');
     });
 }
 public function sendTo($email, $subject, $view, $data = array())
 {
     \Mail::queue($view, $data, function ($message) use($email, $subject) {
         $message->to($email)->subject($subject);
     });
     return "Mail has been sent";
 }
 public function sendTo($email, $subject, $fromEmail, $view, $data = [])
 {
     \Mail::queue($view, $data, function ($message) use($email, $subject, $fromEmail) {
         $message->from($fromEmail, '*****@*****.**');
         $message->to($email)->subject($subject);
     });
 }
 public function create($catalog_id)
 {
     $rules = array('images' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::route(array('admin.newsletter.create', $catalog_id))->withErrors($validator)->With(Input::all());
     } else {
         $catalog = Catalog::find($catalog_id);
         $pictures = $catalog->pictures;
         $car = $catalog->car;
         $images = Input::get('images');
         $newsletter = new Newsletter();
         $newsletter->title = $catalog->title;
         $newsletter->images = $images;
         $newsletter->send_to = 0;
         $newsletter->user_id = Auth::user()->id;
         $newsletter->catalog_id = $catalog_id;
         $newsletter->save();
         $settingsEmail = Settings::where('key', '=', 'contact_email')->first();
         $settingsEmailName = Settings::where('key', '=', 'contact_name')->first();
         // Subscribers::find(8001) for testing
         $subscribers = Subscribers::all();
         foreach ($subscribers as $subscriber) {
             $data = array('subject' => $catalog->title, 'to' => $subscriber->email, 'to_name' => $subscriber->name, 'from_name' => $settingsEmailName->value, 'from' => $settingsEmail->value, 'catalog' => $catalog, 'images' => $images, 'car' => $car, 'pictures' => $pictures, 'user' => $subscriber);
             Mail::queue('emails.newsletter.html', $data, function ($message) use($data) {
                 $message->to($data['to'], $data['to_name'])->from($data['from'], $data['from_name'])->subject($data['subject']);
             });
         }
         return Redirect::route('admin.newsletter.index')->with('success', Lang::get('messages.newsletter_created'));
     }
     return Redirect::route('admin.newsletter.index')->with('success', Lang::get('messages.newsletter_created'));
 }
 public function postRegister(Request $request)
 {
     $validator = $this->validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     $activation_code = str_random(60) . $request->input('email');
     $user = new User();
     $user->username = $request->input('username');
     $user->name = $request->input('name');
     $user->lastname = $request->input('lastname');
     $user->birthdate = $request->input('birthdate');
     $user->email = $request->input('email');
     $user->password = bcrypt($request->input('password'));
     $user->activation_code = $activation_code;
     if ($user->save()) {
         $data = array('name' => $user->name, 'code' => $activation_code);
         \Mail::queue('emails.activateAccount', $data, function ($message) use($user) {
             $message->to($user->email, 'Please activate your account.');
         });
         return view('user.activateAccount');
     } else {
         Flash::message('Your account couldn\'t be create please try again');
         return redirect()->back()->withInput();
     }
 }
Example #7
0
 public function sendTo($email, $subject, $fromEmail, $view, $data = [])
 {
     \Mail::queue($view, $data, function ($message) use($email, $subject, $fromEmail) {
         $message->from($fromEmail, env('MAIL_USERNAME'));
         $message->to($email)->subject($subject);
     });
 }
Example #8
0
 public function postReset()
 {
     $this->beforeFilter('csrf');
     // Use the same password validation rules
     // from the user model
     $rules = array('code' => 'required', 'email' => 'required|email', 'password' => User::$rules['password'] . '|confirmed');
     $validator = Validator::make(Input::all(), $rules);
     if (!$validator->fails()) {
         try {
             $user = Sentry::findUserByCredentials(array('email' => Input::get('email')));
             if ($user->checkResetPasswordCode(Input::get('code'))) {
                 if ($user->attemptResetPassword(Input::get('code'), Input::get('password'))) {
                     // Password reset passed
                     Mail::queue(array('emails.password.done', 'emails.password.done_text'), array(), function ($message) use($user) {
                         $message->to($user->email, $user->first_name . ' ' . $user->last_name)->subject('Password Reset Successful');
                     });
                     return Redirect::action('AuthController@getDone');
                 } else {
                     // Password reset failed
                     Session::flash('error', 'Your password could not be reset');
                 }
             } else {
                 // The provided password reset code is Invalid
                 Session::flash('error', 'Invalid password reset code');
             }
         } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
             Session::flash('error', 'User not found, please check your email address');
         }
     } else {
         Session::flash('error', 'Please correct the following errors and try again');
     }
     Input::flash();
     return Redirect::action('AuthController@getReset')->withErrors($validator);
 }
Example #9
0
 public function sendTo($email, $subject, $fromEmail, $view, $data = [])
 {
     \Mail::queue($view, $data, function ($message) use($email, $subject, $fromEmail) {
         $message->from($fromEmail, '*****@*****.**');
         $message->to($email)->subject($subject);
     });
 }
 /**
  * 	POST to create user account.
  */
 public function postSignup()
 {
     //Retrieve POST values
     $email = Input::get('email');
     $password = Input::get('password');
     $fname = Input::get('fname');
     $lname = Input::get('lname');
     $user_details = Input::all();
     //Rules for signup form submission
     $rules = array('email' => 'required|unique:users', 'password' => 'required', 'fname' => 'required', 'lname' => 'required');
     $validation = Validator::make($user_details, $rules);
     if ($validation->fails()) {
         return Response::json($this->growlMessage($validation->messages()->getMessages(), 'error'), 500);
     } else {
         //Create user token for email verification
         $token = str_random();
         //Create new user
         $user = new User();
         $user->email = $email;
         $user->password = Hash::make($password);
         $user->fname = $fname;
         $user->lname = $lname;
         $user->token = $token;
         $user->save();
         //Send email to user for email account verification
         Mail::queue('email.signup', array('token' => $token), function ($message) use($email, $fname) {
             $message->subject('Welcome to the Madison Community');
             $message->from('*****@*****.**', 'Madison');
             $message->to($email);
             // Recipient address
         });
         return Response::json(array('status' => 'ok', 'errors' => array(), 'message' => 'An email has been sent to your email address.  Please follow the instructions in the email to confirm your email address before logging in.'));
     }
 }
 /**
  * Handle a POST request to remind a user of their password.
  *
  * @return Response
  */
 public function postConfirmation()
 {
     // 3 error cases - user already confirmed, email does not exist, password not correct
     // (prevents people from brute-forcing email addresses to see who is registered)
     $email = Input::get('email');
     $password = Input::get('password');
     $user = User::where('email', $email)->first();
     if (!isset($user)) {
         return Response::json($this->growlMessage('That email does not exist.', 'error'), 400);
     }
     if (empty($user->token)) {
         return Response::json($this->growlMessage('That user was already confirmed.', 'error'), 400);
     }
     if (!Hash::check($password, $user->password)) {
         return Response::json($this->growlMessage('The password for that email is incorrect.', 'error'), 400);
     }
     $token = $user->token;
     $email = $user->email;
     $fname = $user->fname;
     //Send email to user for email account verification
     Mail::queue('email.signup', array('token' => $token), function ($message) use($email, $fname) {
         $message->subject('Welcome to the Madison Community');
         $message->from('*****@*****.**', 'Madison');
         $message->to($email);
     });
     return Response::json($this->growlMessage('An email has been sent to your email address.  Please follow the instructions in the email to confirm your email address before logging in.', 'warning'));
 }
 public function postSeen($docId, $commentId)
 {
     $allowed = false;
     $user = Auth::user();
     $user->load('docs');
     // Check user documents against current document
     foreach ($user->docs as $doc) {
         if ($doc->id == $docId) {
             $allowed = true;
             break;
         }
     }
     if (!$allowed) {
         throw new Exception("You are not authorized to mark this annotation as seen.");
     }
     $comment = Comment::find($commentId);
     $comment->seen = 1;
     $comment->save();
     $doc = Doc::find($docId);
     $vars = array('sponsor' => $user->fname . ' ' . $user->lname, 'label' => 'comment', 'slug' => $doc->slug, 'title' => $doc->title, 'text' => $comment->text);
     $email = $comment->user->email;
     Mail::queue('email.read', $vars, function ($message) use($email) {
         $message->subject('Your feedback on Madison was viewed by a sponsor!');
         $message->from('*****@*****.**', 'Madison');
         $message->to($email);
         // Recipient address
     });
     return Response::json($comment);
 }
Example #13
0
 public function sendTo($email, $subject, $view, $data = array())
 {
     //        Mail::pretend();
     Mail::queue($view, $data, function ($message) use($email, $subject) {
         $message->to($email)->subject($subject);
     });
 }
Example #14
0
 /**
  * @param string $email
  * @param \Illuminate\Support\Collection $meetings
  */
 private static function sendEmployeeEmail($email, $meetings)
 {
     \Mail::queue('emails.optimise.ok.employee', ['meetings' => $meetings], function ($message) use($email) {
         $message->from(config('mail.from.address'), config('mail.from.name'));
         $message->to($email)->subject('Meetings of next week');
     });
 }
Example #15
0
 /**
  * @param $user
  * @param $subject
  * @param $view
  * @param $data
  */
 public function sendTo($user, $subject, $view, $data = [])
 {
     \Mail::queue($view, $data, function ($message) use($user, $subject) {
         $message->from(\Config::get('site.mail_from'), \Config::get('site.name'));
         $message->to($user->email, $user->full_name)->subject($subject);
     });
 }
 /**
  * Store a newly created employee in storage.
  *
  * @return Response
  */
 public function store()
 {
     $data = Input::all();
     $validator = Validator::make($data, array('password' => 'min:6', 'email' => 'unique:employees', 'status' => 'required', 'role' => 'required'));
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $employee = new Employee();
     $employee->name = Input::get('name');
     $employee->save();
     $employee->password = Hash::make(Input::get('password'));
     $employee->save();
     $employee->email = Input::get('email');
     $employee->save();
     $employee->gender = Input::get('gender');
     $employee->save();
     $employee->age = Input::get('age');
     $employee->save();
     $employee->city = Input::get('city');
     $employee->save();
     $employee->country = Input::get('country');
     $employee->save();
     $employee->address = Input::get('address');
     $employee->save();
     if (Input::get('phone') == '') {
         $employee->phone = 'N/A';
     } else {
         $employee->phone = Input::get('phone');
     }
     $employee->save();
     if (Input::get('cnic') == '') {
         $employee->cnic = 'N/A';
     } else {
         $employee->cnic = Input::get('cnic');
     }
     $employee->save();
     if (Input::get('branch') == '') {
         $employee->branch = 'N/A';
     } else {
         $employee->branch = Input::get('branch');
     }
     $employee->save();
     if (Input::get('note') == '') {
         $employee->note = 'N/A';
     } else {
         $employee->note = Input::get('note');
     }
     $employee->save();
     $employee->status = Input::get('status');
     $employee->save();
     $employee->role = Input::get('role');
     $employee->save();
     $data = ['link' => URL::to('login'), 'name' => Input::get('name')];
     //      Send email to employee
     Mail::queue('emails.welcome', $data, function ($message) {
         $message->to(Input::get('email'), Input::get('name'))->subject('Welcome to EMR!');
     });
     return Redirect::route('employees.index');
 }
Example #17
0
 public function sendTo($email, $subject, $fromEmail, $view, $data = [])
 {
     \Mail::queue($view, $data, function ($message) use($email, $subject, $fromEmail) {
         //            $message->from($fromEmail, '*****@*****.**');
         $message->from($fromEmail, 'Easymanage');
         $message->to($email)->subject($subject);
     });
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function postContact(ContactRequest $request)
 {
     $data = ['name' => $request->get('name'), 'email' => $request->get('email'), 'the_message' => $request->get('message')];
     \Mail::queue('emails.contact', $data, function ($message) {
         $message->to(env('MAIL_ADDRESS'), env('MAIL_NAME'))->subject('Contact Form');
     });
     return redirect()->back();
 }
 public function send($to, $additionalData = array())
 {
     $info = $this->info;
     $info['info'] = $additionalData;
     return Mail::queue('emails.templates.' . $this->info['ident'] . '_body', $info, function ($message) use($info, $to) {
         $message->from('*****@*****.**', 'WWHERE.COM.UA')->subject($info['subject'])->to($to);
     });
 }
Example #20
0
 public function sendEmail()
 {
     $data = Input::all();
     $kirim = Mail::queue('_layouts.email', $data, function ($message) use($data) {
         $message->to('*****@*****.**', $data['nama'])->subject($data['subject']);
     });
     return Redirect::back()->with('message', 'pesan anda berhasil masuk, Terima Kasih');
 }
 public function sendEmail(User $user)
 {
     $data = array('name' => $user->name, 'code' => $user->activation_code);
     \Mail::queue('emails.activateAccount', $data, function ($message) use($user) {
         $message->subject('Please activate your account.');
         $message->to($user->email);
     });
 }
 public function sendSuspendedMessage()
 {
     $user = $this->user;
     \Mail::queue('emails.suspended', ['user' => $user], function ($message) use($user) {
         $message->addReplyTo('*****@*****.**', 'Build Brighton Trustees');
         $message->to($user->email, $user->email)->subject('Your Build Brighton membership has been suspended');
     });
 }
Example #23
0
 public function sendMailBlockAcount($email, $reason, $banExpired)
 {
     $contentEmail = "\nXin chào " . $email . " <br>\nTài khoản của bạn đã bị khoá trên Mazii vì lý do:\n" . $reason . "\nThời hạn khoá đến ngày" . $banExpired . "\nXin hãy liên lạc với chúng tôi nếu lý do không phải như vậy.\nTrân trọng!\nMazii";
     $data = array('email' => $email, 'content' => $contentEmail);
     return Mail::queue([], array('firstname' => 'Từ điển Mazii'), function ($message) use($data) {
         $message->to($data['email'], $data['email'])->subject('Khóa tài khoản')->setBody($data['content']);
     });
 }
 public function sendEmail(User $user)
 {
     $data = array('name' => $user->name, 'code' => $user->activation_code);
     \Mail::queue('emails.activateAccount', $data, function ($message) use($user) {
         $message->subject(\Lang::get('auth.pleaseActivate'));
         $message->to($user->email);
     });
 }
 public function store()
 {
     $this->feedbackValidator->validate(\Request::only('comments'));
     $memberName = \Auth::user()->name;
     \Mail::queue('emails.feedback', ['memberName' => $memberName, 'comments' => \Request::get('comments')], function ($message) {
         $message->to('*****@*****.**', 'Arthur Guy')->subject('BBMS Feedback');
     });
     return \Response::json(['success' => 1]);
 }
Example #26
0
 /**
  * Store a newly created patient in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Patient::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $patient = new Patient();
     $patient->name = Input::get('name');
     //  $patient->save();
     $patient->dob = Input::get('dob');
     //$patient->save();
     if (Input::has('email')) {
         $patient->email = Input::get('email');
         //  $patient->save();
     } else {
         $patient->email = 'N/A';
         //$patient->save();
     }
     $patient->gender = Input::get('gender');
     //$patient->save();
     $patient->age = Input::get('age');
     //$patient->save();
     $patient->city = Input::get('city');
     //$patient->save();
     $patient->country = Input::get('country');
     // $patient->save();
     $patient->address = Input::get('address');
     //$patient->save();
     if (Input::get('phone') == '') {
         $patient->phone = 'N/A';
     } else {
         $patient->phone = Input::get('phone');
     }
     // $patient->save();
     if (Input::get('cnic') == '') {
         $patient->cnic = 'N/A';
     } else {
         $patient->cnic = Input::get('cnic');
     }
     //$patient->save();
     if (Input::get('note') == '') {
         $patient->note = 'N/A';
     } else {
         $patient->note = Input::get('note');
     }
     //$patient->save();
     $patient->status = "OPD";
     $patient->patient_id = "P0" . $patient->id;
     $patient->save();
     if (Input::has('email')) {
         $data = ['name' => Input::get('name')];
         Mail::queue('emails.patient_welcome', $data, function ($message) {
             $message->to(Input::get('email'), Input::get('name'))->subject('Welcome to EMR!');
         });
     }
     return Redirect::route('patients.index');
 }
Example #27
0
 public function store(Request $request)
 {
     $notice = $this->createNotice($request);
     \Mail::queue('emails.dmca', compact('notice'), function ($message) use($notice) {
         $message->from($notice->getOwnerEmail())->to($notice->getRecipientEmail())->subject('DMCA Notice');
     });
     flash()->overlay('Συγχαρητήρια', 'This notice has been added successfully.');
     return redirect('notices');
 }
 public function store(ProcessContactRequest $request)
 {
     $data = ['name' => Request::input('name'), 'email' => Request::input('email'), 'subject' => Request::input('subject'), 'body' => Request::input('body')];
     \Mail::queue('emails.contact', $data, function ($message) use($data) {
         $message->from($data['email'])->to('*****@*****.**')->subject($data['subject']);
     });
     flash('your message was sent sucessfully');
     return redirect()->back();
 }
Example #29
0
 public function store(Request $request)
 {
     $data = session()->get('dmca');
     $notice = Notice::open($data)->useTemplate($request->input('template'));
     \Auth::user()->notices()->save($notice);
     \Mail::queue('emails.dmca', compact('notice'), function ($message) use($notice) {
         $message->from($notice->getOwnerEmail())->to($notice->getRecipientEmail())->subject('DMCA Notice');
     });
     return redirect('notices');
 }
Example #30
0
 /**
  * Send contact email.
  *
  * @return Response
  */
 public function contact(Request $request)
 {
     $email = $request->input("email");
     $name = $request->input("nombre");
     \Mail::queue('emails.contact', $request->all(), function ($msg) use($email, $name) {
         $msg->from($email, $name);
         $msg->to('*****@*****.**', 'Fundaseth')->subject('Contacto [WEB]');
     });
     return array('status' => 'OK', 'code' => 200, 'message' => 'Email enviado.');
 }